mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Update to seafile 6.0.7 and fix bugs
This commit is contained in:
parent
37da57a94d
commit
eb1f757b21
8 changed files with 132 additions and 72 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -221,3 +221,4 @@ pip-log.txt
|
||||||
# From kateproject
|
# From kateproject
|
||||||
.kateproject
|
.kateproject
|
||||||
.kateproject.d
|
.kateproject.d
|
||||||
|
.directory
|
||||||
|
|
|
@ -70,9 +70,15 @@ sudo adduser seafile --disabled-login --ingroup seafile --system --quiet --shell
|
||||||
# Adapt configuration
|
# Adapt configuration
|
||||||
sudo sed -i "s@user=www-data@user=seafile@g" /etc/init.d/seafile-server
|
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@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
|
sudo sed -i "s@alias /var/www/seafile/@alias /opt/yunohost/seafile/@g" /etc/nginx/conf.d/$(sudo yunohost app setting seafile domain).d/seafile.conf
|
||||||
|
|
||||||
|
# Set the good user for seafile
|
||||||
|
sudo chown seafile:seafile -R /opt/yunohost/seafile
|
||||||
|
sudo chown seafile:seafile -R /home/yunohost.app/seafile-data/
|
||||||
|
|
||||||
# Restart services
|
# Restart services
|
||||||
|
sudo rm -rf /tmp/seahub_cache
|
||||||
|
sudo systemctl daemon-reload
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo service seafile-server start
|
sudo service seafile-server start
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,11 +1,39 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
seafile_version=6.0.7
|
||||||
|
|
||||||
|
## Adapt md5sum while you update app
|
||||||
|
x86_64sum="4ca3c1fc93e5b786eb5d3509f4a3b01a"
|
||||||
|
i386sum="743565be00189698318c8def0fbdaac0"
|
||||||
|
armsum="ee3ef5330a51498faf861594e0fe744a"
|
||||||
|
|
||||||
|
init_script() {
|
||||||
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
}
|
||||||
|
|
||||||
|
correct_path() {
|
||||||
|
if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then
|
||||||
|
path="/$path"
|
||||||
|
fi
|
||||||
|
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
||||||
|
path="${path:0:${#path}-1}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set_configuration() {
|
set_configuration() {
|
||||||
if [[ -e /var/www/$app ]]
|
if [[ -e /var/www/$app ]]
|
||||||
then
|
then
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
seafile_user=www-data
|
seafile_user=www-data
|
||||||
elif [[ -e /opt/yunohost/$app ]]
|
elif [[ -e /opt/yunohost/$app ]]
|
||||||
|
then
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
seafile_user=seafile
|
seafile_user=seafile
|
||||||
else
|
else
|
||||||
|
@ -13,16 +41,21 @@ set_configuration() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get_source() {
|
get_source() {
|
||||||
if [[ $1 == 'arm' ]]
|
if [[ $1 == 'arm' ]]
|
||||||
then
|
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'
|
wget -q -O '/tmp/seafile_src.tar.gz' 'https://github.com/haiwen/seafile-rpi/releases/download/v'$2'/seafile-server_'$2'_stable_pi.tar.gz'
|
||||||
|
md5sum=$armsum
|
||||||
|
elif [[ $1 == 'x86-64' ]]
|
||||||
|
then
|
||||||
|
wget -q -O '/tmp/seafile_src.tar.gz' 'https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_'$2'_x86-64.tar.gz'
|
||||||
|
md5sum=$x86_64sum
|
||||||
else
|
else
|
||||||
wget -O '/tmp/seafile_src.tar.gz' 'https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_'$1'_'$2'.tar.gz'
|
wget -q -O '/tmp/seafile_src.tar.gz' 'https://bintray.com/artifact/download/seafile-org/seafile/seafile-server_'$2'_i386.tar.gz'
|
||||||
|
md5sum=$i386sum
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e '/tmp/seafile_src.tar.gz' ]]
|
if [[ ! -e '/tmp/seafile_src.tar.gz' ]] || [[ $(md5sum '/tmp/seafile_src.tar.gz' | cut -d' ' -f1) != $md5sum ]]
|
||||||
then
|
then
|
||||||
ynh_die "Error : can't get seafile source"
|
ynh_die "Error : can't get seafile source"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Set configuration for user and final path
|
# Set configuration for user and final path
|
||||||
set_configuration
|
set_configuration
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
app=seafile
|
|
||||||
|
|
||||||
# Retrieve arguments
|
|
||||||
domain=$1
|
|
||||||
path=$2
|
|
||||||
server_name=$3
|
|
||||||
admin=$4
|
|
||||||
admin_password=$5
|
|
||||||
is_public=$6
|
|
||||||
architecture=$7
|
|
||||||
seafile_data=/home/yunohost.app/seafile-data
|
|
||||||
seafile_version=6.0.4
|
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Set configuration for user and final path
|
# Init script
|
||||||
set_configuration
|
init_script
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
path=$YNH_APP_ARG_PATH
|
||||||
|
server_name=$YNH_APP_ARG_SERVER_NAME
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
admin_password=$YNH_APP_ARG_ADMIN_PASSWORD
|
||||||
|
is_public=$YNH_APP_ARG_PUBLIC_SITE
|
||||||
|
architecture=$YNH_APP_ARG_ARCHITECTURE
|
||||||
|
seafile_data=/home/yunohost.app/seafile-data
|
||||||
|
final_path=/var/www/$app
|
||||||
|
seafile_user=www-data
|
||||||
|
|
||||||
|
# Correct path if it is not correct
|
||||||
|
correct_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" && ynh_die "Error : path not available")
|
|| ynh_die "Path not available: ${domain}${path}"
|
||||||
|
|
||||||
# Download new version from sources
|
# Download new version from sources
|
||||||
get_source $architecture $seafile_version
|
get_source $architecture $seafile_version
|
||||||
|
@ -36,14 +35,9 @@ port=''
|
||||||
findPort () {
|
findPort () {
|
||||||
port=$1
|
port=$1
|
||||||
|
|
||||||
sudo yunohost app checkport $port
|
while ! sudo yunohost app checkport $port ; do
|
||||||
while [[ ! $? -eq 0 ]]
|
port=$(($port + 1))
|
||||||
do
|
done
|
||||||
port=$(($port + 1))
|
|
||||||
sudo yunohost app checkport $port
|
|
||||||
done
|
|
||||||
|
|
||||||
return $port
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
|
@ -51,6 +45,8 @@ 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
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
|
test -e $final_path && sudo rm -rf "$final_path"
|
||||||
|
test -e $seafile_data && sudo rm -rf "$seafile_data"
|
||||||
sudo mkdir -p $final_path
|
sudo mkdir -p $final_path
|
||||||
sudo mkdir -p $final_path/installed
|
sudo mkdir -p $final_path/installed
|
||||||
sudo mkdir -p $final_path/logs
|
sudo mkdir -p $final_path/logs
|
||||||
|
@ -58,7 +54,7 @@ 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 '/tmp/seafile_src.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 '/tmp/seafile_src.tar.gz' $final_path/installed/seafile-server_${seafile_version}.tar.gz
|
||||||
|
|
||||||
# Find available ports
|
# Find available ports
|
||||||
findPort 8000
|
findPort 8000
|
||||||
|
@ -98,6 +94,7 @@ echo 'SERVE_STATIC = False' | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
echo 'MEDIA_URL = "'$path'/media/"' | sudo tee -a $final_path/conf/seahub_settings.py
|
echo 'MEDIA_URL = "'$path'/media/"' | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
echo 'COMPRESS_URL = MEDIA_URL' | sudo tee -a $final_path/conf/seahub_settings.py
|
echo 'COMPRESS_URL = MEDIA_URL' | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
echo "STATIC_URL = MEDIA_URL + 'assets/'" | sudo tee -a $final_path/conf/seahub_settings.py
|
echo "STATIC_URL = MEDIA_URL + 'assets/'" | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
|
echo "LOGIN_URL = '"$path"/accounts/login/'" | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
|
|
||||||
# Email configuration
|
# Email configuration
|
||||||
echo 'EMAIL_USE_TLS = False' | sudo tee -a $final_path/conf/seahub_settings.py
|
echo 'EMAIL_USE_TLS = False' | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
|
|
|
@ -1,26 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
domain=$(ynh_app_setting_get seafile domain)
|
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Set configuration for user and final path
|
# Init script
|
||||||
set_configuration
|
init_script
|
||||||
|
|
||||||
sudo service seafile-server stop
|
sudo service seafile-server stop || true
|
||||||
|
|
||||||
# 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 $final_path/remove_sso_conf.py
|
test -e /var/www/$app/remove_sso_conf.py && sudo python /var/www/$app/remove_sso_conf.py
|
||||||
|
test -e /opt/yunohost/$app/remove_sso_conf.py && sudo python /opt/yunohost/$app/remove_sso_conf.py
|
||||||
sudo rm -rf $final_path
|
sudo rm -rf /var/www/$app
|
||||||
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
|
sudo rm -rf /opt/yunohost/$app
|
||||||
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
|
||||||
sudo rm -r /tmp/seahub_cache
|
sudo rm -rf /tmp/seahub_cache
|
||||||
|
|
||||||
# Remove databases
|
# Remove databases
|
||||||
mysql -u root -p$root_pwd -e "DROP DATABASE ccnetdb ; DROP DATABASE seafiledb ; DROP DATABASE seahubdb ; DROP USER seafile@localhost ;"
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
mysql -u root -p$root_pwd -e "DROP DATABASE ccnetdb ; DROP DATABASE seafiledb ; DROP DATABASE seahubdb ; DROP USER seafile@localhost ;" || true
|
||||||
|
|
||||||
|
# Remove domain config
|
||||||
|
domain=$(ynh_app_setting_get seafile domain)
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf
|
||||||
|
|
||||||
sudo yunohost service remove seafile-server
|
sudo yunohost service remove seafile-server
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Set configuration for user and final path
|
# Init script
|
||||||
set_configuration
|
init_script
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
final_path=/var/www/$app
|
||||||
|
seafile_user=www-data
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -19,10 +21,13 @@ domain=$(ynh_app_setting_get ${APP} domain)
|
||||||
db_pwd=$(ynh_app_setting_get ${APP} db_pwd)
|
db_pwd=$(ynh_app_setting_get ${APP} db_pwd)
|
||||||
path=$(ynh_app_setting_get ${APP} path)
|
path=$(ynh_app_setting_get ${APP} path)
|
||||||
|
|
||||||
|
# Correct path if it is not correct
|
||||||
|
correct_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" && ynh_die "Error : path not available")
|
|| (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
|
||||||
|
|
|
@ -1,33 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
app=seafile
|
|
||||||
|
|
||||||
# Retrieve settings
|
|
||||||
installed_version=$(ynh_app_setting_get $app installed_version)
|
|
||||||
architecture=$(ynh_app_setting_get $app architecture)
|
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
|
||||||
seafile_version=6.0.6
|
|
||||||
|
|
||||||
# Source YunoHost helpers
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
# Import common cmd
|
# Import common cmd
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
# Init script
|
||||||
|
init_script
|
||||||
|
|
||||||
|
# Retrieve settings
|
||||||
|
installed_version=$(ynh_app_setting_get $app installed_version)
|
||||||
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
|
architecture=$(ynh_app_setting_get $app architecture)
|
||||||
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
|
||||||
|
# Correct path if it is not correct
|
||||||
|
correct_path
|
||||||
|
|
||||||
# Set configuration for user and final path
|
# Set configuration for user and final path
|
||||||
set_configuration
|
set_configuration
|
||||||
|
|
||||||
# Download new version from sources
|
# Download new version from sources
|
||||||
get_source $architecture $seafile_version
|
get_source $architecture $seafile_version
|
||||||
|
|
||||||
|
# stop seafile server
|
||||||
|
sudo service seafile-server stop
|
||||||
|
|
||||||
# extract new version
|
# extract new version
|
||||||
|
test -e $final_path/seafile-server-$seafile_version && sudo rm -rf "$final_path/seafile-server-$seafile_version"
|
||||||
sudo mkdir -p $final_path/seafile-server-$seafile_version
|
sudo mkdir -p $final_path/seafile-server-$seafile_version
|
||||||
sudo tar xzf '/tmp/seafile_src.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 '/tmp/seafile_src.tar.gz' $final_path/installed/seafile-server_${seafile_version}.tar.gz
|
||||||
|
|
||||||
# stop seafile server
|
|
||||||
sudo service seafile-server stop
|
|
||||||
|
|
||||||
# permission to execute update script and expect helper
|
# permission to execute update script and expect helper
|
||||||
sudo chmod +x ../conf/upgrade_4.1.1.exp
|
sudo chmod +x ../conf/upgrade_4.1.1.exp
|
||||||
|
@ -133,8 +135,8 @@ then
|
||||||
sudo python $final_path/add_sso_conf_webdav.py
|
sudo python $final_path/add_sso_conf_webdav.py
|
||||||
|
|
||||||
# Update seafile config
|
# Update seafile config
|
||||||
echo 'COMPRESS_URL = MEDIA_URL' | sudo tee -a $final_path/seahub_settings.py
|
echo 'COMPRESS_URL = MEDIA_URL' | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
echo "STATIC_URL = MEDIA_URL + 'assets/'" | sudo tee -a $final_path/seahub_settings.py
|
echo "STATIC_URL = MEDIA_URL + 'assets/'" | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
|
|
||||||
# Add logrotate
|
# Add logrotate
|
||||||
sudo cp ../conf/logrotate /etc/logrotate.d/seafile
|
sudo cp ../conf/logrotate /etc/logrotate.d/seafile
|
||||||
|
@ -142,21 +144,27 @@ then
|
||||||
sudo service rsyslog restart
|
sudo service rsyslog restart
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update seahub config for old version to version 5.0.4
|
||||||
|
if [[ $(sudo grep -c "LOGIN_URL" $final_path/conf/seahub_settings.py) == 0 ]]
|
||||||
|
then
|
||||||
|
echo "LOGIN_URL = '"$path"/accounts/login/'" | sudo tee -a $final_path/conf/seahub_settings.py
|
||||||
|
fi
|
||||||
|
|
||||||
# restore correct permissions
|
# restore correct permissions
|
||||||
sudo chown -R $seafile_user:$seafile_user $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 -rf /tmp/seahub_cache
|
||||||
|
|
||||||
# restart seafile server
|
# restart seafile server
|
||||||
sudo service seafile-server start
|
sudo service seafile-server start
|
||||||
|
|
||||||
# remove old version files
|
# remove old version files
|
||||||
sudo rm -f $final_path/installed/seafile-server_$installed_version_$architecture.tar*
|
sudo rm -f $final_path/installed/seafile-server_${installed_version}*.tar*
|
||||||
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
|
||||||
ynh_app_setting_set seafile installed_version -v $seafile_version
|
ynh_app_setting_set $app installed_version $seafile_version
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
|
Loading…
Reference in a new issue