From 7931d8872592427b98d1c81c9932a96b61e74f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Thu, 4 Jul 2019 20:30:29 +0200 Subject: [PATCH] Actions are different between 11.x and 12.x --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- scripts/upgrade.d/upgrade.11.sh | 6 ++++++ scripts/upgrade.d/upgrade.last.sh | 5 +++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 29bd8f5..99402e0 100644 --- a/scripts/install +++ b/scripts/install @@ -184,7 +184,7 @@ ynh_setup_source --dest_dir=$tempdir --source_id=$architecture if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env - ynh_replace_string --match_string="command \"sysctl -e --system\"" --replace_string="command \"sysctl -e --system || true\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" + package_check_action # defined in upgrade.d/upgrade.last.sh ynh_exec_warn_less dpkg --configure gitlab-ce fi else diff --git a/scripts/restore b/scripts/restore index 882a989..1aed979 100644 --- a/scripts/restore +++ b/scripts/restore @@ -118,7 +118,7 @@ ynh_setup_source --dest_dir=$tempdir --source_id=$architecture if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env - ynh_replace_string --match_string="command \"sysctl -e --system\"" --replace_string="command \"sysctl -e --system || true\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" + package_check_action # defined in upgrade.d/upgrade.last.sh ynh_exec_warn_less dpkg --configure gitlab-ce fi else diff --git a/scripts/upgrade b/scripts/upgrade index 58a14d9..0078176 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -273,7 +273,7 @@ then if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env - ynh_replace_string --match_string="command \"sysctl -e --system\"" --replace_string="command \"sysctl -e --system || true\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" + package_check_action # defined in upgrade.d/upgrade.X.sh ynh_exec_warn_less dpkg --configure gitlab-ce fi else diff --git a/scripts/upgrade.d/upgrade.11.sh b/scripts/upgrade.d/upgrade.11.sh index f7981c3..64724d0 100644 --- a/scripts/upgrade.d/upgrade.11.sh +++ b/scripts/upgrade.d/upgrade.11.sh @@ -5,3 +5,9 @@ gitlab_x86_64_source_sha256="1ee3d6e8d2cc198f5466de0884c03f6016299db24859126af9a gitlab_arm_source_sha256="366e12b1f3d3b1694fcb6f13da9de908360ba93f75768d97e8d01e61e8652705" gitlab_filename="gitlab-ce-${gitlab_version}.deb" + +# Action to do in case of failure of the package_check +package_check_action() { + ynh_replace_string --match_string="command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"" --replace_string="command \"cat \/etc\/sysctl.conf\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" +} + diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index d491958..0c17ba1 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -5,3 +5,8 @@ gitlab_x86_64_source_sha256="9e2dcb0e4e3ca3c230d43c6b8580d77c2c716f3c6d1055739f1 gitlab_arm_source_sha256="992710fd2c4076961f03633cb6b56331f7ade63a6869c47c2ce28995f8b43893" gitlab_filename="gitlab-ce-${gitlab_version}.deb" + +# Action to do in case of failure of the package_check +package_check_action() { + ynh_replace_string --match_string="command \"sysctl -e --system\"" --replace_string="command \"sysctl -e --system || true\"" --target_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" +}