installer: allow opting in / out to the daemon installer
By passing --daemon or --no-daemon, the installer can be forced to select one or the other installation options, despite what the automatic detection can provide. This commit can be backported to 2.0-maintenance because it explicitly turns off the daemon installation for Linux under systemd.
This commit is contained in:
parent
a99027d587
commit
17b158af85
1 changed files with 31 additions and 6 deletions
|
@ -28,14 +28,39 @@ if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
echo "$0: macOS $(sw_vers -productVersion) is not supported, upgrade to 10.10 or higher"
|
echo "$0: macOS $(sw_vers -productVersion) is not supported, upgrade to 10.10 or higher"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '\e[1;31mSwitching to the Daemon-based Installer\e[0m\n'
|
|
||||||
exec "$self/install-multi-user"
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Linux & Systemd support
|
# Determine if we should punt to the single-user installer or not
|
||||||
if [ "$(uname -s)" = "Linux" ] && [ -e /run/systemd/system ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
|
INSTALL_MODE=daemon
|
||||||
|
elif [ "$(uname -s)" = "Linux" ] && [ -e /run/systemd/system ]; then
|
||||||
|
INSTALL_MODE=no-daemon
|
||||||
|
else
|
||||||
|
INSTALL_MODE=no-daemon
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Trivially handle the --daemon / --no-daemon options
|
||||||
|
if [ "x${1:-}" = "x--no-daemon" ]; then
|
||||||
|
INSTALL_MODE=no-daemon
|
||||||
|
elif [ "x${1:-}" = "x--daemon" ]; then
|
||||||
|
INSTALL_MODE=daemon
|
||||||
|
elif [ "x${1:-}" != "x" ]; then
|
||||||
|
(
|
||||||
|
echo "Nix Installer [--daemon|--no-daemon]"
|
||||||
|
echo ""
|
||||||
|
echo " --daemon: Force the installer to use the Daemon"
|
||||||
|
echo " based installer, even though it may not"
|
||||||
|
echo " work."
|
||||||
|
echo ""
|
||||||
|
echo " --no-daemon: Force a no-daemon, single-user"
|
||||||
|
echo " installation even when the preferred"
|
||||||
|
echo " method is with the daemon."
|
||||||
|
echo ""
|
||||||
|
) >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$INSTALL_MODE" = "daemon" ]; then
|
||||||
printf '\e[1;31mSwitching to the Daemon-based Installer\e[0m\n'
|
printf '\e[1;31mSwitching to the Daemon-based Installer\e[0m\n'
|
||||||
exec "$self/install-multi-user"
|
exec "$self/install-multi-user"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue