comparison sbin/fpkg @ 696:44a702b32c01

fpkg: include common.subr and use modernized error reporting
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 01 Oct 2024 19:28:57 +0200
parents 5931f16f098f
children 7126823e4d70
comparison
equal deleted inserted replaced
695:5931f16f098f 696:44a702b32c01
100 All other environment variables that affect `pkg` are effective also. 100 All other environment variables that affect `pkg` are effective also.
101 101
102 A "compatible jail" is a jail that'"'"'s "freebsd-version -u" is the same 102 A "compatible jail" is a jail that'"'"'s "freebsd-version -u" is the same
103 as the host'"'"'s. 103 as the host'"'"'s.
104 ' 104 '
105
106
107 _p_datadir='@@DATADIR@@'
108 [ "${_p_datadir#@@DATADIR}" = '@@' ] && _p_datadir="$(dirname "$0")"/../share/local-bsdtools
109 . "${_p_datadir}/common.subr"
110
105 111
106 #: 112 #:
107 #: Configuration directory 113 #: Configuration directory
108 #: 114 #:
109 : ${CONFIGDIR:="@@ETCDIR@@"} 115 : ${CONFIGDIR:="@@ETCDIR@@"}
385 ;; 391 ;;
386 \?) 392 \?)
387 exit 2; 393 exit 2;
388 ;; 394 ;;
389 *) 395 *)
390 echo "ERROR: option handling failed" >&2 396 fatal 2 "option handling failed"
391 exit 2
392 ;; 397 ;;
393 esac 398 esac
394 done 399 done
395 400
396 # 401 #
401 OPTIND=1 406 OPTIND=1
402 407
403 command="$1" 408 command="$1"
404 shift 409 shift
405 410
406 test -n "$command" || { echo "ERROR: no command given" >&2; exit 2; } 411 test -n "$command" || fatal 2 "no command given"
407 412
408 case "${command}" in 413 case "${command}" in
409 audit) 414 audit)
410 command_audit "$@" 415 command_audit "$@"
411 ;; 416 ;;
432 ;; 437 ;;
433 vv) 438 vv)
434 command_vv "$@" 439 command_vv "$@"
435 ;; 440 ;;
436 *) 441 *)
437 echo "ERROR: unknown command \`${command}'" >&2 442 fatal 2 "unknown command \`${command}'"
438 exit 2;
439 ;; 443 ;;
440 esac 444 esac