From 4b8e9056c2c29899683c330edb1933296124f905 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Thu, 10 Feb 2022 16:52:24 +0100 Subject: [PATCH 1/2] Prevent sysctl use in any lxc container --- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 8c01510..5ea812e 100644 --- a/scripts/install +++ b/scripts/install @@ -44,7 +44,7 @@ ynh_script_progression --message="Increasing inotify's limits..." --weight=1 # Increase the maximum number of files inotify can monitor. cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ # Then, reload the kernel configuration. -if ! IS_PACKAGE_CHECK; then # LXC doesn't allow sysctl to play with kernel options. +if ! [ "$container" = "lxc" ]; then # LXC doesn't allow sysctl to play with kernel options. sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf fi diff --git a/scripts/remove b/scripts/remove index b918c7a..f155214 100755 --- a/scripts/remove +++ b/scripts/remove @@ -37,7 +37,7 @@ ynh_script_progression --message="Removing various files..." --weight=1 if [ -e "/etc/sysctl.d/90-inotify_minidlna.conf" ]; then ynh_secure_remove --file="/etc/sysctl.d/90-inotify_minidlna.conf" # Reload the kernel configuration. - if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options. + if ! [ "$container" = "lxc" ] # LXC doesn't allow sysctl to play with kernel options. then sysctl --system fi diff --git a/scripts/restore b/scripts/restore index c8370de..f3827af 100644 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,7 @@ ynh_multimedia_build_main_dir ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file --origin_path="/etc/sysctl.d/90-inotify_minidlna.conf" -if ! IS_PACKAGE_CHECK; then # LXC doesn't allow sysctl to play with kernel options. +if ! [ "$container" = "lxc" ]; then # LXC doesn't allow sysctl to play with kernel options. sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf fi # Delete the current config of minidlna, in order to replace it by the version from the backup diff --git a/scripts/upgrade b/scripts/upgrade index ea5b6e4..cb10732 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,7 +61,7 @@ ynh_script_progression --message="Increasing inotify's limits..." --weight=2 # Increase the maximum number of files inotify can monitor. cp -a ../conf/90-inotify_minidlna.conf /etc/sysctl.d/ # Then, reload the kernel configuration. -if ! IS_PACKAGE_CHECK # LXC doesn't allow sysctl to play with kernel options. +if ! [ "$container" = "lxc" ]; # lxc doesn't allow sysctl to play with kernel options. then sysctl -p /etc/sysctl.d/90-inotify_minidlna.conf fi From 1602d1008f3658376050e4624de5c7715c22e1d2 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Wed, 14 Feb 2024 09:00:28 +0100 Subject: [PATCH 2/2] Remove package check bypassing from _common.sh --- scripts/_common.sh | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e97e4ad..90d23da 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,23 +4,10 @@ # COMMON VARIABLES #================================================= -#================================================= -# PACKAGE CHECK BYPASSING... -#================================================= - -IS_PACKAGE_CHECK() { - if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 1 ]; then - return 0 - else - return 1 - fi -} - #================================================= # FUTUR OFFICIAL HELPERS #================================================= - #================================================= # EXPERIMENTAL HELPERS #=================================================