From c108375dba65e05203f7c9760b01a0711717da3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 1 Jun 2024 11:19:38 +0200 Subject: [PATCH] Fix upgrade from old version --- scripts/_common.sh | 2 +- scripts/install | 2 +- scripts/upgrade | 8 +++----- scripts/ynh_setup_source | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b8fb732..33da0a8 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -37,7 +37,7 @@ run_seafile_cmd() { } install_source() { - ynh_setup_source --dest_dir="$install_dir"/seafile_image --full_replace + ynh_setup_source_custom --dest_dir="$install_dir"/seafile_image --full_replace mkdir -p "$install_dir"/seafile_image/opt/seafile/{seafile-data,seahub-data,conf,logs} grep "^$app:x" /etc/passwd | sed "s|$install_dir|/opt/seafile|" >> "$install_dir"/seafile_image/etc/passwd grep "^$app:x" /etc/group >> "$install_dir"/seafile_image/etc/group diff --git a/scripts/install b/scripts/install index b91fae0..020c400 100644 --- a/scripts/install +++ b/scripts/install @@ -7,10 +7,10 @@ # Import common cmd source ./experimental_helper.sh source ./_common.sh +source ./ynh_setup_source # Source YunoHost helpers source /usr/share/yunohost/helpers -source ./ynh_setup_source seafile_version=$(ynh_app_upstream_version) seafile_code="$install_dir/seafile_image/opt/seafile/seafile-server-$seafile_version" diff --git a/scripts/upgrade b/scripts/upgrade index 297c8d3..651bc0c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,10 +7,10 @@ # Import common cmd source ./experimental_helper.sh source ./_common.sh +source ./ynh_setup_source # Source YunoHost helpers source /usr/share/yunohost/helpers -source ./ynh_setup_source seafile_version="$(ynh_app_upstream_version)" installed_version="${YNH_APP_CURRENT_VERSION/~ynh*/}" @@ -125,9 +125,7 @@ case "$installed_version" in ;& "7.0"* ) # Fix file comment - pushd "$seafile_code" - run_seafile_cmd "/opt/seafile/seafile-server-$seafile_version/seahub.sh" python-env python3 seahub/manage.py migrate_file_comment - popd + run_seafile_cmd "/opt/seafile/seafile-server-$seafile_version/seahub.sh" python-env python3 "/opt/seafile/seafile-server-$seafile_version/seahub/manage.py" migrate_file_comment # Update seafile by script ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file="$seafile_code/upgrade/upgrade_7.0_7.1.sh" @@ -155,7 +153,7 @@ case "$installed_version" in "10."* ) ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file="$seafile_code/upgrade/upgrade_9.0_10.0.sh" run_seafile_cmd "/opt/seafile/seafile-server-$seafile_version/upgrade/upgrade_9.0_10.0.sh" - sudo -u "$app" "$install_dir"/venv/bin/python "$seafile_code/migrate_ldapusers.py" + run_seafile_cmd "/opt/seafile/seafile-server-$seafile_version/seahub.sh" python-env python3 "/opt/seafile/seafile-server-$seafile_version/migrate_ldapusers.py" ;& esac diff --git a/scripts/ynh_setup_source b/scripts/ynh_setup_source index 66a35c8..4469980 100644 --- a/scripts/ynh_setup_source +++ b/scripts/ynh_setup_source @@ -9,7 +9,7 @@ # # WARNING Note it's a patched version of the official helper with a fix for docker specific to arm64 # -ynh_setup_source() { +ynh_setup_source_custom() { # Declare an array to define the options of this helper. local legacy_args=dsk local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace=)