From 000958e43b517c6f2d03cbad8fe99431bcfac5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:16:38 +0100 Subject: [PATCH 01/11] Update seahub_settings.py --- conf/seahub_settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/seahub_settings.py b/conf/seahub_settings.py index e924bef..1af75ae 100644 --- a/conf/seahub_settings.py +++ b/conf/seahub_settings.py @@ -23,8 +23,8 @@ COMPRESS_URL = MEDIA_URL STATIC_URL = MEDIA_URL + 'assets/' EMAIL_USE_TLS = False EMAIL_HOST = "localhost" -EMAIL_HOST_USER = "__APP__@__DOMAIN__" -EMAIL_HOST_PASSWORD = "" +EMAIL_HOST_USER = "__APP__" +EMAIL_HOST_PASSWORD = "__MAIL_PWD__" EMAIL_PORT = "25" DEFAULT_FROM_EMAIL = "__APP__@__DOMAIN__" SERVER_EMAIL = "__APP__@__DOMAIN__" From b2f93b6b2eb45284fd5619227e913514dec8d020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 22 Nov 2023 17:35:14 +0100 Subject: [PATCH 02/11] Fix email --- conf/seahub_settings.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/seahub_settings.py b/conf/seahub_settings.py index 1af75ae..ee43935 100644 --- a/conf/seahub_settings.py +++ b/conf/seahub_settings.py @@ -21,11 +21,13 @@ SERVE_STATIC = False MEDIA_URL = "__PATH2__media/" COMPRESS_URL = MEDIA_URL STATIC_URL = MEDIA_URL + 'assets/' -EMAIL_USE_TLS = False -EMAIL_HOST = "localhost" +EMAIL_USE_TLS = True +EMAIL_HOST = "__DOMAIN__" EMAIL_HOST_USER = "__APP__" EMAIL_HOST_PASSWORD = "__MAIL_PWD__" -EMAIL_PORT = "25" +EMAIL_PORT = "587" +REPLACE_FROM_EMAIL = True +ADD_REPLY_TO_HEADER = True DEFAULT_FROM_EMAIL = "__APP__@__DOMAIN__" SERVER_EMAIL = "__APP__@__DOMAIN__" LOGIN_URL = '__PATH2__accounts/login/' From 10d4cefcf7c0f50b14ac074dd8098b4b537d3e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Wed, 22 Nov 2023 17:38:24 +0100 Subject: [PATCH 03/11] Update version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 1b3f721..3af2d77 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Seafile" description.en = "Open Source Cloud Storage" description.fr = "Stockage Cloud Open Source" -version = "9.0.9~ynh1" +version = "9.0.9~ynh2" maintainers = ["Josué Tille"] From 519ea7b6d5069074a552f41f690db29234b7a758 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 22 Nov 2023 16:38:43 +0000 Subject: [PATCH 04/11] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ceb0497..917d640 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Seafile is an open Source Cloud Storage application. It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk. -**Shipped version:** 9.0.9~ynh1 +**Shipped version:** 9.0.9~ynh2 **Demo:** https://demo.seafile.com diff --git a/README_fr.md b/README_fr.md index f7d5bce..554eb20 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Seafile is an open Source Cloud Storage application. It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk. -**Version incluse :** 9.0.9~ynh1 +**Version incluse :** 9.0.9~ynh2 **Démo :** https://demo.seafile.com From 43826777faaed6e87a93618903048ed56f907557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Thu, 23 Nov 2023 17:07:30 +0100 Subject: [PATCH 05/11] don't use expect for upgrade scripts and improve upgrade stability --- scripts/_common.sh | 11 ++--------- scripts/expect_scripts/minor-upgrade.exp | 12 ------------ scripts/expect_scripts/upgrade_4.2.1.exp | 11 ----------- scripts/expect_scripts/upgrade_4.3.2.exp | 11 ----------- scripts/expect_scripts/upgrade_4.4.3.exp | 11 ----------- scripts/expect_scripts/upgrade_5.0.3.exp | 11 ----------- scripts/expect_scripts/upgrade_5.1.exp | 11 ----------- scripts/expect_scripts/upgrade_6.0.exp | 11 ----------- scripts/expect_scripts/upgrade_6.1.exp | 11 ----------- scripts/expect_scripts/upgrade_6.2.exp | 11 ----------- scripts/expect_scripts/upgrade_6.3.exp | 11 ----------- scripts/expect_scripts/upgrade_7.0.exp | 11 ----------- scripts/expect_scripts/upgrade_7.1.exp | 19 ------------------- scripts/expect_scripts/upgrade_8.0.exp | 11 ----------- scripts/expect_scripts/upgrade_9.0.exp | 11 ----------- scripts/install | 9 ++++++--- scripts/upgrade | 15 ++++++++------- 17 files changed, 16 insertions(+), 182 deletions(-) delete mode 100644 scripts/expect_scripts/minor-upgrade.exp delete mode 100644 scripts/expect_scripts/upgrade_4.2.1.exp delete mode 100644 scripts/expect_scripts/upgrade_4.3.2.exp delete mode 100644 scripts/expect_scripts/upgrade_4.4.3.exp delete mode 100644 scripts/expect_scripts/upgrade_5.0.3.exp delete mode 100644 scripts/expect_scripts/upgrade_5.1.exp delete mode 100644 scripts/expect_scripts/upgrade_6.0.exp delete mode 100644 scripts/expect_scripts/upgrade_6.1.exp delete mode 100644 scripts/expect_scripts/upgrade_6.2.exp delete mode 100644 scripts/expect_scripts/upgrade_6.3.exp delete mode 100644 scripts/expect_scripts/upgrade_7.0.exp delete mode 100644 scripts/expect_scripts/upgrade_7.1.exp delete mode 100644 scripts/expect_scripts/upgrade_8.0.exp delete mode 100644 scripts/expect_scripts/upgrade_9.0.exp diff --git a/scripts/_common.sh b/scripts/_common.sh index c557a8b..8db757b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -58,21 +58,14 @@ install_dependance() { done } -mv_expect_scripts() { - expect_scripts_dir=$(mktemp -d) - cp expect_scripts/* $expect_scripts_dir - chmod u=rwx,o= -R $expect_scripts_dir - chown $YNH_APP_ID -R $expect_scripts_dir -} - set_permission() { chown -R $YNH_APP_ID:$YNH_APP_ID $install_dir chmod -R u+rwX,g-wx,o= $install_dir setfacl -m user:www-data:rX $install_dir setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version # At install time theses directory are not available - test -e $install_dir/seafile-server-latest/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-latest/seahub - test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media + test -e $install_dir/seafile-server-$seafile_version/seahub && setfacl -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub + test -e $install_dir/seafile-server-$seafile_version/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-$seafile_version/seahub/media test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data find $data_dir \( \! -perm -o= \ diff --git a/scripts/expect_scripts/minor-upgrade.exp b/scripts/expect_scripts/minor-upgrade.exp deleted file mode 100644 index 0d3cd97..0000000 --- a/scripts/expect_scripts/minor-upgrade.exp +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] -set mysql_password [lindex $argv 1] - -spawn $seafile_dir/upgrade/minor-upgrade.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_4.2.1.exp b/scripts/expect_scripts/upgrade_4.2.1.exp deleted file mode 100644 index 39d921f..0000000 --- a/scripts/expect_scripts/upgrade_4.2.1.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_4.1_4.2.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_4.3.2.exp b/scripts/expect_scripts/upgrade_4.3.2.exp deleted file mode 100644 index 1e5ae01..0000000 --- a/scripts/expect_scripts/upgrade_4.3.2.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_4.2_4.3.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_4.4.3.exp b/scripts/expect_scripts/upgrade_4.4.3.exp deleted file mode 100644 index 1738a74..0000000 --- a/scripts/expect_scripts/upgrade_4.4.3.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_4.3_4.4.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_5.0.3.exp b/scripts/expect_scripts/upgrade_5.0.3.exp deleted file mode 100644 index 397deed..0000000 --- a/scripts/expect_scripts/upgrade_5.0.3.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_4.4_5.0.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_5.1.exp b/scripts/expect_scripts/upgrade_5.1.exp deleted file mode 100644 index 5f82501..0000000 --- a/scripts/expect_scripts/upgrade_5.1.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_5.0_5.1.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_6.0.exp b/scripts/expect_scripts/upgrade_6.0.exp deleted file mode 100644 index b5a3143..0000000 --- a/scripts/expect_scripts/upgrade_6.0.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_5.1_6.0.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_6.1.exp b/scripts/expect_scripts/upgrade_6.1.exp deleted file mode 100644 index fd50049..0000000 --- a/scripts/expect_scripts/upgrade_6.1.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_6.0_6.1.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_6.2.exp b/scripts/expect_scripts/upgrade_6.2.exp deleted file mode 100644 index cf80453..0000000 --- a/scripts/expect_scripts/upgrade_6.2.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_6.1_6.2.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_6.3.exp b/scripts/expect_scripts/upgrade_6.3.exp deleted file mode 100644 index 13a5f44..0000000 --- a/scripts/expect_scripts/upgrade_6.3.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_6.2_6.3.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_7.0.exp b/scripts/expect_scripts/upgrade_7.0.exp deleted file mode 100644 index 271cf59..0000000 --- a/scripts/expect_scripts/upgrade_7.0.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_6.3_7.0.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_7.1.exp b/scripts/expect_scripts/upgrade_7.1.exp deleted file mode 100644 index fbc63c7..0000000 --- a/scripts/expect_scripts/upgrade_7.1.exp +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_7.0_7.1.sh - -expect "to contiune" -send "\r"; - -sleep 10; - -send "\r"; - -sleep 1; - -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_8.0.exp b/scripts/expect_scripts/upgrade_8.0.exp deleted file mode 100644 index 6c86c2b..0000000 --- a/scripts/expect_scripts/upgrade_8.0.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_8.0_9.0.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/expect_scripts/upgrade_9.0.exp b/scripts/expect_scripts/upgrade_9.0.exp deleted file mode 100644 index 0816a57..0000000 --- a/scripts/expect_scripts/upgrade_9.0.exp +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/expect -set timeout 5 - -set seafile_dir [lindex $argv 0] - -spawn $seafile_dir/upgrade/upgrade_7.1_8.0.sh - -expect "to contiune" -send "\r"; - -interact diff --git a/scripts/install b/scripts/install index a81d5f6..7695a70 100644 --- a/scripts/install +++ b/scripts/install @@ -45,12 +45,15 @@ $db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_script_progression --message="Configuring application..." --weight=3 # Run install script -mv_expect_scripts -chmod +x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh +expect_scripts_dir=$(mktemp -d) +cp expect_scripts/install.exp $expect_scripts_dir +chmod u=rwx,o= -R $expect_scripts_dir +chown $YNH_APP_ID -R $expect_scripts_dir +chmod u+x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh set_permission sudo -u $YNH_APP_ID $expect_scripts_dir/install.exp "$install_dir/seafile-server-$seafile_version" "$server_name" "$domain" "$port_fileserver" "$db_name" "$db_pwd" -sleep 3 +sleep 5 # Retrive values from auto generated config file seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2) diff --git a/scripts/upgrade b/scripts/upgrade index 995c446..8b5379f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,10 +89,7 @@ install_dependance ynh_script_progression --message="Configuring application..." # permission to execute update script and expect helper -mv_expect_scripts set_permission -chmod u+x,o= $install_dir/seafile-server-$seafile_version/upgrade/upgrade_*.sh -chmod u+x,o= $install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh # do the upgrade ( the ";&" syntax mean when it go in the first case which is true it do all the next case) case $installed_version in @@ -114,7 +111,8 @@ case $installed_version in popd # Update seafile by script - sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_7.1.exp $install_dir/seafile-server-$seafile_version + ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.0_7.1.sh + sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.0_7.1.sh # Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly if [ -e $install_dir/seafile-data ]; then @@ -124,14 +122,17 @@ case $installed_version in ln -s $data_dir $install_dir/seafile-data ;& "7.1."* ) - sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_8.0.exp $install_dir/seafile-server-$seafile_version + ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_8.0_9.0.sh + sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_8.0_9.0.sh ;& "8.0."* ) - sudo -u $YNH_APP_ID $expect_scripts_dir/upgrade_9.0.exp $install_dir/seafile-server-$seafile_version + ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.1_8.0.sh + sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/upgrade_7.1_8.0.sh ;& esac -sudo -u $YNH_APP_ID $expect_scripts_dir/minor-upgrade.exp $install_dir/seafile-server-$seafile_version +ynh_replace_string --match_string='read dummy' --replace_string='# patched' --target_file=$install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh +sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/upgrade/minor-upgrade.sh # Clean url in config in DB clean_url_in_db_config From 888e0b521de925a6f40424ba411116c7ac339c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 10:59:10 +0100 Subject: [PATCH 06/11] Remove completly expect scripts --- manifest.toml | 2 +- scripts/expect_scripts/install.exp | 54 ------------------------------ scripts/install | 20 ++++++----- scripts/upgrade | 2 ++ 4 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 scripts/expect_scripts/install.exp diff --git a/manifest.toml b/manifest.toml index 3af2d77..335bd4b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -111,7 +111,7 @@ ram.runtime = "500M" armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6" [resources.apt] - packages = ["expect", "ffmpeg", + packages = ["ffmpeg", "python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev", "python3-requests", "python3-scipy", "python3-matplotlib", "mariadb-server", "libmariadb-dev-compat", "libmariadb-dev", diff --git a/scripts/expect_scripts/install.exp b/scripts/expect_scripts/install.exp deleted file mode 100644 index b370f52..0000000 --- a/scripts/expect_scripts/install.exp +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/expect -set timeout 10 - -set seafile_dir [lindex $argv 0] -set server_name [lindex $argv 1] -set domain [lindex $argv 2] -set fileserver_port [lindex $argv 3] -set db_name [lindex $argv 4] -set db_pwd [lindex $argv 5] - -spawn $seafile_dir/setup-seafile-mysql.sh - -expect "Press ENTER to continue" -send "\r"; - -expect "What is the name of the server? It will be displayed on the client." -send "$server_name\r"; - -expect "What is the ip or domain of the server?" -send "$domain\r"; - -expect "Which port do you want to use for the seafile fileserver?" -send "$fileserver_port\r"; - -expect "Use existing ccnet/seafile/seahub databases" -send "2\r"; - -expect "What is the host of mysql server?" -send "localhost\r"; - -expect "What is the port of mysql server?" -send "3306\r"; - -expect "Which mysql user to use for seafile?" -send "seafile\r"; - -expect "What is the password for mysql user" -send "$db_pwd\r"; - -expect "Enter the existing database name for ccnet:" -send "ccnetdb\r"; - -expect "Enter the existing database name for seafile:" -send "$db_name\r"; - -expect "Enter the existing database name for seahub:" -send "seahubdb\r"; - -expect "Press ENTER to continue, or Ctrl-C to abort" -send "\r"; - -interact - -wait diff --git a/scripts/install b/scripts/install index 7695a70..9acee2f 100644 --- a/scripts/install +++ b/scripts/install @@ -45,15 +45,19 @@ $db_helper --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_script_progression --message="Configuring application..." --weight=3 # Run install script -expect_scripts_dir=$(mktemp -d) -cp expect_scripts/install.exp $expect_scripts_dir -chmod u=rwx,o= -R $expect_scripts_dir -chown $YNH_APP_ID -R $expect_scripts_dir -chmod u+x $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh set_permission -sudo -u $YNH_APP_ID $expect_scripts_dir/install.exp "$install_dir/seafile-server-$seafile_version" "$server_name" "$domain" "$port_fileserver" "$db_name" "$db_pwd" - -sleep 5 +sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh auto \ + --server-name "$server_name" \ + --server-ip $domain \ + --fileserver-port $port_fileserver \ + --use-existing-db 0 \ + --mysql-host localhost \ + --mysql-port 3306 \ + --mysql-user $db_user \ + --mysql-user-passwd "$db_pwd" \ + --seafile-db "$db_name" \ + --seafile-db ccnetdb \ + --seahub-db seahubdb # Retrive values from auto generated config file seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' $install_dir/conf/seahub_settings.py | cut -d'"' -f2) diff --git a/scripts/upgrade b/scripts/upgrade index 8b5379f..30355f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,6 +56,8 @@ if mysqlshow | grep -q seafiledb; then $mysqlconn -e "RENAME TABLE seafiledb.$name to $db_name.$name"; done; $mysqlconn -e "DROP DATABASE seafiledb" + ynh_replace_string --match_string='db_name = seafiledb' --replace_string='db_name = seafile' --target_file=$install_dir/conf/seafile.conf + sed -i "s|password\s*=\s*.*^|password = $db_pwd" $install_dir/conf/seafile.conf fi # Set missing settings From d283c566e4e8b2d02d8cfbc51329661c9e7ee51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 11:58:13 +0100 Subject: [PATCH 07/11] Move old data when data already exist --- scripts/install | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/install b/scripts/install index 9acee2f..e88b16d 100644 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,13 @@ fi ynh_script_progression --message="Creating base directory..." ln -s $data_dir $install_dir/seafile-data +if [ -n "$(ls -A $data_dir)" ]; then + old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" + ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" + mkdir -p $old_data_dir_path + mv -t "$old_data_dir_path" "$data_dir"/* +fi + # Download new version from sources ynh_script_progression --message="Installing sources files..." --weight=7 ynh_setup_source --dest_dir=$install_dir/seafile-server-$seafile_version From ad182b52b76965da717d766be2341db399840a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 12:45:03 +0100 Subject: [PATCH 08/11] Fix install --- scripts/install | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index e88b16d..f11ee9e 100644 --- a/scripts/install +++ b/scripts/install @@ -53,17 +53,20 @@ ynh_script_progression --message="Configuring application..." --weight=3 # Run install script set_permission +ynh_replace_special_string --match_string 'seafile_config.seafile_dir = seafile_config.validate_seafile_dir(seafile_dir)' \ + --replace_string 'seafile_config.seafile_dir = seafile_dir' \ + --target_file $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.py sudo -u $YNH_APP_ID bash $install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh auto \ --server-name "$server_name" \ --server-ip $domain \ --fileserver-port $port_fileserver \ - --use-existing-db 0 \ + --use-existing-db 1 \ --mysql-host localhost \ --mysql-port 3306 \ --mysql-user $db_user \ --mysql-user-passwd "$db_pwd" \ --seafile-db "$db_name" \ - --seafile-db ccnetdb \ + --ccnet-db ccnetdb \ --seahub-db seahubdb # Retrive values from auto generated config file From 670eda3a122adc5caf0e9344217993162b0fd0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 12:54:28 +0100 Subject: [PATCH 09/11] Fix typo --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 30355f2..082aa56 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -57,7 +57,7 @@ if mysqlshow | grep -q seafiledb; then done; $mysqlconn -e "DROP DATABASE seafiledb" ynh_replace_string --match_string='db_name = seafiledb' --replace_string='db_name = seafile' --target_file=$install_dir/conf/seafile.conf - sed -i "s|password\s*=\s*.*^|password = $db_pwd" $install_dir/conf/seafile.conf + sed -i "s|password\s*=\s*.*^|password = $db_pwd|g" $install_dir/conf/seafile.conf fi # Set missing settings From 2f748acdc3288a120746dbcc6c1b5080bbc03a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 14:59:05 +0100 Subject: [PATCH 10/11] Add auto update for supported arch --- manifest.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifest.toml b/manifest.toml index 335bd4b..e4ee597 100644 --- a/manifest.toml +++ b/manifest.toml @@ -105,11 +105,16 @@ ram.runtime = "500M" [resources.sources.main] amd64.url = "https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.9_x86-64.tar.gz" amd64.sha256 = "db76bb33572ad0a6860470e907bed4ed780aa17d9e022226d99448a7f9e4ba74" + arm64.url = "https://github.com/haiwen/seafile-rpi/releases/download/v9.0.9/seafile-server-9.0.9-bullseye-arm64v8l.tar.gz" arm64.sha256 = "c58f5d6b741dec240be9d75d6e617102b7adbfeba98cbd866732822bf9ca10b7" armhf.url = "https://github.com/haiwen/seafile-rpi/releases/download/v9.0.9/seafile-server-9.0.9-bullseye-arm32v7l.tar.gz" armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6" + autoupdate.strategy = "latest_github_release" + autoupdate.asset.arm64 = ".*-bullseye-arm64v8l\.tar\.gz" + autoupdate.asset.armhf = ".*-bullseye-arm32v7l\.tar\.gz" + [resources.apt] packages = ["ffmpeg", "python3", "python3-venv", "python3-setuptools", "python3-pip", "python3-dev", From 1d12d39bdfda0b3e0d7c2c2db5c5532e8f60e910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 24 Nov 2023 18:40:08 +0100 Subject: [PATCH 11/11] Fix toml file --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index e4ee597..c0f1614 100644 --- a/manifest.toml +++ b/manifest.toml @@ -112,8 +112,8 @@ ram.runtime = "500M" armhf.sha256 = "171fcf08b726d452e1c4cd22dadb9f8f5cf6848424ebc1e04cde5be34ef3d7f6" autoupdate.strategy = "latest_github_release" - autoupdate.asset.arm64 = ".*-bullseye-arm64v8l\.tar\.gz" - autoupdate.asset.armhf = ".*-bullseye-arm32v7l\.tar\.gz" + autoupdate.asset.arm64 = ".*-bullseye-arm64v8l\\.tar\\.gz" + autoupdate.asset.armhf = ".*-bullseye-arm32v7l\\.tar\\.gz" [resources.apt] packages = ["ffmpeg",