aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-02-20 02:14:39 +0100
committerGuix Patches Tester <>2020-02-20 12:44:11 +0000
commitd57acbb176b463e659b8ae998ef3e5c80fd8fb26 (patch)
treec9e7a09055e476320246a0a40153f675ce3747b9
parent35f35111678e6622301b414f3d464acb71e106bb (diff)
downloadpatches-series-2946.tar
patches-series-2946.tar.gz
etc: Add an `allow-import-gpg' option to the installer script.series-2946
* etc/guix-install.sh: Add an `allow-import-gpg' option to support fetching the OpenPGP public key automatically.
-rwxr-xr-xetc/guix-install.sh26
1 files changed, 23 insertions, 3 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index bfd3842933..d96c5838b8 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -57,6 +57,7 @@ INF="[ INFO ] "
DEBUG=0
GNU_URL="https://ftp.gnu.org/gnu/guix/"
OPENPGP_SIGNING_KEY_ID="3CE464558A84FDC69DB40CFB090B11993D9AEBB5"
+GPG_IMPORT=0
# This script needs to know where root's home directory is. However, we
# cannot simply use the HOME environment variable, since there is no guarantee
@@ -109,9 +110,14 @@ chk_gpg_keyring()
# Without --dry-run this command will create a ~/.gnupg owned by root on
# systems where gpg has never been used, causing errors and confusion.
gpg --dry-run --list-keys ${OPENPGP_SIGNING_KEY_ID} >/dev/null 2>&1 || (
- _err "${ERR}Missing OpenPGP public key. Fetch it with this command:"
- echo " wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -"
- exit 1
+ if [ "${GPG_IMPORT}" = "1" ]; then
+ wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -
+ else
+ _err "${ERR}Missing OpenPGP public key. Fetch it with this command:"
+ echo " wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -"
+ _err "or run this script with the --allow-import-gpg option"
+ exit 1
+ fi
)
}
@@ -484,4 +490,18 @@ main()
_msg "${INF}Run 'info guix' to read the manual."
}
+# Reading options
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --allow-import-gpg)
+ GPG_IMPORT=1
+ shift
+ ;;
+ *)
+ _err "Unknown option $1"
+ exit 1
+ ;;
+ esac
+done
+
main "$@"