X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=remote%2Fgpg-gen-key;h=e13939ccf70eaaf7569d11c87b73cd428d2499be;hp=fc7ddf720e5e0f02184ddb3aea046a3bdf968c63;hb=b1959d9495c8be1d6a6894d564a3abcfc04c28ce;hpb=3ad6118386977e346d81042e924e5db9c5f15b7d diff --git a/remote/gpg-gen-key b/remote/gpg-gen-key index fc7ddf7..e13939c 100755 --- a/remote/gpg-gen-key +++ b/remote/gpg-gen-key @@ -19,7 +19,7 @@ if test ! -e "$tool"/var/sec/openpgp/"$uid".pass.gpg fi if ! "$tool"/remote/gpg --list-keys -- "$uid" >/dev/null then - "$tool"/remote/gpg --batch --gen-key + "$tool"/remote/gpg --batch --gen-key <<-EOF # DOC: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS;hb=refs/heads/STABLE-BRANCH-1-4 Key-Type: RSA Key-Length: 4096 @@ -30,14 +30,11 @@ if ! "$tool"/remote/gpg --list-keys -- "$uid" >/dev/null %commit EOF fi -caps=$( - "$tool"/remote/gpg --with-colons --fixed-list-mode --with-fingerprint --list-secret-keys \ - -- "$uid" | - sed -e 's/^ssb\(:[^:]*\)\{11\}.*/\1/;t;d' - ) +caps=$("$tool"/remote/gpg --with-colons --fixed-list-mode --with-fingerprint --list-secret-keys \ + -- "$uid" | grep '^ssb:' | cut -d : -f 12) for cap in ${subkey_caps:-} do - test ! "$caps" = "$(printf %s "$caps" | sed -e 's/'"$cap"'//g')" || + printf '%s\n' $caps | grep -Fqx "$cap" || printf '%s\n' 8 s e $cap q 4096 ${expire:-0} save | "$tool"/remote/gpg --keyid-format "long" --with-colons --fixed-list-mode --expert \ --passphrase-fd 3 --command-fd 0 --edit-key "$uid" addkey 3<<-EOF