This commit is contained in:
Josue 2016-12-27 10:44:40 +01:00
parent abdf449994
commit 37da57a94d
13 changed files with 210 additions and 65 deletions

View file

@ -27,7 +27,7 @@ From command line:
Infos Infos
----- -----
Seafile server v5.0.3 Seafile server v6.0.6
Available for x64, i386, and Raspberry Pi architecture but only tested for x64 (feedback are welcome) Available for x64, i386, and Raspberry Pi architecture but only tested for x64 (feedback are welcome)
@ -52,6 +52,31 @@ TODO
- Auto login/logout, see #1 - Auto login/logout, see #1
- Test of backup/restore script - Test of backup/restore script
Use a spial user and put seafile binary in /opt dir :
--------------------------------------
With this new package for a better security, it's possible to run seafile with a special user (seafile) put all seafile file in /opt/yunohost dir.
To do this open a console and do this command :
```
# stop seafile server
sudo service seafile-server stop
# Move all data to opt and change user
sudo mv /var/www/seafile /opt/yunohost/seafile
sudo addgroup seafile --system --quiet
sudo adduser seafile --disabled-login --ingroup seafile --system --quiet --shell /bin/bash --home /opt/yunohost/seafile
# Adapt configuration
sudo sed -i "s@user=www-data@user=seafile@g" /etc/init.d/seafile-server
sudo sed -i "s@seafile_dir=/var/www/seafile@seafile_dir=/opt/yunohost/seafile@g" /etc/init.d/seafile-server
sudo sed -i "s@alias /var/www/seafile/@alias /opt/yunohost/seafile/@g" /etc/nginx/conf.d/$domain.d/seafile.conf
# Restart services
sudo service nginx reload
sudo service seafile-server start
```
Developper infos Developper infos
---------------- ----------------

12
conf/upgrade_5.1.exp Normal file
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_5.0_5.1.sh
expect "to contiune"
send "\r";
interact

12
conf/upgrade_6.0.exp Normal file
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_5.1_6.0.sh
expect "to contiune"
send "\r";
interact

View file

@ -1,23 +1,30 @@
{ {
"name": "Seafile", "name": "Seafile",
"id": "seafile", "id": "seafile",
"packaging_format": 1,
"license": "free",
"url": "https://www.seafile.com",
"description": { "description": {
"en": "Open Source Cloud Storage", "en": "Open Source Cloud Storage",
"fr": "Stockage Cloud Open Source" "fr": "Stockage Cloud Open Source"
}, },
"developer": { "maintainer": {
"name": "mbugeia", "name": "mbugeia",
"email": "maxime@max.privy.place" "email": "maxime@max.privy.place"
}, },
"multi_instance": "false", "multi_instance": false,
"services": [ "services": [
"nginx", "nginx",
"mysql" "mysql"
], ],
"requirements": {
"yunohost": ">= 2.4.0"
},
"arguments": { "arguments": {
"install": [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain",
"ask": { "ask": {
"en": "Choose a domain for Seafile", "en": "Choose a domain for Seafile",
"fr": "Choisissez un domaine pour Seafile" "fr": "Choisissez un domaine pour Seafile"
@ -26,6 +33,7 @@
}, },
{ {
"name": "path", "name": "path",
"type": "path",
"ask": { "ask": {
"en": "Choose a path for Seafile", "en": "Choose a path for Seafile",
"fr": "Choisissez un chemin pour Seafile" "fr": "Choisissez un chemin pour Seafile"
@ -44,6 +52,7 @@
}, },
{ {
"name": "admin", "name": "admin",
"type": "user",
"ask": { "ask": {
"en": "Choose the admin user for Seafile", "en": "Choose the admin user for Seafile",
"fr": "Choisissez l'administrateur de Seafile" "fr": "Choisissez l'administrateur de Seafile"
@ -52,6 +61,7 @@
}, },
{ {
"name": "admin_password", "name": "admin_password",
"type": "password",
"ask": { "ask": {
"en": "Enter a password for the administrator", "en": "Enter a password for the administrator",
"fr": "Entrez un mot de passe pour l'administrateur" "fr": "Entrez un mot de passe pour l'administrateur"
@ -60,12 +70,12 @@
}, },
{ {
"name": "public_site", "name": "public_site",
"type": "boolean",
"ask": { "ask": {
"en": "Is it a public site ? If you want to use a desktop client or the smartphone app, make Seafile public.", "en": "Is it a public site ? If you want to use a desktop client or the smartphone app, make Seafile public.",
"fr": "Est-ce un site public ? Pour utiliser un client sur PC ou l'application mobile, Seafile doit être public" "fr": "Est-ce un site public ? Pour utiliser un client sur PC ou l'application mobile, Seafile doit être public"
}, },
"choices": ["Yes", "No"], "default": "1"
"default": "Yes"
}, },
{ {
"name": "architecture", "name": "architecture",

29
scripts/_common.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/bash
set_configuration() {
if [[ -e /var/www/$app ]]
then
final_path=/var/www/$app
seafile_user=www-data
elif [[ -e /opt/yunohost/$app ]]
final_path=/opt/yunohost/$app
seafile_user=seafile
else
ynh_die "Error : can't find seafile path"
fi
}
get_source() {
if [[ $1 == 'arm' ]]
then
wget -O '/tmp/seafile_src.tar.gz' 'https://github.com/haiwen/seafile-rpi/releases/download/v'$2'/seafile-server'$1'_stable_pi.tar.gz'
else
wget -O '/tmp/seafile_src.tar.gz' 'https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_'$1'_'$2'.tar.gz'
fi
if [[ ! -e '/tmp/seafile_src.tar.gz' ]]
then
ynh_die "Error : can't get seafile source"
fi
}

View file

@ -2,6 +2,12 @@
set -e set -e
# Import common cmd
source ./_common.sh
# Set configuration for user and final path
set_configuration
# The parameter $1 is the backup directory location dedicated to the app # The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1 BACKUP_DIR=$1
@ -9,12 +15,12 @@ BACKUP_DIR=$1
APP=$2 APP=$2
# retrieve useful param # retrieve useful param
domain=$(sudo yunohost app setting ${APP} domain) domain=$(ynh_app_setting_get ${APP} domain)
db_pwd=$(sudo yunohost app setting ${APP} db_pwd) db_pwd=$(ynh_app_setting_get ${APP} db_pwd)
# Backup app files # Backup app files
sudo mkdir -p "${BACKUP_DIR}/www" sudo mkdir -p "${BACKUP_DIR}/www"
sudo cp -a /var/www/${APP}/. "${BACKUP_DIR}/www" sudo cp -a $final_path/. "${BACKUP_DIR}/www"
# Backup conf files # Backup conf files
sudo mkdir -p "${BACKUP_DIR}/conf" sudo mkdir -p "${BACKUP_DIR}/conf"
@ -30,5 +36,3 @@ sudo cp -a /home/yunohost.app/seafile-data/. "${BACKUP_DIR}/data"
mysqldump -u ${APP} -p$db_pwd ccnetdb | sudo dd of=${BACKUP_DIR}/ccnetdb.dmp mysqldump -u ${APP} -p$db_pwd ccnetdb | sudo dd of=${BACKUP_DIR}/ccnetdb.dmp
mysqldump -u ${APP} -p$db_pwd seafiledb | sudo dd of=${BACKUP_DIR}/seafiledb.dmp mysqldump -u ${APP} -p$db_pwd seafiledb | sudo dd of=${BACKUP_DIR}/seafiledb.dmp
mysqldump -u ${APP} -p$db_pwd seahubdb | sudo dd of=${BACKUP_DIR}/seahubdb.dmp mysqldump -u ${APP} -p$db_pwd seahubdb | sudo dd of=${BACKUP_DIR}/seahubdb.dmp
exit 0

View file

@ -10,9 +10,24 @@ admin=$4
admin_password=$5 admin_password=$5
is_public=$6 is_public=$6
architecture=$7 architecture=$7
final_path=/var/www/$app
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
seafile_version=5.0.3 seafile_version=6.0.4
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Import common cmd
source ./_common.sh
# Set configuration for user and final path
set_configuration
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app \
|| (echo "Path not available: $domain$path" && ynh_die "Error : path not available")
# Download new version from sources
get_source $architecture $seafile_version
# Retrieve admin email # Retrieve admin email
admin_email=$(sudo yunohost user info $admin | grep mail: | sed "s/mail: //g") admin_email=$(sudo yunohost user info $admin | grep mail: | sed "s/mail: //g")
@ -31,10 +46,6 @@ findPort () {
return $port return $port
} }
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a $app \
|| (echo "Path not available: $domain$path" && exit 1)
# Check dependencies # Check dependencies
sudo apt-get update sudo apt-get update
sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect
@ -45,7 +56,7 @@ sudo mkdir -p $final_path/installed
sudo mkdir -p $final_path/logs sudo mkdir -p $final_path/logs
sudo mkdir -p $final_path/seafile-data sudo mkdir -p $final_path/seafile-data
sudo mkdir -p $final_path/seafile-server-$seafile_version sudo mkdir -p $final_path/seafile-server-$seafile_version
sudo tar xzf ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' sudo tar xzf '/tmp/seafile_src.tar.gz'
sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version
sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' $final_path/installed sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' $final_path/installed
@ -58,20 +69,20 @@ findPort 8080
webdav_port=$port webdav_port=$port
# store config in yunohost # store config in yunohost
sudo yunohost app setting $app seahub_port -v $seahub_port ynh_app_setting_set $app seahub_port $seahub_port
sudo yunohost app setting $app fileserver_port -v $fileserver_port ynh_app_setting_set $app fileserver_port $fileserver_port
sudo yunohost app setting $app webdav_port -v $webdav_port ynh_app_setting_set $app webdav_port $webdav_port
sudo yunohost app setting $app is_public -v $is_public ynh_app_setting_set $app is_public $is_public
sudo yunohost app setting $app architecture -v $architecture ynh_app_setting_set $app architecture $architecture
sudo yunohost app setting $app installed_version -v $seafile_version ynh_app_setting_set $app installed_version $seafile_version
# init databases # init databases
db_user=$app dbuser=seafile
db_pwd=$(openssl rand -hex 15) db_pwd=$(ynh_string_random 15)
sudo yunohost app initdb -d ccnetdb -p $db_pwd $db_user ynh_app_setting_set "$app" mysqlpwd "$db_pwd"
sudo yunohost app initdb -d seafiledb -p $db_pwd $db_user ynh_mysql_create_db ccnetdb "$dbuser" "$db_pwd"
sudo yunohost app initdb -d seahubdb -p $db_pwd $db_user ynh_mysql_create_db seafiledb "$dbuser" "$db_pwd"
sudo yunohost app setting seafile db_pwd -v $db_pwd ynh_mysql_create_db seahubdb "$dbuser" "$db_pwd"
# Run install script # Run install script
sudo chmod +x ../conf/install.exp sudo chmod +x ../conf/install.exp
@ -127,12 +138,12 @@ sudo cp ../conf/first_launch.exp $final_path
sudo chmod +x $final_path/first_launch.exp sudo chmod +x $final_path/first_launch.exp
# Set permissions to seafile directory # Set permissions to seafile directory
sudo chown -R www-data:www-data $final_path sudo chown -R $seafile_user:$seafile_user $final_path
sudo chown -R www-data:www-data $seafile_data sudo chown -R $seafile_user:$seafile_user $seafile_data
# Start seafile, seahub and populate admin account # Start seafile, seahub and populate admin account
sudo su - www-data -s /bin/bash -c "/var/www/seafile/seafile-server-$seafile_version/seafile.sh start" sudo su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-$seafile_version/seafile.sh start"
sudo su - www-data -s /bin/bash -c "$final_path/first_launch.exp $final_path/seafile-server-$seafile_version $admin_email $admin_password" sudo su - $seafile_user -s /bin/bash -c "$final_path/first_launch.exp $final_path/seafile-server-$seafile_version $admin_email $admin_password"
# Add sso config to unprotect domain.tld/seafhttp + domain.tld/seafdav do in /etc/ssowat/conf.json.persistent # Add sso config to unprotect domain.tld/seafhttp + domain.tld/seafdav do in /etc/ssowat/conf.json.persistent
sudo cp ../conf/add_sso_conf.py $final_path sudo cp ../conf/add_sso_conf.py $final_path
@ -140,13 +151,13 @@ sudo cp ../conf/remove_sso_conf.py $final_path
sudo python $final_path/add_sso_conf.py sudo python $final_path/add_sso_conf.py
# unprotect media # unprotect media
sudo yunohost app setting seafile unprotected_uris -v "/media" ynh_app_setting_set seafile unprotected_uris "/media"
if [ "$is_public" = "No" ] if [ "$is_public" = "0" ]
then then
sudo yunohost app setting seafile unprotected_uris -d ynh_app_setting_delete seafile unprotected_uris
else else
sudo yunohost app setting seafile unprotected_uris -v "/" ynh_app_setting_set seafile unprotected_uris "/"
fi fi
# Add logrotate # Add logrotate
@ -162,6 +173,6 @@ sudo service nginx reload
sudo yunohost app ssowatconf sudo yunohost app ssowatconf
# Restart seafile # Restart seafile
sudo su - www-data -s /bin/bash -c "/var/www/seafile/seafile-server-latest/seahub.sh stop" sudo su - $seafile_user -s /bin/bash -c "$final_path/seafile-server-latest/seahub.sh stop"
sudo service seafile-server stop sudo service seafile-server stop
sudo service seafile-server start sudo service seafile-server start

View file

@ -1,13 +1,19 @@
#!/bin/bash #!/bin/bash
domain=$(sudo yunohost app setting seafile domain) domain=$(ynh_app_setting_get seafile domain)
root_pwd=$(sudo cat /etc/yunohost/mysql) root_pwd=$(sudo cat /etc/yunohost/mysql)
# Import common cmd
source ./_common.sh
# Set configuration for user and final path
set_configuration
sudo service seafile-server stop sudo service seafile-server stop
# remove sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent # remove sso config to unprotect domain.tld/seafhttp in /etc/ssowat/conf.json.persistent
sudo python /var/www/seafile/remove_sso_conf.py sudo python $final_path/remove_sso_conf.py
sudo rm -rf /var/www/seafile sudo rm -rf $final_path
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
sudo rm -f /etc/init.d/seafile-server sudo rm -f /etc/init.d/seafile-server
sudo rm -rf /home/yunohost.app/seafile-data sudo rm -rf /home/yunohost.app/seafile-data

View file

@ -2,6 +2,12 @@
set -e set -e
# Import common cmd
source ./_common.sh
# Set configuration for user and final path
set_configuration
# The parameter $1 is the backup directory location dedicated to the app # The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1 BACKUP_DIR=$1
@ -9,23 +15,23 @@ BACKUP_DIR=$1
APP=$2 APP=$2
# retrieve useful param # retrieve useful param
domain=$(sudo yunohost app setting ${APP} domain) domain=$(ynh_app_setting_get ${APP} domain)
db_pwd=$(sudo yunohost app setting ${APP} db_pwd) db_pwd=$(ynh_app_setting_get ${APP} db_pwd)
path=$(sudo yunohost app setting ${APP} path) path=$(ynh_app_setting_get ${APP} path)
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a ${APP} \ sudo yunohost app checkurl $domain$path -a ${APP} \
|| (echo "Path not available: $domain$path" && exit 1) || (echo "Path not available: $domain$path" && ynh_die "Error : path not available")
# Restore dependencies # Restore dependencies
sudo apt-get update sudo apt-get update
sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect sudo apt-get install -qq python2.7 python-setuptools python-simplejson python-imaging python-mysqldb python-flup expect
# Restore app files # Restore app files
final_path=/var/www/${APP} final_path=$final_path
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo cp -a "${BACKUP_DIR}/www/." $final_path sudo cp -a "${BACKUP_DIR}/www/." $final_path
sudo chown -R www-data:www-data $final_path sudo chown -R $seafile_user:$seafile_user $final_path
# Restore conf files # Restore conf files
sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.conf sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.conf
@ -37,7 +43,7 @@ sudo chmod +x /etc/init.d/seafile-server
seafile_data=/home/yunohost.app/seafile-data seafile_data=/home/yunohost.app/seafile-data
mkdir -p $seafile_data mkdir -p $seafile_data
sudo cp -a "${BACKUP_DIR}/data/." /home/yunohost.app/seafile-data/. sudo cp -a "${BACKUP_DIR}/data/." /home/yunohost.app/seafile-data/.
sudo chown -R www-data:www-data $seafile_data sudo chown -R $seafile_user:$seafile_user $seafile_data
# Restore mysql dump # Restore mysql dump
sudo su -c "mysql -u ${APP} -p$db_pwd ccnetdb < ${BACKUP_DIR}/ccnetdb.dmp" sudo su -c "mysql -u ${APP} -p$db_pwd ccnetdb < ${BACKUP_DIR}/ccnetdb.dmp"
@ -58,5 +64,3 @@ sudo yunohost app ssowatconf
# start seafile # start seafile
sudo service seafile-server start sudo service seafile-server start
exit 0

View file

@ -3,15 +3,26 @@
app=seafile app=seafile
# Retrieve settings # Retrieve settings
installed_version=$(sudo yunohost app setting $app installed_version) installed_version=$(ynh_app_setting_get $app installed_version)
architecture=$(sudo yunohost app setting $app architecture) architecture=$(ynh_app_setting_get $app architecture)
root_pwd=$(sudo cat /etc/yunohost/mysql) root_pwd=$(sudo cat /etc/yunohost/mysql)
seafile_version=5.0.3 seafile_version=6.0.6
final_path=/var/www/$app
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Import common cmd
source ./_common.sh
# Set configuration for user and final path
set_configuration
# Download new version from sources
get_source $architecture $seafile_version
# extract new version # extract new version
sudo mkdir -p $final_path/seafile-server-$seafile_version sudo mkdir -p $final_path/seafile-server-$seafile_version
sudo tar xzf ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' sudo tar xzf '/tmp/seafile_src.tar.gz'
sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version
sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' $final_path/installed sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar.gz' $final_path/installed
@ -24,12 +35,15 @@ sudo chmod +x ../conf/upgrade_4.2.1.exp
sudo chmod +x ../conf/upgrade_4.3.2.exp sudo chmod +x ../conf/upgrade_4.3.2.exp
sudo chmod +x ../conf/upgrade_4.4.3.exp sudo chmod +x ../conf/upgrade_4.4.3.exp
sudo chmod +x ../conf/upgrade_5.0.3.exp sudo chmod +x ../conf/upgrade_5.0.3.exp
sudo chmod +x ../conf/upgrade_5.1.exp
sudo chmod +x ../conf/upgrade_6.0.exp
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.0_4.1.sh sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.0_4.1.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.1_4.2.sh sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.1_4.2.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.2_4.3.sh sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.2_4.3.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.3_4.4.sh sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.3_4.4.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.4_5.0.sh sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.4_5.0.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_5.0_5.1.sh
sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_5.1_6.0.sh
# do the upgrade # do the upgrade
case $installed_version in case $installed_version in
"4.0."* ) "4.0."* )
@ -39,6 +53,8 @@ case $installed_version in
sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;; ;;
"4.1."* ) "4.1."* )
# Update seafile by script # Update seafile by script
@ -46,15 +62,31 @@ case $installed_version in
sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_4.3.2.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;; ;;
"4.3."* ) "4.3."* )
# Update seafile by script # Update seafile by script
sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;; ;;
"4.4."* ) "4.4."* )
# Update seafile by script # Update seafile by script
sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd sudo ../conf/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;;
"5.0."* )
# Update seafile by script
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;;
"5.1."* )
# Update seafile by script
sudo ../conf/upgrade_5.1.exp $final_path/seafile-server-$seafile_version $root_pwd
sudo ../conf/upgrade_6.0.exp $final_path/seafile-server-$seafile_version $root_pwd
;; ;;
esac esac
@ -77,17 +109,17 @@ then
findPort 8080 findPort 8080
webdav_port=$port webdav_port=$port
sudo yunohost app setting seafile webdav_port -v $webdav_port ynh_app_setting_set seafile webdav_port $webdav_port
# Disallow port that was used by old seafile client # Disallow port that was used by old seafile client
ccnet_port=$(sudo yunohost app setting $app ccnet_port) ccnet_port=$(ynh_app_setting_get $app ccnet_port)
seafile_port=$(sudo yunohost app setting $app seafile_port) seafile_port=$(ynh_app_setting_get $app seafile_port)
sudo yunohost firewall disallow Both $ccnet_port sudo yunohost firewall disallow Both $ccnet_port
sudo yunohost firewall disallow Both $seafile_port sudo yunohost firewall disallow Both $seafile_port
# Add webdav to nginx config # Add webdav to nginx config
sed -i "s@WEBDAV_PORT@$webdav_port@g" ../conf/nginx_add_webdav sed -i "s@WEBDAV_PORT@$webdav_port@g" ../conf/nginx_add_webdav
domain=$(sudo yunohost app setting seafile domain) domain=$(ynh_app_setting_get seafile domain)
echo $(cat ../conf/nginx_add_webdav) | sudo tee -a /etc/nginx/conf.d/$domain.d/seafile.conf echo $(cat ../conf/nginx_add_webdav) | sudo tee -a /etc/nginx/conf.d/$domain.d/seafile.conf
# Add webdav config # Add webdav config
@ -111,7 +143,7 @@ then
fi fi
# restore correct permissions # restore correct permissions
sudo chown -R www-data:www-data $final_path sudo chown -R $seafile_user:$seafile_user $final_path
# delete seafile cache # delete seafile cache
sudo rm -r /tmp/seahub_cache sudo rm -r /tmp/seahub_cache
@ -124,7 +156,7 @@ sudo rm -f $final_path/installed/seafile-server_$installed_version_$architecture
sudo rm -f $final_path/seafile-server_$installed_version_$architecture sudo rm -f $final_path/seafile-server_$installed_version_$architecture
# store new installed version # store new installed version
sudo yunohost app setting seafile installed_version -v $seafile_version ynh_app_setting_set seafile installed_version -v $seafile_version
# Reload Nginx and regenerate SSOwat conf # Reload Nginx and regenerate SSOwat conf
sudo service nginx reload sudo service nginx reload