From 951a1bbf9c299d6eac588a4f6e8d3c9b792575e4 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 12 May 2019 18:59:07 +0200 Subject: [PATCH 1/5] Fix fallocate can't be used --- scripts/_common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f8ec859..1caa856 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -76,8 +76,11 @@ ynh_add_swap () { # If there's enough space for a swap, and no existing swap here if [ $swap_size -ne 0 ] && [ ! -e /swap_$app ] then - # Preallocate space for the swap file - fallocate -l ${swap_size}K /swap_$app + # Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case + if ! fallocate -l ${swap_size}K /swap_$app + then + dd if=/dev/zero of=/swap_$app bs=1024 count=${swap_size} + fi chmod 0600 /swap_$app # Create the swap mkswap /swap_$app From 8474ebbc5ffcea3be401c86fc47414ae5fd3f646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sun, 12 May 2019 19:35:29 +0200 Subject: [PATCH 2/5] use more ynh_systemd_action --- scripts/change_url | 2 +- scripts/remove | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 690d226..ee8e540 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -120,7 +120,7 @@ ynh_store_file_checksum --file="$config_path/gitlab.rb" gitlab-ctl reconfigure if [ $change_path -eq 1 ]; then - gitlab-ctl restart + ynh_systemd_action --action=restart --service_name="gitlab-runsvdir" gitlab-ctl restart unicorn fi diff --git a/scripts/remove b/scripts/remove index 73044ac..b43da57 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,7 +39,7 @@ fi #================================================= ynh_script_progression --message="Stopping gitlab" --weight=8 -gitlab-ctl stop +ynh_systemd_action --action=stop --service_name="gitlab-runsvdir" #================================================= # REMOVE GITLAB From cd0f3902ff5be2e6a89f0ebe0d49d399489d9d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sun, 12 May 2019 19:36:00 +0200 Subject: [PATCH 3/5] no more update_src_version --- scripts/install | 7 ++----- scripts/restore | 27 ++++++++++++--------------- scripts/upgrade | 15 ++++++--------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/scripts/install b/scripts/install index ba52a59..add99ff 100644 --- a/scripts/install +++ b/scripts/install @@ -166,7 +166,6 @@ ynh_store_file_checksum --file="$config_path/gitlab.rb" #================================================= ynh_script_progression --message="Setting up source files..." --weight=200 -update_src_version() { source ./upgrade.d/upgrade.last.sh cp ../conf/$architecture.src.default ../conf/$architecture.src ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" @@ -177,16 +176,14 @@ update_src_version() { elif [ $architecture = "arm" ]; then ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" fi -} - -update_src_version tempdir="$(mktemp -d)" ynh_setup_source --dest_dir=$tempdir --source_id=$architecture if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then - if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env + if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; + then # This command will fail in lxc env 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" ynh_exec_warn_less dpkg --configure gitlab-ce fi diff --git a/scripts/restore b/scripts/restore index f370e86..beb4807 100644 --- a/scripts/restore +++ b/scripts/restore @@ -97,28 +97,25 @@ ynh_restore_file --origin_path="$config_path/gitlab-persistent.rb" #================================================= ynh_script_progression --message="Reinstalling gitlab..." --weight=200 -update_src_version() { - source ../settings/scripts/upgrade.d/upgrade.last.sh - mkdir -p ../conf/ - cp ../settings/conf/$architecture.src.default ../conf/$architecture.src - ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" - ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" +source ../settings/scripts/upgrade.d/upgrade.last.sh +mkdir -p ../conf/ +cp ../settings/conf/$architecture.src.default ../conf/$architecture.src +ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" +ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" - if [ $architecture = "x86-64" ]; then - ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src" - elif [ $architecture = "arm" ]; then - ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" - fi -} - -update_src_version +if [ $architecture = "x86-64" ]; then + ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src" +elif [ $architecture = "arm" ]; then + ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" +fi tempdir="$(mktemp -d)" ynh_setup_source --dest_dir=$tempdir --source_id=$architecture if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then - if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env + if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; + then # This command will fail in lxc env 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" ynh_exec_warn_less dpkg --configure gitlab-ce fi diff --git a/scripts/upgrade b/scripts/upgrade index 5312cdf..69ab4a8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -231,7 +231,10 @@ chown admin: "$config_path/gitlab-persistent.rb" # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -update_src_version() { +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Setting up source files..." --weight=200 + source ./upgrade.d/upgrade.last.sh cp ../conf/$architecture.src.default ../conf/$architecture.src ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" @@ -242,20 +245,14 @@ update_src_version() { elif [ $architecture = "arm" ]; then ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" fi -} - -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Setting up source files..." --weight=200 - - update_src_version tempdir="$(mktemp -d)" ynh_setup_source --dest_dir=$tempdir --source_id=$architecture if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; then - if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; then # This command will fail in lxc env + if ! ynh_exec_warn_less dpkg -i $tempdir/$gitlab_filename ; + then # This command will fail in lxc env 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" ynh_exec_warn_less dpkg --configure gitlab-ce fi From 920fc3972996feef53f627f95781e6b5be722806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Bourr=C3=A9?= Date: Sun, 12 May 2019 20:08:00 +0200 Subject: [PATCH 4/5] Fix PACKAGE_CHECK_EXEC --- scripts/install | 20 ++++++++++---------- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index add99ff..fd3a33f 100644 --- a/scripts/install +++ b/scripts/install @@ -166,22 +166,22 @@ ynh_store_file_checksum --file="$config_path/gitlab.rb" #================================================= ynh_script_progression --message="Setting up source files..." --weight=200 - source ./upgrade.d/upgrade.last.sh - cp ../conf/$architecture.src.default ../conf/$architecture.src - ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" - ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" +source ./upgrade.d/upgrade.last.sh +cp ../conf/$architecture.src.default ../conf/$architecture.src +ynh_replace_string --match_string="__VERSION__" --replace_string="$gitlab_version" --target_file="../conf/$architecture.src" +ynh_replace_string --match_string="__SOURCE_FILENAME__" --replace_string="$gitlab_filename" --target_file="../conf/$architecture.src" - if [ $architecture = "x86-64" ]; then - ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src" - elif [ $architecture = "arm" ]; then - ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" - fi +if [ $architecture = "x86-64" ]; then + ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_x86_64_source_sha256" --target_file="../conf/$architecture.src" +elif [ $architecture = "arm" ]; then + ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$gitlab_arm_source_sha256" --target_file="../conf/$architecture.src" +fi tempdir="$(mktemp -d)" ynh_setup_source --dest_dir=$tempdir --source_id=$architecture -if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; 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 \"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/restore b/scripts/restore index beb4807..1a33749 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ tempdir="$(mktemp -d)" ynh_setup_source --dest_dir=$tempdir --source_id=$architecture -if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; 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 \"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 b/scripts/upgrade index 69ab4a8..ccca20b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -250,7 +250,7 @@ then ynh_setup_source --dest_dir=$tempdir --source_id=$architecture - if [ ${PACKAGE_CHECK_EXEC:-0} -eq 0 ]; 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 \"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" From c2bcfaf55d310f2747b2d9b5853d9714a082f5a1 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 12 May 2019 21:43:53 +0200 Subject: [PATCH 5/5] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index ba823b2..d80804f 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Gitlab", "id": "gitlab", "packaging_format": 1, - "version": "11.10.4~ynh2", + "version": "11.10.4~ynh3", "description": { "en": "GitLab is a Git-repository manager.", "fr": "GitLab est un gestionnaire de dépôts Git."