Fix upgrade from old version

This commit is contained in:
Josué Tille 2024-06-01 11:19:38 +02:00
parent 41369ebe6d
commit c108375dba
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5
4 changed files with 6 additions and 8 deletions

View file

@ -37,7 +37,7 @@ run_seafile_cmd() {
} }
install_source() { 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} 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/passwd | sed "s|$install_dir|/opt/seafile|" >> "$install_dir"/seafile_image/etc/passwd
grep "^$app:x" /etc/group >> "$install_dir"/seafile_image/etc/group grep "^$app:x" /etc/group >> "$install_dir"/seafile_image/etc/group

View file

@ -7,10 +7,10 @@
# Import common cmd # Import common cmd
source ./experimental_helper.sh source ./experimental_helper.sh
source ./_common.sh source ./_common.sh
source ./ynh_setup_source
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source ./ynh_setup_source
seafile_version=$(ynh_app_upstream_version) seafile_version=$(ynh_app_upstream_version)
seafile_code="$install_dir/seafile_image/opt/seafile/seafile-server-$seafile_version" seafile_code="$install_dir/seafile_image/opt/seafile/seafile-server-$seafile_version"

View file

@ -7,10 +7,10 @@
# Import common cmd # Import common cmd
source ./experimental_helper.sh source ./experimental_helper.sh
source ./_common.sh source ./_common.sh
source ./ynh_setup_source
# Source YunoHost helpers # Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source ./ynh_setup_source
seafile_version="$(ynh_app_upstream_version)" seafile_version="$(ynh_app_upstream_version)"
installed_version="${YNH_APP_CURRENT_VERSION/~ynh*/}" installed_version="${YNH_APP_CURRENT_VERSION/~ynh*/}"
@ -125,9 +125,7 @@ case "$installed_version" in
;& ;&
"7.0"* ) "7.0"* )
# Fix file comment # Fix file comment
pushd "$seafile_code" 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
run_seafile_cmd "/opt/seafile/seafile-server-$seafile_version/seahub.sh" python-env python3 seahub/manage.py migrate_file_comment
popd
# Update seafile by script # 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" 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."* ) "10."* )
ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file="$seafile_code/upgrade/upgrade_9.0_10.0.sh" 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" 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 esac

View file

@ -9,7 +9,7 @@
# #
# WARNING Note it's a patched version of the official helper with a fix for docker specific to arm64 # 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. # Declare an array to define the options of this helper.
local legacy_args=dsk local legacy_args=dsk
local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace=) local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace=)