Merge pull request #114 from YunoHost-Apps/testing

Testing
This commit is contained in:
Josue-T 2023-11-27 13:53:02 +01:00 committed by GitHub
commit dbd8df379e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 50 additions and 247 deletions

View file

@ -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

View file

@ -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

View file

@ -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_HOST_USER = "__APP__@__DOMAIN__"
EMAIL_HOST_PASSWORD = ""
EMAIL_PORT = "25"
EMAIL_USE_TLS = True
EMAIL_HOST = "__DOMAIN__"
EMAIL_HOST_USER = "__APP__"
EMAIL_HOST_PASSWORD = "__MAIL_PWD__"
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/'

View file

@ -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"]
@ -105,13 +105,18 @@ 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 = ["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",

View file

@ -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= \

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
@ -45,12 +52,22 @@ $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
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
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 1 \
--mysql-host localhost \
--mysql-port 3306 \
--mysql-user $db_user \
--mysql-user-passwd "$db_pwd" \
--seafile-db "$db_name" \
--ccnet-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)

View file

@ -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|g" $install_dir/conf/seafile.conf
fi
# Set missing settings
@ -89,10 +91,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 +113,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 +124,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