summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-04-25 03:25:32 +0100
committerRaphaƫl Hertzog <hertzog@debian.org>2020-04-29 13:17:50 +0000
commit80d9c93de9bb8dcf06fb081cbd35213e0f995833 (patch)
treedaf5db69aff6bdc934f0d84192592452abee306d /scripts
parent931f42fa39bd8efa364bc31af33e350de7a0b8f7 (diff)
downloadvyos-live-build-80d9c93de9bb8dcf06fb081cbd35213e0f995833.tar.gz
vyos-live-build-80d9c93de9bb8dcf06fb081cbd35213e0f995833.zip
selinux: fix output consistency
install mode was silent when selinux was not enabled, whilst remove mode always output a "Begin unmounting..." message. this makes both modes silent when selinux is not enabled. this also happens to fix an unintended side effect of d79c96232b40fb082233c97ac8d4f75b821ecefe whereby a warning subsequently was always emitted in remove mode when selinux was not in use, which was not ideal. Gbp-Dch: Short
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/chroot_selinuxfs32
1 files changed, 18 insertions, 14 deletions
diff --git a/scripts/build/chroot_selinuxfs b/scripts/build/chroot_selinuxfs
index 8c9944931..ac6b8b695 100755
--- a/scripts/build/chroot_selinuxfs
+++ b/scripts/build/chroot_selinuxfs
@@ -24,27 +24,31 @@ Init_config_data "${@}"
# Requiring stage file
Require_stagefiles config bootstrap
+# Skip if selinux is not enabled
+if [ ! -e /sys/fs/selinux/enforce ] || [ "$(cat /sys/fs/selinux/enforce)" != "1" ]
+then
+ Echo_debug "Skipping due to selinux being disabled..."
+ exit 0
+fi
+
case "${1}" in
install)
- if [ -e /sys/fs/selinux/enforce ] && [ "$(cat /sys/fs/selinux/enforce)" = "1" ]
- then
- Echo_message "Begin mounting /sys/fs/selinux..."
+ Echo_message "Begin mounting /sys/fs/selinux..."
- # Checking stage file
- Check_stagefile
+ # Checking stage file
+ Check_stagefile
- # Acquire lock file
- Acquire_lockfile
+ # Acquire lock file
+ Acquire_lockfile
- # Create mountpoint
- mkdir -p chroot/sys/fs/selinux
+ # Create mountpoint
+ mkdir -p chroot/sys/fs/selinux
- # Mounting /sys/fs/selinux
- mount -t selinuxfs -o x-gvfs-hide selinuxfs-live chroot/sys/fs/selinux
+ # Mounting /sys/fs/selinux
+ mount -t selinuxfs -o x-gvfs-hide selinuxfs-live chroot/sys/fs/selinux
- # Creating stage file
- Create_stagefile
- fi
+ # Creating stage file
+ Create_stagefile
;;
remove)