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
d79c96232b whereby a warning subsequently
was always emitted in remove mode when selinux was not in use, which was
not ideal.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-04-25 03:25:32 +01:00 committed by Raphaël Hertzog
parent 931f42fa39
commit 80d9c93de9
1 changed files with 18 additions and 14 deletions

View File

@ -24,27 +24,31 @@ Init_config_data "${@}"
# Requiring stage file # Requiring stage file
Require_stagefiles config bootstrap 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 case "${1}" in
install) install)
if [ -e /sys/fs/selinux/enforce ] && [ "$(cat /sys/fs/selinux/enforce)" = "1" ] Echo_message "Begin mounting /sys/fs/selinux..."
then
Echo_message "Begin mounting /sys/fs/selinux..."
# Checking stage file # Checking stage file
Check_stagefile Check_stagefile
# Acquire lock file # Acquire lock file
Acquire_lockfile Acquire_lockfile
# Create mountpoint # Create mountpoint
mkdir -p chroot/sys/fs/selinux mkdir -p chroot/sys/fs/selinux
# Mounting /sys/fs/selinux # Mounting /sys/fs/selinux
mount -t selinuxfs -o x-gvfs-hide selinuxfs-live chroot/sys/fs/selinux mount -t selinuxfs -o x-gvfs-hide selinuxfs-live chroot/sys/fs/selinux
# Creating stage file # Creating stage file
Create_stagefile Create_stagefile
fi
;; ;;
remove) remove)