unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#39684] [PATCH] etc: Automatically download the pgp key
@ 2020-02-20  1:22 Julien Lepiller
  2020-02-20 12:41 ` Julien Lepiller
  2021-11-19 15:38 ` bug#39684: etc: Automatically download the gpg key Julien Lepiller
  0 siblings, 2 replies; 4+ messages in thread
From: Julien Lepiller @ 2020-02-20  1:22 UTC (permalink / raw)
  To: 39684

Hi guix,

this patch should improve the way the gpg key is fetched. Instead of
asking the user to copy the command, when the user passes
--allow-import-gpg, the script will import the gpg key by itself.

The rationale behind this is a user complaining a few weeks ago on the
Fediverse that the installation video didn't work. In fact, they didn't
understand the gpg command and failed to import the key; mentionning
--allow-import-gpg in the video should help in that case :)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#39684] [PATCH] etc: Automatically download the pgp key
  2020-02-20  1:22 [bug#39684] [PATCH] etc: Automatically download the pgp key Julien Lepiller
@ 2020-02-20 12:41 ` Julien Lepiller
  2020-03-18  9:59   ` Ludovic Courtès
  2021-11-19 15:38 ` bug#39684: etc: Automatically download the gpg key Julien Lepiller
  1 sibling, 1 reply; 4+ messages in thread
From: Julien Lepiller @ 2020-02-20 12:41 UTC (permalink / raw)
  To: 39684

[-- Attachment #1: Type: text/plain, Size: 633 bytes --]

Le Thu, 20 Feb 2020 02:22:20 +0100,
Julien Lepiller <julien@lepiller.eu> a écrit :

> Hi guix,
> 
> this patch should improve the way the gpg key is fetched. Instead of
> asking the user to copy the command, when the user passes
> --allow-import-gpg, the script will import the gpg key by itself.
> 
> The rationale behind this is a user complaining a few weeks ago on the
> Fediverse that the installation video didn't work. In fact, they
> didn't understand the gpg command and failed to import the key;
> mentionning --allow-import-gpg in the video should help in that case
> :)
> 
> 
> 

Here is the patch :)

[-- Attachment #2: 0001-etc-Add-an-allow-import-gpg-option-to-the-installer-.patch --]
[-- Type: text/x-patch, Size: 2148 bytes --]

From aebea6bcfa615bc644c9afa1120eeb34f0956c5a Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Thu, 20 Feb 2020 02:14:39 +0100
Subject: [PATCH] etc: Add an `allow-import-gpg' option to the installer
 script.

* etc/guix-install.sh: Add an `allow-import-gpg' option to support
fetching the OpenPGP public key automatically.
---
 etc/guix-install.sh | 26 +++++++++++++++++++++++---
 1 file 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 "$@"
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#39684] [PATCH] etc: Automatically download the pgp key
  2020-02-20 12:41 ` Julien Lepiller
@ 2020-03-18  9:59   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-03-18  9:59 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: 39684

Hi Julien!

Julien Lepiller <julien@lepiller.eu> skribis:

>>From aebea6bcfa615bc644c9afa1120eeb34f0956c5a Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 20 Feb 2020 02:14:39 +0100
> Subject: [PATCH] etc: Add an `allow-import-gpg' option to the installer
>  script.
>
> * etc/guix-install.sh: Add an `allow-import-gpg' option to support
> fetching the OpenPGP public key automatically.

Sounds like a good idea.

> --- 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

Perhaps define:

  OPENPGP_KEY_URL="https://sv.gnu.org/people/viewgpg.php?user_id=15145"

and use it everywhere?

>  # 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 -

This would become wget "$OPENPGP_KEY_URL" (better use quotes).

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#39684: etc: Automatically download the gpg key
  2020-02-20  1:22 [bug#39684] [PATCH] etc: Automatically download the pgp key Julien Lepiller
  2020-02-20 12:41 ` Julien Lepiller
@ 2021-11-19 15:38 ` Julien Lepiller
  1 sibling, 0 replies; 4+ messages in thread
From: Julien Lepiller @ 2021-11-19 15:38 UTC (permalink / raw)
  To: 39684-close

[-- Attachment #1: Type: text/plain, Size: 79 bytes --]

An equivalent functionnality was implemented independently, so closing. Thanks!

[-- Attachment #2: Type: text/html, Size: 120 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-19 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20  1:22 [bug#39684] [PATCH] etc: Automatically download the pgp key Julien Lepiller
2020-02-20 12:41 ` Julien Lepiller
2020-03-18  9:59   ` Ludovic Courtès
2021-11-19 15:38 ` bug#39684: etc: Automatically download the gpg key Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).