Correction : {host,local,remote}/ : duplicity + MySQL.
[lhc/ateliers.git] / remote / gpg-gen-key
index fc7ddf7..8a47b03 100755 (executable)
@@ -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