git://git.onelab.eu
/
myplc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
430c5f2
)
sense the system to use gpg1 when installed
author
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Thu, 27 Feb 2020 10:52:00 +0000
(11:52 +0100)
committer
Thierry Parmentelat
<thierry.parmentelat@inria.fr>
Thu, 27 Feb 2020 10:52:00 +0000
(11:52 +0100)
plc.d/gpg
patch
|
blob
|
history
diff --git
a/plc.d/gpg
b/plc.d/gpg
index
6a2eef4
..
b947995
100755
(executable)
--- a/
plc.d/gpg
+++ b/
plc.d/gpg
@@
-30,13
+30,17
@@
# to gnupg2, that should work fine (took some time to get right actually)
# but this is currently unused
# to gnupg2, that should work fine (took some time to get right actually)
# but this is currently unused
+# for now we run only with gpg1, but on recent systems it means
+# we need to invoke explicitly gpg1
+type gpg1 >& /dev/null && GPG=gpg1 || GPG=gpg
+
+# this is more for when we support both
# the default gpg command is version 1 up to f29, version 2 starts with f31
# the default gpg command is version 1 up to f29, version 2 starts with f31
-# that could be more for when we support both
-GPG_MAJOR_VERSION=$(gpg --version | grep '^gpg' | cut -d' ' -f 3 | cut -d. -f1)
+GPG_MAJOR_VERSION=$($GPG --version | grep '^gpg' | cut -d' ' -f 3 | cut -d. -f1)
function generate_key_v1() {
local homedir=$1
function generate_key_v1() {
local homedir=$1
-
gpg
--homedir=$homedir --no-permission-warning --batch --no-tty --yes --gen-key << EOF
+
$GPG
--homedir=$homedir --no-permission-warning --batch --no-tty --yes --gen-key << EOF
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
@@
-58,7
+62,7
@@
function generate_key_v2() {
return 1
local homedir=$1
return 1
local homedir=$1
-
gpg
--homedir=$homedir --generate-key --batch << EOF
+
$GPG
--homedir=$homedir --generate-key --batch << EOF
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
@@
-136,7
+140,7
@@
case "$1" in
break
fi
done < <(
break
fi
done < <(
-
gpg
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
+
$GPG
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \
@@
-146,7
+150,7
@@
case "$1" in
IFS=$OLDIFS
# Add a new UID if appropriate. GPG will detect and merge duplicates.
IFS=$OLDIFS
# Add a new UID if appropriate. GPG will detect and merge duplicates.
-
gpg
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
+
$GPG
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \
@@
-162,7
+166,7
@@
EOF
# Install the key in the RPM database
mkdir -p /etc/pki/rpm-gpg
# Install the key in the RPM database
mkdir -p /etc/pki/rpm-gpg
-
gpg
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
+
$GPG
--homedir=$homedir --no-permission-warning --batch --no-tty --yes \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \
--no-default-keyring \
--secret-keyring=$PLC_ROOT_GPG_KEY \
--keyring=$PLC_ROOT_GPG_KEY_PUB \