diff --git a/scripts/install b/scripts/install index add0f20..42f2583 100755 --- a/scripts/install +++ b/scripts/install @@ -49,7 +49,7 @@ ynh_script_progression --message="Increasing maximum map count (sysctl)..." # Increase the maximum number of files inotify can monitor. cp -a ../conf/90-max_map_count-elasticsearch.conf /etc/sysctl.d/ # Then, reload the kernel configuration. -if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options. +if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options. then sysctl -p /etc/sysctl.d/90-max_map_count-elasticsearch.conf fi diff --git a/scripts/remove b/scripts/remove index c028c2d..13375c9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -31,7 +31,7 @@ ynh_remove_logrotate if [ -e "/etc/sysctl.d/90-max_map_count-elasticsearch.conf" ]; then ynh_secure_remove --file="/etc/sysctl.d/90-max_map_count-elasticsearch.conf" # Reload the kernel configuration. - if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options. + if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options. then sysctl --system fi diff --git a/scripts/restore b/scripts/restore index f262a1e..b7e86c9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -37,7 +37,7 @@ chown -R $app:www-data "$data_dir" ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-elasticsearch.conf" -if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options. +if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options. then sysctl -p /etc/sysctl.d/90-max_map_count-elasticsearch.conf fi diff --git a/scripts/upgrade b/scripts/upgrade index ccc78e5..96f211d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,7 +65,7 @@ ynh_script_progression --message="Increasing maximum map count (sysctl)..." # Increase the maximum number of files inotify can monitor. cp -a ../conf/90-max_map_count-elasticsearch.conf /etc/sysctl.d/ # Then, reload the kernel configuration. -if ! [ "${container:-}" = "lxc" ] # lxc doesn't allow sysctl to play with kernel options. +if ! [ "$(systemd-detect-virt)" == "lxc" ] # lxc doesn't allow sysctl to play with kernel options. then sysctl -p /etc/sysctl.d/90-max_map_count-elasticsearch.conf fi