Fix small issues

This commit is contained in:
Josué Tille 2020-12-15 22:09:09 +01:00
parent a2f13e12e8
commit c56de31105
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
3 changed files with 20 additions and 11 deletions

View file

@ -22,7 +22,7 @@ db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
final_path=$(ynh_app_setting_get --app $app --key final_path) final_path=$(ynh_app_setting_get --app $app --key final_path)
seafile_user=$app seafile_user=$app
if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: inactive (dead)" ]]; then if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: failed (Result: signal)" ]]; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'" ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'"
fi fi

View file

@ -79,7 +79,7 @@ mkdir -p $final_path
mkdir -p $final_path/installed mkdir -p $final_path/installed
mkdir -p $final_path/logs mkdir -p $final_path/logs
mkdir -p $seafile_data mkdir -p $seafile_data
ln -s $seafile_data $final_path/seafile_data ln -s $seafile_data $final_path/seafile-data
# Create User # Create User
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."

View file

@ -25,6 +25,7 @@ fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port)
webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) webdav_port=$(ynh_app_setting_get --app $app --key webdav_port)
final_path=$(ynh_app_setting_get --app $app --key final_path) final_path=$(ynh_app_setting_get --app $app --key final_path)
seafile_user=$app seafile_user=$app
seafile_data=/home/yunohost.app/seafile-data
# TODO User env variable in 4.1 # TODO User env variable in 4.1
seafile_version=$(ynh_app_upstream_version) seafile_version=$(ynh_app_upstream_version)
@ -42,12 +43,13 @@ else
ynh_systemd_action --service_name seafile --action stop ynh_systemd_action --service_name seafile --action stop
ynh_systemd_action --service_name seahub --action stop ynh_systemd_action --service_name seahub --action stop
fi fi
sleep 2 sleep 5
pkill -f seafile-controller || true pkill -f seafile-controller || true
pkill -f seaf-server || true pkill -f seaf-server || true
pkill -f ccnet-server || true pkill -f ccnet-server || true
pkill -f seahub || true pkill -f seahub || true
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30
# Backup the current version of the app # Backup the current version of the app
if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ] if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ]
then then
@ -145,10 +147,10 @@ case $installed_version in
"6.0."* ) "6.0."* )
install_source_7_0 install_source_7_0
python3 ../conf/update_sso_conf.py || true python3 ../conf/update_sso_conf.py || true
# Update seafile by script # Update seafile by script
expect_scripts/upgrade_6.1.exp $final_path/seafile-server-$seafile_version expect_scripts/upgrade_6.1.exp $final_path/seafile-server-$seafile_version
# Enable manually wiki # Enable manually wiki
echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py
;& ;&
@ -161,7 +163,7 @@ case $installed_version in
# Update seafile by script # Update seafile by script
install_source_7_0 install_source_7_0
expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version
# Update logrotate to have the last version # Update logrotate to have the last version
ynh_use_logrotate --logfile $final_path/logs --nonappend ynh_use_logrotate --logfile $final_path/logs --nonappend
;& ;&
@ -177,13 +179,13 @@ case $installed_version in
# Clean connexion from the SSO. If we don't do this we could have some when the user was loged by the old SSO auth mecanisme # Clean connexion from the SSO. If we don't do this we could have some when the user was loged by the old SSO auth mecanisme
ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb
ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user." ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user."
ynh_secure_remove --file="$final_path/seafile-server-7.0.5" ynh_secure_remove --file="$final_path/seafile-server-7.0.5"
;& ;&
"7.0"* ) "7.0"* )
# Fix file comment # Fix file comment
$final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment
# Enable memcached # Enable memcached
cat >> $final_path/conf/seahub_settings.py <<EOF cat >> $final_path/conf/seahub_settings.py <<EOF
@ -195,8 +197,15 @@ CACHES = {
} }
EOF EOF
# Update seafile by script # Update seafile by script
expect_scripts/upgrade_7.1.exp $final_path/seafile-server-$seafile_version expect_scripts/upgrade_7.1.exp $final_path/seafile-server-$seafile_version
# Fix seafile data link. Look like that the upgrade script of seafile don't always work correctly
if [ -e $final_path/seafile-data ]; then
old_data_dir_path="$final_path/seafile_data$(date '+%Y%m%d.%H%M%S')"
mv "$final_path/seafile-data" "$old_data_dir_path"
fi
ln -s $seafile_data $final_path/seafile-data
;& ;&
esac esac