aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2023-07-16 02:00:01 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2023-07-16 02:00:07 +0200
commitc89e0b4d2008e930af4fe428ef4a954384e150ce (patch)
tree3b900a4eea8d8cd6b72ed7decd383a1522e3c55b /etc
parent445a0359083388b5ee686e6e855f94a3aac5f79c (diff)
downloadguix-c89e0b4d2008e930af4fe428ef4a954384e150ce.tar
guix-c89e0b4d2008e930af4fe428ef4a954384e150ce.tar.gz
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.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/guix-install.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index fc14471f1a..10645ac7ac 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -600,15 +600,26 @@ fi
sys_maybe_setup_selinux()
{
- if [ -f /sys/fs/selinux/policy ]
+ if ! [ -f /sys/fs/selinux/policy ]
then
- prompt_yes_no "Install SELinux policy required to run guix-daemon?" \
- || return
-
- local var_guix=/var/guix/profiles/per-user/root/current-guix
- semodule -i "${var_guix}/share/selinux/guix-daemon.cil"
- restorecon -R /gnu /var/guix
+ return
fi
+
+ local c
+ for c in semodule restorecon
+ do
+ if ! command -v "$c" &>/dev/null
+ then
+ return
+ fi
+ done
+
+ prompt_yes_no "Install SELinux policy that might be required to run guix-daemon?" \
+ || return
+
+ local var_guix=/var/guix/profiles/per-user/root/current-guix
+ semodule -i "${var_guix}/share/selinux/guix-daemon.cil"
+ restorecon -R /gnu /var/guix
}
welcome()