From b94a18c170809671cad7b7f0c98aaed350eb8994 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 2 May 2020 01:44:36 +0200 Subject: [PATCH] Upgrade to 12.0.x before upgrading to a newer version --- scripts/upgrade | 5 ++--- scripts/upgrade.d/upgrade.11.sh | 3 ++- scripts/upgrade.d/upgrade.12.sh | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.12.sh diff --git a/scripts/upgrade b/scripts/upgrade index 968c480..8d8bc37 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -254,9 +254,8 @@ then current_major_version=$(($current_major_version + 1)) fi - # If the current version has the same major version than the next one, - # then it's the last upgrade to do - if [ "$last_major_version" -eq "$current_major_version" ]; then + # Finish with the last migration if the file doesn't exist + if [ ! -e "./upgrade.d/upgrade.$current_major_version.sh" ]; then current_major_version=last fi diff --git a/scripts/upgrade.d/upgrade.11.sh b/scripts/upgrade.d/upgrade.11.sh index 237b9df..b25d5f4 100644 --- a/scripts/upgrade.d/upgrade.11.sh +++ b/scripts/upgrade.d/upgrade.11.sh @@ -11,6 +11,7 @@ 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" + local sysctl_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" + ynh_replace_string --match_string="command \"sysctl -e \(.*\)\"" --replace_string="command \"sysctl -e \1 || true\"" --target_file=$sysctl_file } diff --git a/scripts/upgrade.d/upgrade.12.sh b/scripts/upgrade.d/upgrade.12.sh new file mode 100644 index 0000000..f814a09 --- /dev/null +++ b/scripts/upgrade.d/upgrade.12.sh @@ -0,0 +1,18 @@ +# It's required to upgrade to the latest 12.0.x version before to another 12.X verion. +gitlab_version="12.0.12" + +# There is no buster version for gitlab 12.0.X +gitlab_x86_64_debian_version="stretch" + +gitlab_x86_64_source_sha256="e80cda4c328c2627278a3d74dbdd53420e1fec9ecbeaeb5d4dcb4773726e5904" + +gitlab_arm_source_sha256="a0862e3c31b61d9274a55b7307d15daa5258473ccb97b8ae0d807f7474c971df" + +gitlab_filename="gitlab-ce-${gitlab_version}.deb" + +# Action to do in case of failure of the package_check +package_check_action() { + local sysctl_file="$final_path/embedded/cookbooks/package/resources/sysctl.rb" + ynh_replace_string --match_string="command \"sysctl -e \(.*\)\"" --replace_string="command \"sysctl -e \1 || true\"" --target_file=$sysctl_file +} +