diff --git a/scripts/backup b/scripts/backup index cd05903..6598df5 100755 --- a/scripts/backup +++ b/scripts/backup @@ -37,7 +37,9 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/sysctl.d/90-max_map_count-opensearch.conf" +if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options. + ynh_backup --src_path="/etc/sysctl.d/90-max_map_count-opensearch.conf" +fi #================================================= # BACKUP SYSTEMD diff --git a/scripts/install b/scripts/install index 0b23b62..77f4389 100755 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ ynh_app_setting_set --app="$app" --key="xmx" --value="$xmx" ynh_script_progression --message="Setting up source files..." --weight=15 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:$app" "$install_dir" @@ -47,11 +47,11 @@ chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm. #================================================= ynh_script_progression --message="Increasing maximum map count (sysctl)..." -# Increase the maximum number of files inotify can monitor. -ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/" +if [ "${container:-}" != "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options. + # Increase the maximum number of files inotify can monitor. + ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/" -# Then, reload the kernel configuration. -if ! [ "${container:-}" = "lxc" ]; then # lxc doesn't allow sysctl to play with kernel options. + # Then, reload the kernel configuration. sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf fi diff --git a/scripts/restore b/scripts/restore index daddc7f..8060058 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,8 +33,8 @@ chown -R "$app:www-data" "$data_dir" #================================================= ynh_script_progression --message="Restoring various files..." -ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-opensearch.conf" -if ! [ "${container:-}" = "lxc" ]; 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. + ynh_restore_file --origin_path="/etc/sysctl.d/90-max_map_count-opensearch.conf" sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf fi diff --git a/scripts/upgrade b/scripts/upgrade index 0e5228c..d15bcdc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,10 +46,11 @@ chown "$app:$app" "$install_dir/config/opensearch.yml" "$install_dir/config/jvm. #================================================= ynh_script_progression --message="Increasing maximum map count (sysctl)..." -# Increase the maximum number of files inotify can monitor. -ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/" -# Then, reload the kernel configuration. -if ! [ "${container:-}" = "lxc" ]; 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. + # Increase the maximum number of files inotify can monitor. + ynh_add_config --template="90-max_map_count-opensearch.conf" --destination="/etc/sysctl.d/" + + # Then, reload the kernel configuration. sysctl -p /etc/sysctl.d/90-max_map_count-opensearch.conf fi