From 80d9c93de9bb8dcf06fb081cbd35213e0f995833 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Sat, 25 Apr 2020 03:25:32 +0100 Subject: [PATCH] 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 --- scripts/build/chroot_selinuxfs | 32 ++++++++++++++++++-------------- 1 file 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)