Update to seafile 7.0 and remove ynh_print_OFF/ON

This commit is contained in:
Josué Tille 2019-07-30 11:56:10 +02:00
parent d4aeefafb9
commit 5605e6d546
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
14 changed files with 27 additions and 140 deletions

View file

@ -14,7 +14,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. 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:** 6.3.4 **Shipped version:** 7.0.4
Screenshots Screenshots
----------- -----------

View file

@ -18,6 +18,7 @@
upgrade=1 upgrade=1
upgrade=1 from_commit=f9b9e934f6929bd564386f06c0352f0ef41b7619 upgrade=1 from_commit=f9b9e934f6929bd564386f06c0352f0ef41b7619
upgrade=1 from_commit=874ff38bc4e011a5ba22f006745e86ef8e052346 upgrade=1 from_commit=874ff38bc4e011a5ba22f006745e86ef8e052346
upgrade=1 from_commit=f28bb98edd9bd018acc168a22186cc79737373a0
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
wrong_user=1 wrong_user=1
@ -42,7 +43,9 @@
Level 10=0 Level 10=0
;;; Upgrade options ;;; Upgrade options
: commit=f28bb98edd9bd018acc168a22186cc79737373a0
name=Version 6.3.4
; commit=f9b9e934f6929bd564386f06c0352f0ef41b7619 ; commit=f9b9e934f6929bd564386f06c0352f0ef41b7619
name=The oldest installable version - branch Old_version_for_CI name=The oldest installable version - branch Old_version_for_CI
; commit=874ff38bc4e011a5ba22f006745e86ef8e052346 ; commit=874ff38bc4e011a5ba22f006745e86ef8e052346
name=Before move main dir to opt - branch Old_version_for_CI_2 name=Before move main dir to opt - branch Old_version_for_CI_2

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v6.3.4/seafile-server_6.3.4_stable_pi.tar.gz SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.4/seafile-server_7.0.4_stable_pi.tar.gz
SOURCE_SUM=74dc1062f99a06497634a18bb1f378baad04fb3469d600a18f86803e7767f9a7 SOURCE_SUM=2fe13731bfb827004344454a54fd43723cd747d0f8a246e20771fc1a5b335da9
# (Optional) Program to check the integrity (sha256sum, md5sum...) # (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256 # default: sha256
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://download.seadrive.org/seafile-server_6.3.4_x86-64.tar.gz SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.4_x86-64.tar.gz
SOURCE_SUM=afdf347bd61ce9ea6c5e511e5a45d082c7b8643415a306d7710a3bd3818cf8c0 SOURCE_SUM=a39b1cf5409bddf17bd56b99ea0713779937efe44e9f64c85239fc8240034137
# (Optional) Program to check the integrity (sha256sum, md5sum...) # (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256 # default: sha256
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum

View file

@ -4,7 +4,7 @@
"packaging_format": 1, "packaging_format": 1,
"license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0",
"url": "https://www.seafile.com", "url": "https://www.seafile.com",
"version": "6.3.4~ynh1", "version": "7.0.4~ynh1",
"description": { "description": {
"en": "Open Source Cloud Storage", "en": "Open Source Cloud Storage",
"fr": "Stockage Cloud Open Source" "fr": "Stockage Cloud Open Source"

View file

@ -45,7 +45,7 @@ install_dependance() {
ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \
libjpeg62-turbo-dev zlib1g-dev # For building pillow libjpeg62-turbo-dev zlib1g-dev # For building pillow
if [[ "$seafile_user" == seafile ]] && [[ "$final_path" == "/opt/yunohost/$app" ]] ; then if [[ "$seafile_user" == seafile ]] && [[ "$final_path" == "/opt/yunohost/$app" ]] ; then
sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' certifi idna
else else
pip install --upgrade Pillow 'moviepy<1.0' pip install --upgrade Pillow 'moviepy<1.0'
fi fi

View file

@ -21,9 +21,7 @@ get_configuration
# retrieve useful param # retrieve useful param
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app $app --key domain)
ynh_print_OFF
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
ynh_print_ON
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
@ -43,10 +41,8 @@ ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
# Backup mysql # Backup mysql
ynh_script_progression --message="Backing database" ynh_script_progression --message="Backing database"
ynh_print_OFF
ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp
ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp
ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp
ynh_print_ON
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -93,9 +93,7 @@ ynh_script_progression --message="Updating seafile database" --weight=7
# use : mysql_relpace_db db_name table collum # use : mysql_relpace_db db_name table collum
mysql_relpace_db() { mysql_relpace_db() {
sql_request='UPDATE `'"$2"'` SET '"$3 = replace($3, '$old_domain', '$domain')" sql_request='UPDATE `'"$2"'` SET '"$3 = replace($3, '$old_domain', '$domain')"
ynh_print_OFF
ynh_mysql_execute_as_root --sql "$sql_request" --database $1 ynh_mysql_execute_as_root --sql "$sql_request" --database $1
ynh_print_ON
} }
# ccnet DB # ccnet DB

View file

@ -0,0 +1,12 @@
#!/usr/bin/expect
set timeout 5
set seafile_dir [lindex $argv 0]
set mysql_password [lindex $argv 1]
spawn $seafile_dir/upgrade/upgrade_6.3_7.0.sh
expect "to contiune"
send "\r";
interact

View file

@ -25,9 +25,7 @@ is_public=$YNH_APP_ARG_PUBLIC_SITE
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
final_path=/opt/yunohost/$app final_path=/opt/yunohost/$app
seafile_user=seafile seafile_user=seafile
ynh_print_OFF
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
ynh_print_ON
# Create special path with / at the end # Create special path with / at the end
if [[ $path_url == '/' ]] if [[ $path_url == '/' ]]
@ -90,20 +88,16 @@ install_source
# init databases # init databases
ynh_script_progression --message="Configuring MySQL database..." ynh_script_progression --message="Configuring MySQL database..."
db_user=seafile db_user=seafile
ynh_print_OFF
ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb
ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd" ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd"
ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
ynh_print_ON
ynh_script_progression --message="Configuring application..." --weight=3 ynh_script_progression --message="Configuring application..." --weight=3
# Run install script # Run install script
chmod +x expect_scripts/install.exp chmod +x expect_scripts/install.exp
chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh
ynh_print_OFF
expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd" expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd"
ynh_print_ON
# Update seafile config # Update seafile config
ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf
@ -165,9 +159,7 @@ chown -R $seafile_user:$seafile_user $seafile_data
# Start seafile, seahub and populate admin account # Start seafile, seahub and populate admin account
su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-$seafile_version/seafile.sh start" su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-$seafile_version/seafile.sh start"
# We escape all char witch needed. # We escape all char witch needed.
ynh_print_OFF
ynh_replace_special_string --match_string __ADMIN_PASSWORD__ --replace_string "$admin_password" --target_file $final_path/first_launch.exp ynh_replace_special_string --match_string __ADMIN_PASSWORD__ --replace_string "$admin_password" --target_file $final_path/first_launch.exp
ynh_print_ON
su - $seafile_user -s /bin/bash -c "$final_path/first_launch.exp $final_path/seafile-server-$seafile_version $admin@$domain" su - $seafile_user -s /bin/bash -c "$final_path/first_launch.exp $final_path/seafile-server-$seafile_version $admin@$domain"
ynh_secure_remove --file="$final_path/first_launch.exp" ynh_secure_remove --file="$final_path/first_launch.exp"

View file

@ -20,9 +20,7 @@ ynh_script_progression --message="Loading settings..."
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path)) path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
ynh_print_OFF
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
ynh_print_ON
# Check domain/path availability # Check domain/path availability
ynh_webpath_available $domain $path_url || ynh_die --message "$domain/$path_url is not available, please use an other domain or path." ynh_webpath_available $domain $path_url || ynh_die --message "$domain/$path_url is not available, please use an other domain or path."
@ -47,14 +45,12 @@ install_dependance
# Restore mysql dump # Restore mysql dump
db_user=seafile db_user=seafile
ynh_print_OFF
ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb --db_pwd "$db_pwd" ynh_mysql_setup_db --db_user $db_user --db_name ccnetdb --db_pwd "$db_pwd"
ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd" ynh_mysql_setup_db --db_user $db_user --db_name seafiledb --db_pwd "$db_pwd"
ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd"
su -c "mysql -u ${app} -p$db_pwd ccnetdb < ${YNH_CWD}/ccnetdb.dmp" su -c "mysql -u ${app} -p$db_pwd ccnetdb < ${YNH_CWD}/ccnetdb.dmp"
su -c "mysql -u ${app} -p$db_pwd seafiledb < ${YNH_CWD}/seafiledb.dmp" su -c "mysql -u ${app} -p$db_pwd seafiledb < ${YNH_CWD}/seafiledb.dmp"
su -c "mysql -u ${app} -p$db_pwd seahubdb < ${YNH_CWD}/seahubdb.dmp" su -c "mysql -u ${app} -p$db_pwd seahubdb < ${YNH_CWD}/seahubdb.dmp"
ynh_print_ON
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -26,9 +26,7 @@ installed_version=$(ynh_app_setting_get --app $app --key installed_version)
seahub_port=$(ynh_app_setting_get --app $app --key seahub_port) seahub_port=$(ynh_app_setting_get --app $app --key seahub_port)
fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) 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)
ynh_print_OFF
root_pwd=$(cat /etc/yunohost/mysql) root_pwd=$(cat /etc/yunohost/mysql)
ynh_print_ON
# Get configuration for user and final path # Get configuration for user and final path
get_configuration get_configuration
@ -79,71 +77,55 @@ chmod +x $final_path/seafile-server-$seafile_version/upgrade/minor-upgrade.sh
case $installed_version in case $installed_version in
"4.0."* ) "4.0."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_4.1.1.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_4.1.1.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"4.1."* ) "4.1."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"4.3."* ) "4.3."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"4.4."* ) "4.4."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"5.0."* ) "5.0."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"5.1."* ) "5.1."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"6.0."* ) "6.0."* )
python3 ../conf/update_sso_conf.py || true python3 ../conf/update_sso_conf.py || true
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_6.1.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_6.1.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
# 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
;& ;&
"6.1."* ) "6.1."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_6.2.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_6.2.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
;& ;&
"6.2."* ) "6.2."* )
# Update seafile by script # Update seafile by script
ynh_print_OFF
expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
# Update logrotate to have the last version # Update logrotate to have the last version
ynh_use_logrotate $final_path/logs --non-append ynh_use_logrotate $final_path/logs --non-append
;& ;&
"6.3."* )
# Update seafile by script
expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;&
esac esac
ynh_print_OFF
expect_scripts/minor-upgrade.exp $final_path/seafile-server-$seafile_version $root_pwd expect_scripts/minor-upgrade.exp $final_path/seafile-server-$seafile_version $root_pwd
ynh_print_ON
## Install webdav and logrotate if not installed ## Install webdav and logrotate if not installed
if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]] if [[ $installed_version = "4.0."* ]] || [[ $installed_version = "4.1."* ]]

View file

@ -1 +0,0 @@
x86-64-sso_auth.patch

View file

@ -1,91 +0,0 @@
diff -Naur a/seahub/seahub/auth/middleware.py b/seahub/seahub/auth/middleware.py
--- a/seahub/seahub/auth/middleware.py 2017-06-13 07:49:44.000000000 +0200
+++ b/seahub/seahub/auth/middleware.py 2017-08-11 19:13:54.000000000 +0200
@@ -1,5 +1,6 @@
# Copyright (c) 2012-2016 Seafile Ltd.
-from django.contrib import auth
+#from django.contrib import auth
+from seahub import auth
from django.core.exceptions import ImproperlyConfigured
@@ -50,7 +51,7 @@
" 'django.contrib.auth.middleware.AuthenticationMiddleware'"
" before the RemoteUserMiddleware class.")
try:
- username = request.META[self.header]
+ username = request.META["HTTP_REMOTE_USER"] + '@' + request.META["HTTP_HOST"]
except KeyError:
# If specified header doesn't exist then return (leaving
# request.user set to AnonymousUser by the
diff -Naur a/seahub/seahub/base/accounts.py b/seahub/seahub/base/accounts.py
--- a/seahub/seahub/base/accounts.py 2017-06-13 07:49:44.000000000 +0200
+++ b/seahub/seahub/base/accounts.py 2017-08-11 20:28:30.000000000 +0200
@@ -396,6 +396,48 @@
if user.check_password(password):
return user
+class RemoteUserBackend(AuthBackend):
+ """
+ This backend is to be used in conjunction with the ``RemoteUserMiddleware``
+ found in the middleware module of this package, and is used when the server
+ is handling authentication outside of Django.
+ By default, the ``authenticate`` method creates ``User`` objects for
+ usernames that don't already exist in the database. Subclasses can disable
+ this behavior by setting the ``create_unknown_user`` attribute to
+ ``False``.
+ """
+
+ # Create a User object if not already in the database?
+ create_unknown_user = True
+
+ def authenticate(self, remote_user):
+ """
+ The username passed as ``remote_user`` is considered trusted. This
+ method simply returns the ``User`` object with the given username,
+ creating a new ``User`` object if ``create_unknown_user`` is ``True``.
+ Returns None if ``create_unknown_user`` is ``False`` and a ``User``
+ object with the given username is not found in the database.
+ """
+ if not remote_user:
+ return
+ user = None
+ username = self.clean_username(remote_user)
+
+ # Note that this could be accomplished in one try-except clause, but
+ # instead we use get_or_create when creating unknown users since it has
+ # built-in safeguards for multiple threads.
+
+ user = self.get_user(username)
+ return user
+
+ def clean_username(self, username):
+ """
+ Performs any cleaning on the "username" prior to using it to get or
+ create the user object. Returns the cleaned username.
+ By default, returns the username unchanged.
+ """
+ return username
+
########## Register related
class RegistrationBackend(object):
"""
diff -Naur a/seahub/seahub/settings.py b/seahub/seahub/settings.py
--- a/seahub/seahub/settings.py 2017-06-13 07:52:41.000000000 +0200
+++ b/seahub/seahub/settings.py 2017-08-11 21:48:59.397330029 +0200
@@ -114,6 +114,7 @@
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'seahub.auth.middleware.AuthenticationMiddleware',
+ 'seahub.auth.middleware.RemoteUserMiddleware',
'seahub.base.middleware.BaseMiddleware',
'seahub.base.middleware.InfobarMiddleware',
'seahub.password_session.middleware.CheckPasswordHash',
@@ -232,6 +233,7 @@
CONSTANCE_DATABASE_CACHE_BACKEND = 'default'
AUTHENTICATION_BACKENDS = (
+ 'seahub.base.accounts.RemoteUserBackend',
'seahub.base.accounts.AuthBackend',
)
LOGIN_REDIRECT_URL = '/profile/'