X-Git-Url: https://git.cyclocoop.org/?p=lhc%2Fateliers.git;a=blobdiff_plain;f=remote%2Fgpg-gen-key;h=8a47b03ef1ed046d324636874e4f21292b9e1573;hp=fc7ddf720e5e0f02184ddb3aea046a3bdf968c63;hb=82a43a9c95892ecfa8bad1a72b490ad0bf60cd3b;hpb=0d705d8e2a919ee40866307aa3e18b1a5c4e7583 diff --git a/remote/gpg-gen-key b/remote/gpg-gen-key index fc7ddf7..8a47b03 100755 --- a/remote/gpg-gen-key +++ b/remote/gpg-gen-key @@ -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