X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-keys/blobdiff_plain/1d0c984e332f288dd3db8f67831dcf662c3e9b1b..refs/heads/mdw/wip.crybaby.2016-05-05:/keyfunc.sh.in diff --git a/keyfunc.sh.in b/keyfunc.sh.in index 704122b..c68fec1 100644 --- a/keyfunc.sh.in +++ b/keyfunc.sh.in @@ -187,6 +187,19 @@ checkident () { check "$1" "$R_IDENT" "$2"; } checkword () { check "$1" "$R_WORD" "$2"; } checklabel () { check "$1 label" "$R_LABEL" "$2"; } +## Boolean canonification. +boolify () { + var=$1 what=$2 + + eval v=\$$var + case $v in + 1 | y | yes | on | t | true) v=t ;; + 0 | n | no | off | f | false | nil) v=nil ;; + *) echo >&2 "$quis: bad boolean $what \`$v'"; exit 1 ;; + esac + eval $var=\$v +} + ###-------------------------------------------------------------------------- ### Key storage and properties. @@ -425,19 +438,20 @@ c_genkey () { ## options to the key type. ## Set options and check them. + kopt_owner=$kowner kopt_label=$klabel setprops "option" kopt_ "$@" checkprops "option" kopt_ "$k_genopts" ## Create directory structure and start writing metadata. rm -rf "$kdir.new" mkdir -m755 -p "$kdir.new" - case "$knub" in */*) mkdir -m700 -p "${knub%/*}" ;; esac + case "$knub" in */*) mkdir -m755 -p "${knub%/*}" ;; esac cat >"$kdir.new/meta" <"$knub.new"; umask $umask + (umask 077; makenub >"$knub.new") k_generate "$kdir.new" "$knub.new" $hook "$kdir.new" "$knub.new" @@ -726,6 +740,7 @@ $cmds EOF case $foundp in t) + usage; echo eval help=\$help_$cmdname; echo "$help" ;; nil)