Commit graph

93 commits

Author SHA1 Message Date
Richard Sent
40c6f70839
guix-install.sh: Add unique requirement for sysv init system
This improves the installer's ability to detect that all requirements are
present regardless of init system. It also avoids performing the requirement
check twice (printing excessively to the console) and provides a framework for
adding new init system specific requirements if it's needed in the future.

* etc/guix-install.sh (add_init_sys_require): Create.
(SYSV_INIT_REQUIRE): Create.
(main_install): Reorder installer steps so all requirements are checked in one
pass.

Change-Id: Ic541c1b90499d504642b7ab4ae595501b1a37b0d
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-06-04 12:08:34 +02:00
Tomas Volf
887d031382
guix-install.sh: Relax check for OpenRC.
On my virtual private servers running Alpine, the install script failed to
identify the init system.  The virtual server is LXC based, and OpenRC
identifies itself like this:

    # openrc --version
    openrc (OpenRC [LXC]) 0.52.1

The regular expression failed to match it.  After relaxing the check (by
removing the trailing `)' requirement) the installation went fine and I got
functional Guix installation.

* etc/guix-install.sh (chk_init_sys): Drop trailing \) from the regular
expression.

Change-Id: I5f951226341e631fb34cc6c26cfbb87656dab77a
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-06-02 12:05:09 +02:00
Trevor Arjeski
1262e8b122
guix-install.sh: Add ~/.guix-profile/share/info to INFOPATH.
Adding ~/.guix-profile/share/info to the INFOPATH env var so that when a user
does `guix install [package]` that package's info pages can be found.

* etc/guix-install.sh (sys_create_init_profile): Add
$GUIX_PROFILE/share/info to INFOPATH in ‘/etc/profile.d/zzz-guix.sh’.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: I8958261c388ddee5659f0f1ce1c0c9813dc0f052
2024-06-02 12:05:09 +02:00
Tomas Volf
08bb2dbb13
guix-install.sh: Fix setting GUIX_LOCPATH.
After installing Guix home on my new foreign system, the locale did not
work and GDM did not even let me to log in.  After some digging around using
tty3 and tty4, I realized the GUIX_LOCPATH is not being set properly.

I had nothing installed in the ~/.guix-profile (the symlink did not even
exist) and I had glibc-locales installed in ~/.guix-home, yet GUIX_LOCPATH
contained "$HOME/.guix-profile/lib/locale:".

I believe when the code was modified from the original "home or profile" to
the current "home and profile" the || was used by accident instead of &&.

I also remove the trailing :, since it is taken care of by the ${...:+:}.

* etc/guix-install.sh (sys_create_init_profile):

Change-Id: I8a3287fe809af58aee2edc924154eecf91fa1eb8
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-29 22:56:44 +02:00
Tomas Volf
d7bf731573
guix-install.sh: Add default value for XCURSOR_PATH.
This improves compatibility with (at least) Gnome based systems.  On my new
Ubuntu 22.04 install the mouse cursor was broken (after I installed Guix)
until I set this.

* etc/guix-install.sh (sys_create_init_profile): Set default value for
XCURSOR_PATH.

Change-Id: I489f0307d99e4d8d82671f291c78b90c7b6dae4a
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-04-29 22:56:05 +02:00
Janneke Nieuwenhuizen
78390634d7
guix-install.sh: Make Guix modules available too.
* etc/guix-install.sh (GUILE_LOAD_PATH): Prepend directory to current Guix
modules.
(GUILE_LOAD_COMPILED_PATH): Likewise to compiled modules.

Change-Id: I0b2722a38b1f8ebab32142cbc372a23cadfb0620
2024-04-07 16:26:28 +02:00
Ludovic Courtès
dd476cfb76
guix-install.sh: Add ‘--uninstall’ flag.
* etc/guix-install.sh (REQUIRE): Add groupdel and userdel.
(chk_term): Handle ‘WAR’.
(sys_delete_store, sys_delete_build_user, sys_delete_guix_daemon)
(sys_delete_init_profile, sys_delete_user_profiles): New functions.
(main): Rename to…
(main_install): … this.
(main_uninstall): New function.
(main): Dispatch between these two.
* doc/guix.texi (Installation): Refer to “Binary Installation” instead
of repeating it.
(Binary Installation): Document uninstallation.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Change-Id: I55b7c10823773bced2e268273e8ce828cb3bd98d
2024-04-05 18:21:23 +02:00
Christopher Baines
ac19e038b4
Switch order of the default substitute servers.
The aim here is to improve the user experience.  There's anecdotal evidence
that the network performance for bordeaux is better compared to ci at least
for some users, and I don't know of any issues with rate limiting or access
restriction for bordeaux compared to ci.  It also has IPv6 support.

Additionally, bordeaux generally had more substitutes than ci, particularly
for aarch64-linux and armhf-linux.  This change will offer a very slight
speedup for those substitutes that only bordeaux has.

Bordeaux has been a default substitute server for nearly 3 years now and I
think this change is overdue.  I'm also hopeful that we'll be able to build on
the testing regarding mirrors for bordeaux, and that'll allow potentially
improving the hosting setup (through providing more redundancy) and further
improving substitute fetching for users who currently have issues with
substitute access.

* config-daemon.ac: Switch substitute urls order.
* doc/guix.texi: Ditto.
* etc/guix-install.sh: Ditto.
* gnu/installer/newt/network.scm (wait-service-online): Ditto.
* guix/store.scm (%default-substitute-urls): Ditto.

Change-Id: I4f6d93ae1fc8b03d80b47b18b5749a51f1fde17b
Signed-off-by: Christopher Baines <mail@cbaines.net>
2024-04-03 17:18:38 +01:00
Tobias Geerinckx-Rice
7419b187d1
guix-install.sh: Fix incomplete installation.
‘false || return’ returns false, and
‘set -e’ aborts the script.  This leaves
Guix half installed with visual indication of error.

* etc/guix-install.sh (sys_customize_bashrc, sys_maybe_setup_selinux):
Explicitly return 0.
2023-07-16 02:00:07 +02:00
Tobias Geerinckx-Rice
c89e0b4d20
guix-install.sh: Install SELinux policy only if tools are present.
* etc/guix-install.sh (sys_maybe_setup_selinux): Silently return if
the ‘semodule’ or ‘restorecon’ commands are missing.
2023-07-16 02:00:07 +02:00
Tobias Geerinckx-Rice
93243a6ca4
guix-install.sh: Remove any old systemd units first.
Don't clobber /dev/null permissions if units are masked.

* etc/guix-install.sh (sys_enable_guix_daemon): Factor out unit
installation.  Unconditionally remove any old units.  Install and enable
gnu-store.mount after guix-daemon.service.
2023-07-09 02:00:09 +02:00
Tobias Geerinckx-Rice
024f78aba2
guix-install.sh: Don't patch guix-daemon.service.
* etc/guix-install.sh (sys_enable_guix_daemon):
Remove obsolete sed invocations.
2023-07-09 02:00:09 +02:00
Tobias Geerinckx-Rice
67790e7f2f
guix-install.sh: Unconditionally install gnu-store.mount.
* etc/guix-install.sh (sys_enable_guix_daemon):
Remove obsolete conditional.
2023-07-09 02:00:08 +02:00
Tobias Geerinckx-Rice
ff23e34f56
guix-install.sh: Don't extract the binary ‘.’.
* etc/guix-install.sh (sys_create_store): Strip the first tar
file name component.
2023-07-05 22:28:56 +02:00
Ludovic Courtès
4166b583fb
guix-install.sh: Install SELinux policy and relabel file systems if needed.
Fixes <https://issues.guix.gnu.org/62487>.

* etc/guix-install.sh (sys_maybe_setup_selinux): New function.
(main): Use it.
2023-05-25 12:51:15 +02:00
Maxim Cournoyer
e29571afc6
guix-install.sh: Fix GUIX_ALLOW_OVERWRITE condition.
Before this change, the "Overwriting existing installation!" would be
displayed erroneously.

* etc/guix-install.sh (sys_create_store): Fix overwrite conditional.
2023-04-24 12:51:41 -04:00
Andrew Tropin
02033bfc05
guix-install.sh: Source both profiles, default user's and home.
* etc/guix-install.sh (sys_create_init_profile): Source both profiles, default
user's and home.
2023-04-09 11:06:54 +04:00
Maxim Cournoyer
23d56ba150
guix-install.sh: Add GUIX_ALLOW_OVERWRITE environment variable.
The need for this use case appeared when attempting to install Guix on a truly
minimal image made with Buildroot, which lacked enough GNU components that I
had to extract a guix pack to /gnu before attempting installation, which would
then refuse to proceed because of the existing /gnu.

* etc/guix-install.sh: Document environment variables.
(sys_create_store) [GUIX_ALLOW_OVERWRITE]: Skip pre-existing installation
checks and output a warning.  Extract the tarball directly to /.
2023-02-17 02:55:43 +01:00
Maxim Cournoyer
7ce9b7e706
guix-install.sh: Directly exit in case of errors in chk_require.
* etc/guix-install.sh (chk_require): Directly exit in case of errors in
chk_require, instead of relying on 'set -e'.
2022-12-16 00:14:30 -05:00
Maxim Cournoyer
1febafb4af
guix-install.sh: Add missing "useradd" command.
* etc/guix-install.sh: (REQUIRE): Add missing "useradd" command.
2022-12-16 00:14:30 -05:00
Tobias Geerinckx-Rice
6cf6f42334
guix-install.sh: Gracefully fail on | bash.
* etc/guix-install.sh (welcome): Print an error message and a hint if
the first read fails.
2022-12-11 01:00:00 +01:00
Tobias Geerinckx-Rice
f49682a09e
guix-install.sh: Authorize all project build farms at once.
* etc/guix-install.sh (sys_authorize_build_farms):
Iterate over all hosts.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-12-09 09:46:22 +01:00
Maxim Cournoyer
6aa5d1dc24
guix-install.sh: Expand mktemp template for busybox compatibility.
Fixes <https://issues.guix.gnu.org/58858>.

* etc/guix-install.sh (main): Use 6 'X' characters in the template, as this is
the minimum required by Busybox's mktemp (which matches glibc's mktemp
behavior).

Reported-by: conses <contact@conses.eu>
2022-11-16 16:23:15 -05:00
Prafulla Giri
775134ebf5
guix-install.sh: Remove unnecessary XDG_DATA_DIRS export.
This started out as a bug-fix for a GUI login loop that was resulting from XDG_DATA_DIRS
not including any of the host distro's directories. The solution was to export the vari-
able (with fail-safe defaults) before source-ing GUIX_PROFILE/etc/profile. It turns out
changes have already been made to ensure that XDG_DATA_DIRS, etc. are always exported
before anything guix-specific. So, this export is no longer necessary.

For reference, the aforementioned bug was found on a Debian 11 machine and it's guix.sh
init profile for guix version 1.2.

* etc/guix-install.sh (sys_create_init_profile): Remove unnecessary
XDG_DATA_DIRS export.

Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
2022-11-14 10:25:45 +08:00
Konrad Hinsen
93be56a3ab
guix-install.sh: Run guix.sh script in /etc/profile.d last.
* etc/guix-install.sh: Rename /etc/profile.d/guix.sh to zzz-guix.sh.

This script refers to environment variables set by the host distribution.
They may be set in other scripts in /etc/profile.d, which must therefore
be run first.
Example: in Ubuntu 20.04, XDG_DATA_DIRS is set in
/etc/profile.d/xdg_dirs_desktop_session.sh

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-11-08 10:55:54 +01:00
Tobias Geerinckx-Rice
0d2ad16c07
guix-install.sh: Cosmetically tweak non-interactive output.
Avoid printing

  Press return to continue...[1666352494.051]: Starting installation…
  [1666352648.869]: …

when the return itself wasn't echoed on the console.

* etc/guix-install.sh (welcome): Add a carriage return to the prompt,
so that the next line of output may overwrite it.
2022-10-16 02:00:29 +02:00
Tobias Geerinckx-Rice
a326e3085d
guix-install.sh: Warn if we suspect dodgy automation.
This doesn't affect the installation (yet), but reserves the right to
default to safe values other than ‘y’ in future.

* etc/guix-install.sh (welcome): Warn if the ‘return’ wasn't.
2022-10-16 02:00:28 +02:00
Tobias Geerinckx-Rice
1e8e84b286
guix-install.sh: Treat all uncaught errors as fatal.
* etc/guix-install.sh: Set -o pipefail.
2022-10-16 02:00:28 +02:00
Tobias Geerinckx-Rice
54c0b5c457
guix-install.sh: Suggest what to do if fetching OpenPGP key(s) fails.
* etc/guix-install.sh (chk_gpg_keyring): Report an _err and set the
exit_flag if wget | gpg --import fails.
2022-10-16 02:00:28 +02:00
Tobias Geerinckx-Rice
9a0a786c25
guix-install.sh: Time out fetching OpenPGP keys.
The default 900s provide no useful backstop in interactive use.

* etc/guix-install.sh (chk_gpg_keyring): Add a 30s wget --timeout.
2022-10-16 02:00:28 +02:00
Maxim Cournoyer
e46bb5fd5a
guix-install.sh: Restore compatibility with "yes" invocation.
Commit 6a2e303d3a had modified prompt_yes_no to only read a single character,
aiming to ease the user experience.  This was, in retrospect, a bad idea, as
it makes user input error more likely and introduces complexity.

This commit reverts to line-oriented input, while preserving the default yes
value so that a user can simply hit 'Enter' at the prompt in place of typing
"yes".

* etc/guix-install.sh (_flush): Delete function.
(prompt_yes_no): Restore line-oriented read.  Remove loop.  Make anything else
than yes means no.  Use Bash features to streamline definition.

Reported-by: Lars-Dominik Braun <lars@6xq.net> and others.
2022-10-11 12:00:44 -04:00
Maxim Cournoyer
9ca0f9e5a9
guix-install.sh: Add Bash prompt customization option.
Fixes <https://issues.guix.gnu.org/55484>.

* etc/guix-install.sh (sys_customize_bashrc): New function.
(main): Use it.
2022-10-07 08:25:40 -04:00
Maxim Cournoyer
231e5f29ae
guix-install.sh: Introduce 'die' utility function.
* etc/guix-install.sh (die): New function.
(chk_sys_arch): Use it.
(guix_get_bin_list, guix_get_bin, sys_create_store): Likewise.
2022-10-07 08:20:33 -04:00
Maxim Cournoyer
6a2e303d3a
guix-install.sh: Improve prompt_yes_no procedure.
* etc/guix-install.sh (_flush): New function.
(prompt_yes_no): Clear input, then only read the first character, silently.
Add the [Yes/no] string to the message.  When a newline is entered by the
user, treat it as the default value, which is "yes".
(chk_gpg_keyring): Remove "(yes/no)" from the prompt message.
(configure_substitute_discovery): Likewise.
(sys_authorize_build_farms): Likewise.
2022-10-07 01:23:05 -04:00
Philip McGrath
3348e485b7
etc/guix-install.sh: Check for profile from 'guix home'.
If "$HOME/.guix-home/profile" exists, use it for GUIX_PROFILE instead of
"$HOME/.guix-profile".

* etc/guix-install.sh (sys_create_init_profile): Check for 'guix home'
profile.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-07-04 23:38:38 +02:00
Philip McGrath
23aafc800c
etc/guix-install.sh: Initialize XDG base directories.
The default values from the XDG base directory specification make little
sense for Guix System, and some scripts in Guix assume that they are not
"empty or unset": for example, see <https://issues.guix.gnu.org/56050>.
On foreign distros, however, omitting the default values is likely to
break software from the distro, perhaps even preventing the desktop
environment from starting. To smooth over the difference, use the
system-wide configuration to ensure the environment variables are always
explicitly set on foreign distros.

* etc/guix-install.sh (sys_create_init_profile): Explicitly initialize
XDG base directory variables.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-07-04 23:38:37 +02:00
Tobias Geerinckx-Rice
071f4e3db3
guix-install.sh: Undo some bugs introduced by shellcheck.
* etc/guix-install.sh: Unquote all file names containing ~root.
2021-11-07 20:09:59 +01:00
Tobias Geerinckx-Rice
e4ed0b3969
guix-install.sh: Don't swallow wget errors.
Using ‘-q’ suppresses *all* stderr output, including errors.

* etc/guix-install.sh (chk_gpg_keyring, guix_get_bin_list, guix_get_bin):
Substitute ‘--no-verbose’ for ‘-q’.

Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>
2021-09-29 16:56:40 +02:00
Maxim Cournoyer
073904c553
guix-install.sh: Untabify.
* etc/guix-install.sh (sys_create_build_user): Normalize to spaces.
2021-07-14 08:50:22 -04:00
Maxim Cournoyer
4cbe0127a6
guix-install.sh: Prompt for configuring substitutes discovery.
Also ensure prompt_yes_no always print the message with a trailing space,
which is more pleasing to the eye.

* etc/guix-daemon.conf.in <--discover=no>: New guix-daemon option.
* etc/guix-daemon.service.in: Likewise.
* etc/init.d/guix-daemon.in: Likewise.
* etc/openrc/guix-daemon.in: Likewise.
* etc/guix-install.sh (configure_substitute_discovery): New procedure.
(sys_enable_guix_daemon): Ask the user whether automatic substitute discovery
should be enabled.  Set the '--discover' argument accordingly.
(prompt_yes_no): Add a trailing space to the message.
(sys_authorize_build_farms): Remove trailing space from the message argument.
* NEWS (Distribution): Add news.
2021-07-07 23:54:20 -04:00
Hartmut Goebel
7f06567b83
guix-install.sh: No longer export GUIX_PROFILE.
If GUIX_PROFILE is exported here, any subsequent
"source /some/other/profile/etc/profile" will set variables pointing to
"$HOME/.guix-profile" instead of pointing to the sourced profile.

* etc/guix-install.sh (sys_create_init_profile): No longer export GUIX_PROFILE.
2021-07-07 21:25:16 +02:00
Maxim Cournoyer
74009c4cf0
guix-install.sh: Exit early if Guix is already installed.
* etc/guix-install.sh (sys_create_store): Move the check & exit before The
Guix binary archive is unpacked.  Re-indent tar extraction command.
2021-05-05 11:01:07 -04:00
Maxim Cournoyer
5b0ce3393b
guix-install.sh: Propose automatically fetching OpenPGP keys.
Via, for example, yes | ./guix-install.sh.

* etc/guix-install.sh (prompt_yes_no): New procedure.
(chk_gpg_keyring, sys_authorize_build_farms): Use it.
2021-05-05 11:01:07 -04:00
Maxim Cournoyer
e61fe664a4
guix-install.sh: Please the shellcheck linter.
* etc/guix-install.sh <FUNCNAME>: Explicitly refer to the first item of the
FUNCNAME array.
(ROOT_HOME): Replace variable by ~root directly; manually expanding it via
echo was not necessary.
(chk_gpg_keyring): Use an if branch for the exit to avoid a warning about
expression precedence.
(chk_term) <ansi_term>: Remove unused variable.
(guix_get_bin) <wget, gpg>: Test the commands directly.  Use an array for the
wget arguments, which can then be properly expanded.
(sys_create_store): Disable SC1090 for the source command, as we don't care
about following the sourced script.
<_msg>: Reuse the GUIX_PROFILE variable in the message.
(sys_create_build_user) <getent>: Test the command directly.
2021-05-05 11:01:06 -04:00
Maxim Cournoyer
185709221d
guix-install.sh: Add support for more than one signing key.
The forthcoming 1.3.0 release will be signed with my personal GnuPG key; the
installation script need to tell users how fetch it.

* etc/guix-install.sh (OPENPGP_SIGNING_KEY_ID): Remove variable.
(GPG_SIGNING_KEYS): New associative array.
(chk_gpg_keyring): Process all the keys contained in the above array.
(main) <GUIX_BINARY_FILE_NAME>: Double quote variable.
2021-05-01 01:03:18 -04:00
Maxim Cournoyer
8214e70fa8
guix-install.sh: Ensure GUIX_BINARY_FILE_NAME is an absolute path.
This is necessary as the directory context is changed in the script, breaking
the use of a relative path.

* etc/guix-install.sh (main) <GUIX_BINARY_FILE_NAME>: Resolve its absolute
path via the 'realpath' command.
2021-04-29 14:09:22 -04:00
Maxim Cournoyer
51f95d4e64
guix-install.sh: Allow overriding the Guix binary source.
This is useful for example for testing release candidates not yet uploaded to
the FTP, or for testing manually downloaded images from the CI.

* etc/guix-install.sh (main)[GUIX_BINARY_FILE_NAME]: When this variable is
defined, use it as the file name of a Guix binary, instead of automatically
retrieving the latest archive from the FTP.
2021-04-24 10:32:40 -04:00
Leo Famulari
8e214c53a4
guix-install.sh: Add the build users to the 'kvm' group.
Fixes <https://bugs.gnu.org/42129>.

* etc/guix-install.sh (sys_create_build_user): If a 'kvm' group exists,
add it to the guixbuilders' lists of supplementary groups.
2021-04-14 15:32:51 -04:00
Chris Marusich
a16eb6c5f9
Add powerpc64le-linux as a supported Guix architecture.
This makes powerpc64le-linux a supported architecture for Guix, but not for
Guix System.

* Makefile.am (SUPPORTED_SYSTEMS): Add an entry for powerpc64le-linux.
* etc/guix-install.sh (chk_sys_arch): Same.
* guix/packages.scm (%supported-systems): Same.
* m4/guix.m4 (GUIX_ASSERT_SUPPORTED_SYSTEM): Same.
* tests/guix-build.sh (all_systems): Same.
2021-03-23 23:19:57 -07:00
Jakub Kądziołka
9d34b04f40
/etc/profile.d/guix.sh: Add guix pull profile even when absent
* etc/guix-install.sh (sys_create_init_profile): Set PATH and INFOPATH
even when $_GUIX_PROFILE does not exist.

After initial installation on a foreign distro, the guix pull profile
won't be present in path. This means that the first guix pull won't take
effect until the shell is restarted.

~/.guix-profile cannot be pre-loaded like this as the relevant paths are
stored in ~/.guix-profile/etc/profile, which simply won't exist.
However, guix package will output a relevant hint that instructs the
user to reload the profile, so this isn't a problem.
2021-01-03 17:01:26 +01:00