diff --git a/README.md b/README.md index 69cff38..c489e63 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,11 @@ From command line: Upgrade ------- -Not yet available +From command line: + +`sudo yunohost app upgrade -l Seafile https://github.com/mbugeia/seafile_ynh seafile` + +This will install Seafile v4.1.1 with HTTPS Sync only. /!\Not available on ARM for now /!\ Infos ----- diff --git a/conf/upgrade_4.1.1.exp b/conf/upgrade_4.1.1.exp new file mode 100644 index 0000000..67b2fa2 --- /dev/null +++ b/conf/upgrade_4.1.1.exp @@ -0,0 +1,14 @@ +#!/usr/bin/expect +set timeout 5 + +set mysql_password [lindex $argv 0] + +spawn /var/www/seafile/seafile-server-4.1.1/upgrade/upgrade_4.0_4.1.sh + +expect "to contiune" +send "\r"; + +expect "What is the root password for mysql?" +send "$mysql_password\r"; + +interact \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..565dd62 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,48 @@ +#!/bin/bash +app=seafile + +# Retrieve settings +installed_version=$(sudo yunohost app setting $app installed_version) +architecture=$(sudo yunohost app setting $app architecture) +root_pwd=$(sudo cat /etc/yunohost/mysql) +seafile_version=4.1.1 +final_path=/var/www/$app + +# extract new version +sudo mkdir -p $final_path/seafile-server-$seafile_version +sudo tar xzf ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar' +sudo mv seafile-server-$seafile_version/* $final_path/seafile-server-$seafile_version +sudo mv ../sources/'seafile-server_'$seafile_version'_'$architecture'.tar' $final_path/installed + +# stop seafile server +sudo service seafile-server stop + +# permission to execute update script and expect helper +sudo chmod +x ../conf/upgrade_4.1.1.exp +sudo chmod +x $final_path/seafile-server-$seafile_version/upgrade/upgrade_4.0_4.1.sh + +# do the upgrade +sudo ../conf/upgrade_4.1.1.exp $root_pwd + +# restore correct permissions +sudo chown -R www-data:www-data $final_path + +# disallow port that was used by old seafile client +ccnet_port=$(sudo yunohost app setting $app ccnet_port) +seafile_port=$(sudo yunohost app setting $app seafile_port) +sudo yunohost firewall disallow $ccnet_port +sudo yunohost firewall disallow $seafile_port + +# restart seafile server +sudo service seafile-server start + +# remove old version files +sudo rm -f $final_path/installed/seafile-server_$installed_version_$architecture.tar +sudo rm -f $final_path/seafile-server_$installed_version_$architecture + +# store new installed version +sudo yunohost app setting seafile installed_version -v $seafile_version + +# Reload Nginx and regenerate SSOwat conf +sudo service nginx reload +sudo yunohost app ssowatconf \ No newline at end of file diff --git a/sources/seafile-server_4.1.1_i386.tar.REMOVED.git-id b/sources/seafile-server_4.1.1_i386.tar.REMOVED.git-id new file mode 100644 index 0000000..44327ba --- /dev/null +++ b/sources/seafile-server_4.1.1_i386.tar.REMOVED.git-id @@ -0,0 +1 @@ +8af778d2df71d4b757dc748c98199a8df823a7da \ No newline at end of file diff --git a/sources/seafile-server_4.1.1_x86-64.tar.REMOVED.git-id b/sources/seafile-server_4.1.1_x86-64.tar.REMOVED.git-id new file mode 100644 index 0000000..96c4c52 --- /dev/null +++ b/sources/seafile-server_4.1.1_x86-64.tar.REMOVED.git-id @@ -0,0 +1 @@ +db8a74bd09e625ba9664e150543a650d84597693 \ No newline at end of file