about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xbollux21
1 files changed, 16 insertions, 5 deletions
diff --git a/bollux b/bollux index b319e9d..079c83b 100755 --- a/bollux +++ b/bollux
@@ -347,18 +347,26 @@ bollux() {
347 request "$URL" | handle "$URL" 347 request "$URL" | handle "$URL"
348} 348}
349 349
350process_cmdline() {
351 while getopts :hL: OPT; do
352 case "$OPT" in
353 h) bollux_usage ;;
354 L) LOGL="$OPTARG" ;;
355 :) die 1 "Option -$OPTARG requires an argument" ;;
356 *) die 1 "Unknown option: -$OPTARG" ;;
357 esac
358 done
359}
360
350bollux_setup() { 361bollux_setup() {
351 mkfifo .resource 362 trap bollux_cleanup INT QUIT EXIT
352 trap bollux_cleanup INT QUIT TERM EXIT
353} 363}
354 364
355bollux_cleanup() { 365bollux_cleanup() {
356 echo 366 echo
357 rm -f .resource
358} 367}
359 368
360if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then 369if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
361 set -euo pipefail # strict mode
362 # requirements here -- so they're only checked once 370 # requirements here -- so they're only checked once
363 require gawk 371 require gawk
364 require dd 372 require dd
@@ -366,6 +374,9 @@ if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
366 require openssl 374 require openssl
367 require sed 375 require sed
368 376
377 bollux_setup
378
369 bollux "$@" 379 bollux "$@"
370 echo 380
381 bollux_cleanup
371fi 382fi