mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Merge remote-tracking branch 'origin/7.1' into group_permissions_support
This commit is contained in:
commit
84a1623636
17 changed files with 189 additions and 104 deletions
10
README.md
10
README.md
|
@ -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:** 7.0.4
|
**Shipped version:** 7.1.5
|
||||||
|
|
||||||
Screenshots
|
Screenshots
|
||||||
-----------
|
-----------
|
||||||
|
@ -88,6 +88,14 @@ From command line:
|
||||||
|
|
||||||
### Upgrade
|
### Upgrade
|
||||||
|
|
||||||
|
By default a backup is made before the upgrade. To avoid this you have theses following possibilites:
|
||||||
|
- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`.
|
||||||
|
- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command:
|
||||||
|
|
||||||
|
`yunohost app setting synapse disable_backup_before_upgrade -v 1`
|
||||||
|
|
||||||
|
After this settings will be applied for **all** next upgrade.
|
||||||
|
|
||||||
From command line:
|
From command line:
|
||||||
|
|
||||||
`yunohost app upgrade seafile`
|
`yunohost app upgrade seafile`
|
||||||
|
|
|
@ -30,18 +30,6 @@
|
||||||
port_already_use=1 (8000)
|
port_already_use=1 (8000)
|
||||||
final_path_already_use=1
|
final_path_already_use=1
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Levels
|
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
# https://github.com/YunoHost-Apps/seafile_ynh/issues/1
|
|
||||||
Level 4=1
|
|
||||||
Level 5=auto
|
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
|
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=db11d890922564dfdcb7937a3a682957082fbb31
|
; commit=db11d890922564dfdcb7937a3a682957082fbb31
|
||||||
|
|
11
conf/arm_7_0.src
Normal file
11
conf/arm_7_0.src
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz
|
||||||
|
SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db
|
||||||
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
|
# default: sha256
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
# (Optional) Archive format
|
||||||
|
# default: tar.gz
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
# (Optional) Put false if sources are directly in the archive root
|
||||||
|
# default: true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
1
conf/create_admin.json
Normal file
1
conf/create_admin.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"email": "__ADMIN__", "password": "__PASSWORD__"}
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz
|
SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.5_x86-64.tar.gz
|
||||||
SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53
|
SOURCE_SUM=edf020de2324be33df3f6854c6383affca088807bfc1e27a375fbb0f44af0cb0
|
||||||
# (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
|
||||||
|
|
11
conf/x86-64_7_0.src
Normal file
11
conf/x86-64_7_0.src
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz
|
||||||
|
SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53
|
||||||
|
# (Optional) Program to check the integrity (sha256sum, md5sum...)
|
||||||
|
# default: sha256
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
# (Optional) Archive format
|
||||||
|
# default: tar.gz
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
# (Optional) Put false if sources are directly in the archive root
|
||||||
|
# default: true
|
||||||
|
SOURCE_IN_SUBDIR=true
|
|
@ -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": "7.0.5~ynh1",
|
"version": "7.1.5~ynh1",
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Open Source Cloud Storage",
|
"en": "Open Source Cloud Storage",
|
||||||
"fr": "Stockage Cloud Open Source"
|
"fr": "Stockage Cloud Open Source"
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.7.0.6"
|
"yunohost": ">= 4.0"
|
||||||
},
|
},
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install": [
|
"install": [
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
[[ -e "../settings/manifest.json" ]] || [[ -e "../manifest.json" ]] && \
|
|
||||||
seafile_version=$(ynh_app_upstream_version)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEFINE ALL COMMON FONCTIONS
|
# DEFINE ALL COMMON FONCTIONS
|
||||||
|
@ -19,19 +17,29 @@ install_source() {
|
||||||
ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture"
|
ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture"
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dependance() {
|
install_source_7_0() {
|
||||||
if [ "$(lsb_release --codename --short)" == "stretch" ]; then
|
if ! [ -e $final_path/seafile-server-7.0.5 ]; then
|
||||||
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 \
|
mkdir "$final_path/seafile-server-7.0.5"
|
||||||
libjpeg62-turbo-dev zlib1g-dev # For building pillow
|
if [[ $architecture == "i386" ]]
|
||||||
else
|
then
|
||||||
ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-pil python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \
|
ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture"
|
||||||
libjpeg62-turbo-dev zlib1g-dev # For building pillow
|
fi
|
||||||
|
ynh_setup_source "$final_path/seafile-server-7.0.5" "$architecture"_7_0
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_dependance() {
|
||||||
|
ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev \
|
||||||
|
expect ffmpeg \
|
||||||
|
memcached libmemcached-dev \
|
||||||
|
libjpeg62-turbo-dev zlib1g-dev # For building pillow
|
||||||
ynh_add_swap 2000
|
ynh_add_swap 2000
|
||||||
# We need to do that because we can have some issue about the permission access to the pip cache without this
|
# We need to do that because we can have some issue about the permission access to the pip cache without this
|
||||||
set_permission
|
set_permission
|
||||||
# Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5
|
# Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5
|
||||||
sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' 'imageio<2.8' certifi idna
|
sudo -u $seafile_user pip3 install --user --upgrade Pillow pylibmc captcha jinja2 sqlalchemy psd-tools \
|
||||||
|
django-pylibmc django-simple-captcha python3-ldap \
|
||||||
|
pylibmc django-pylibmc # Memcached support
|
||||||
ynh_del_swap
|
ynh_del_swap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source scripts/experimental_helper.sh
|
||||||
|
source scripts/_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source scripts/experimental_helper.sh
|
|
||||||
source scripts/_common.sh
|
|
||||||
|
|
||||||
ynh_print_info --message="Loading installation settings..."
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
# Retrive arguments
|
# Retrive arguments
|
||||||
|
|
|
@ -4,17 +4,17 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ../settings/scripts/experimental_helper.sh
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
ynh_print_info --message="Loading installation settings..."
|
||||||
source ../settings/scripts/experimental_helper.sh
|
|
||||||
source ../settings/scripts/_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
# retrieve useful param
|
# retrieve useful param
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# # Backup app files
|
# # Backup app files
|
||||||
ynh_script_progression --message="Backing up code..." --weight=3
|
ynh_print_info --message="Backing up code..."
|
||||||
ynh_backup --src_path $final_path
|
ynh_backup --src_path $final_path
|
||||||
ynh_script_progression --message="Backing up user data..." --weight=10
|
ynh_print_info --message="Backing up user data..."
|
||||||
ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1
|
ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1
|
||||||
ynh_script_progression --message="Backing up configuration..."
|
ynh_print_info --message="Backing up configuration..."
|
||||||
ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf
|
ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf
|
||||||
ynh_backup --src_path /etc/systemd/system/seafile.service
|
ynh_backup --src_path /etc/systemd/system/seafile.service
|
||||||
ynh_backup --src_path /etc/systemd/system/seahub.service
|
ynh_backup --src_path /etc/systemd/system/seahub.service
|
||||||
|
@ -43,9 +43,9 @@ ynh_backup --src_path /etc/fail2ban/jail.d/$app.conf
|
||||||
ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
|
ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
|
||||||
|
|
||||||
# Backup mysql
|
# Backup mysql
|
||||||
ynh_script_progression --message="Backing up database"
|
ynh_print_info --message="Backing up database"
|
||||||
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_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ./experimental_helper.sh
|
||||||
|
source ./_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source ./experimental_helper.sh
|
|
||||||
source ./_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# Retrive arguments
|
# Retrive arguments
|
||||||
|
|
|
@ -19,8 +19,8 @@ send "$server_name\r";
|
||||||
expect "What is the ip or domain of the server?"
|
expect "What is the ip or domain of the server?"
|
||||||
send "$domain\r";
|
send "$domain\r";
|
||||||
|
|
||||||
expect "Where do you want to put your seafile data?"
|
# expect "Where do you want to put your seafile data?"
|
||||||
send "$seafile_data\r";
|
# send "$seafile_data\r";
|
||||||
|
|
||||||
expect "Which port do you want to use for the seafile fileserver?"
|
expect "Which port do you want to use for the seafile fileserver?"
|
||||||
send "$fileserver_port\r";
|
send "$fileserver_port\r";
|
||||||
|
|
11
scripts/expect_scripts/upgrade_7.1.exp
Normal file
11
scripts/expect_scripts/upgrade_7.1.exp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/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";
|
||||||
|
|
||||||
|
interact
|
|
@ -4,21 +4,21 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ./experimental_helper.sh
|
||||||
|
source ./_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source ./experimental_helper.sh
|
|
||||||
source ./_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
|
path_url=$YNH_APP_ARG_PATH
|
||||||
server_name="$YNH_APP_ARG_SERVER_NAME"
|
server_name="$YNH_APP_ARG_SERVER_NAME"
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
@ -26,6 +26,8 @@ seafile_data=/home/yunohost.app/seafile-data
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
seafile_user=$app
|
seafile_user=$app
|
||||||
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
||||||
|
# TODO User env variable in 4.1
|
||||||
|
seafile_version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
# Create special path with / at the end
|
# Create special path with / at the end
|
||||||
if [[ $path_url == '/' ]]
|
if [[ $path_url == '/' ]]
|
||||||
|
@ -76,7 +78,8 @@ ynh_script_progression --message="Creating base directory..."
|
||||||
mkdir -p $final_path
|
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 $final_path/seafile-data
|
mkdir -p $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..."
|
||||||
|
@ -86,10 +89,6 @@ ynh_system_user_create --username $seafile_user --home_dir $final_path
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=7
|
ynh_script_progression --message="Installing dependencies..." --weight=7
|
||||||
install_dependance
|
install_dependance
|
||||||
|
|
||||||
# Clean data directory
|
|
||||||
ynh_script_progression --message="Cleaning data directory..."
|
|
||||||
test -e $seafile_data && ynh_secure_remove --file="$seafile_data"
|
|
||||||
|
|
||||||
# Download new version from sources
|
# Download new version from sources
|
||||||
ynh_script_progression --message="Installing sources files..." --weight=7
|
ynh_script_progression --message="Installing sources files..." --weight=7
|
||||||
install_source
|
install_source
|
||||||
|
@ -148,11 +147,28 @@ echo 'FILTER = &(objectClass=posixAccount)(permission=cn='$app'.main,ou=permissi
|
||||||
# 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
|
||||||
|
|
||||||
|
# Enable memcached
|
||||||
|
cat >> $final_path/conf/seahub_settings.py <<EOF
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
|
||||||
|
'LOCATION': '127.0.0.1:11211',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Configure admin info
|
||||||
|
# It will be used the first start
|
||||||
|
admin_email=$(ynh_user_get_info --username $admin --key 'mail')
|
||||||
|
cp ../conf/create_admin.json $final_path/conf/admin.txt
|
||||||
|
ynh_replace_string --match_string __ADMIN__ --replace_string $admin_email --target_file $final_path/conf/admin.txt
|
||||||
|
ynh_replace_special_string --match_string __PASSWORD__ --replace_string $admin_password --target_file $final_path/conf/admin.txt
|
||||||
|
|
||||||
# Fix local warning
|
# Fix local warning
|
||||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
||||||
|
|
||||||
# Update gunicorn config
|
# Update gunicorn config
|
||||||
sed --in-place -r "s@bind = \"127\.0\.0\.1:[[:digit:]]+\"@bind = \"127.0.0.1:$seahub_port\"@g" $final_path/conf/gunicorn.conf
|
sed --in-place -r "s@bind = \"127\.0\.0\.1:[[:digit:]]+\"@bind = \"127.0.0.1:$seahub_port\"@g" $final_path/conf/gunicorn.conf.py
|
||||||
|
|
||||||
# Add webdav
|
# Add webdav
|
||||||
cp ../conf/seafdav.conf $final_path/conf/seafdav.conf
|
cp ../conf/seafdav.conf $final_path/conf/seafdav.conf
|
||||||
|
@ -172,22 +188,13 @@ cp expect_scripts/first_launch.exp $final_path
|
||||||
chmod +x $final_path/first_launch.exp
|
chmod +x $final_path/first_launch.exp
|
||||||
|
|
||||||
# Set permissions to seafile directory
|
# Set permissions to seafile directory
|
||||||
chown -R $seafile_user:$seafile_user $final_path
|
set_permission
|
||||||
chown -R $seafile_user:$seafile_user $seafile_data
|
|
||||||
|
|
||||||
# Sometime we have a current effect. We try to lunch seafile when not all permissions are already set.
|
# Sometime we have a current effect. We try to lunch seafile when not all permissions are already set.
|
||||||
# So wait untils all permissions are cleanly set
|
# So wait untils all permissions are cleanly set
|
||||||
sleep 5
|
sleep 5
|
||||||
ynh_debug_exec ls /opt/yunohost/seafile/ccnet
|
ynh_debug_exec ls /opt/yunohost/seafile/ccnet
|
||||||
|
|
||||||
# Start seafile, seahub and populate admin account
|
|
||||||
su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-$seafile_version/seafile.sh start"
|
|
||||||
# We escape all char witch needed.
|
|
||||||
ynh_replace_special_string --match_string __ADMIN_PASSWORD__ --replace_string "$admin_password" --target_file $final_path/first_launch.exp
|
|
||||||
admin_email=$(ynh_user_get_info --username $admin --key 'mail')
|
|
||||||
su - $seafile_user -s /bin/bash -c "$final_path/first_launch.exp $final_path/seafile-server-$seafile_version $admin_email"
|
|
||||||
ynh_secure_remove --file="$final_path/first_launch.exp"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -213,29 +220,20 @@ ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate --logfile $final_path/logs
|
ynh_use_logrotate --logfile $final_path/logs
|
||||||
ln -s $final_path/logs /var/log/seafile
|
ln -s $final_path/logs /var/log/seafile
|
||||||
|
|
||||||
# Add fail2ban
|
|
||||||
ynh_script_progression --message="Configuring fail2ban..." --weight=10
|
|
||||||
ynh_add_fail2ban_config --use_template --others_var 'final_path'
|
|
||||||
|
|
||||||
# register yunohost service
|
# register yunohost service
|
||||||
yunohost service add seafile
|
yunohost service add seafile
|
||||||
yunohost service add seahub
|
yunohost service add seahub
|
||||||
|
|
||||||
ynh_script_progression --message="Stoping services..." --weight=3
|
ynh_script_progression --message="Stoping services..." --weight=3
|
||||||
|
|
||||||
# Kill all services launched for initialisation
|
|
||||||
su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-latest/seafile.sh stop"
|
|
||||||
su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-latest/seahub.sh stop"
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
# We kill all process lunched by the script
|
|
||||||
pkill -f seafile-controller || true
|
|
||||||
pkill -f seaf-server || true
|
|
||||||
|
|
||||||
# Start service
|
# Start service
|
||||||
ynh_script_progression --message="Starting seafile services..." --weight=3
|
ynh_script_progression --message="Starting seafile services..." --weight=3
|
||||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
# Add fail2ban
|
||||||
|
ynh_script_progression --message="Configuring fail2ban..." --weight=10
|
||||||
|
ynh_add_fail2ban_config --use_template --others_var 'final_path'
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ./experimental_helper.sh
|
||||||
|
source ./_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source ./experimental_helper.sh
|
|
||||||
source ./_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ../settings/scripts/experimental_helper.sh
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source ../settings/scripts/experimental_helper.sh
|
|
||||||
source ../settings/scripts/_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Loading settings..."
|
ynh_script_progression --message="Loading settings..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
@ -69,8 +69,8 @@ set_permission
|
||||||
# Enable service and start seafile
|
# Enable service and start seafile
|
||||||
ynh_script_progression --message="Reconfiguring application..."
|
ynh_script_progression --message="Reconfiguring application..."
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable seafile
|
systemctl enable seafile --quiet
|
||||||
systemctl enable seahub
|
systemctl enable seahub --quiet
|
||||||
|
|
||||||
# Add Seafile to YunoHost's monitored services
|
# Add Seafile to YunoHost's monitored services
|
||||||
ynh_script_progression --message="Register seafile service..."
|
ynh_script_progression --message="Register seafile service..."
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Import common cmd
|
||||||
|
source ./experimental_helper.sh
|
||||||
|
source ./_common.sh
|
||||||
|
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Stop script if errors
|
# Stop script if errors
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
# Import common cmd
|
|
||||||
source ./experimental_helper.sh
|
|
||||||
source ./_common.sh
|
|
||||||
|
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
@ -26,6 +26,9 @@ 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
|
||||||
|
seafile_version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
ynh_script_progression --message="Stoping services..."
|
ynh_script_progression --message="Stoping services..."
|
||||||
|
|
||||||
|
@ -33,20 +36,32 @@ ynh_script_progression --message="Stoping services..."
|
||||||
if [ -e /etc/init.d/seafile-server ]
|
if [ -e /etc/init.d/seafile-server ]
|
||||||
then
|
then
|
||||||
# Old init script support
|
# Old init script support
|
||||||
systemctl stop seafile-server
|
systemctl stop seafile-server --quiet
|
||||||
systemctl disable seafile-server
|
systemctl disable seafile-server --quiet
|
||||||
ynh_secure_remove --file=/etc/init.d/seafile-server
|
ynh_secure_remove --file=/etc/init.d/seafile-server
|
||||||
yunohost service remove seafile-server
|
yunohost service remove seafile-server
|
||||||
else
|
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
|
||||||
|
if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ]
|
||||||
|
then
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# Clean installation remainings that are not handled by the remove script.
|
||||||
|
ynh_clean_check_starting
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MIGRATION FROM OLD VERSION
|
# MIGRATION FROM OLD VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -107,46 +122,55 @@ case $installed_version in
|
||||||
;&
|
;&
|
||||||
"4.1."* )
|
"4.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"4.3."* )
|
"4.3."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"4.4."* )
|
"4.4."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"5.0."* )
|
"5.0."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_5.1.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_5.1.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"5.1."* )
|
"5.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_6.0.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_6.0.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"6.0."* )
|
"6.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
|
||||||
;&
|
;&
|
||||||
"6.1."* )
|
"6.1."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_6.2.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_6.2.exp $final_path/seafile-server-$seafile_version
|
||||||
;&
|
;&
|
||||||
"6.2."* )
|
"6.2."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
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
|
||||||
;&
|
;&
|
||||||
"6.3."* )
|
"6.3."* )
|
||||||
# Update seafile by script
|
# Update seafile by script
|
||||||
|
install_source_7_0
|
||||||
expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version
|
expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version
|
||||||
# SSO authentication
|
# SSO authentication
|
||||||
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py
|
||||||
|
@ -156,8 +180,33 @@ 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"
|
||||||
|
;&
|
||||||
|
"7.0"* )
|
||||||
|
# Fix file comment
|
||||||
|
$final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment
|
||||||
|
|
||||||
|
# Enable memcached
|
||||||
|
cat >> $final_path/conf/seahub_settings.py <<EOF
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
|
||||||
|
'LOCATION': '127.0.0.1:11211',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Update seafile by script
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -203,7 +252,7 @@ fi
|
||||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file $final_path/seafile-server-$seafile_version/seahub.sh
|
||||||
|
|
||||||
# Update gunicorn config
|
# Update gunicorn config
|
||||||
sed --in-place -r "s@bind = \"0\.0\.0\.0:[[:digit:]]+\"@bind = \"0.0.0.0:$seahub_port\"@g" $final_path/conf/gunicorn.conf
|
sed --in-place -r "s@bind = \"0\.0\.0\.0:[[:digit:]]+\"@bind = \"0.0.0.0:$seahub_port\"@g" $final_path/conf/gunicorn.conf.py
|
||||||
|
|
||||||
# In the 3.x seafile version package the seahub_port and fileserver_port wasn't saved in the settings. If the settings is empty we try to get it and save in the settings
|
# In the 3.x seafile version package the seahub_port and fileserver_port wasn't saved in the settings. If the settings is empty we try to get it and save in the settings
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue