2015-12-26 14:14:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2017-01-28 18:51:23 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
2017-01-28 18:51:23 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Import common cmd
|
|
|
|
source ../settings/scripts/_common.sh
|
2017-02-28 13:24:18 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Init get Final path
|
|
|
|
get_configuration
|
2017-01-05 23:24:32 +01:00
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-07-21 14:56:41 +02:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
path=$(ynh_normalize_url_path $(ynh_app_setting_get $app path))
|
|
|
|
db_pwd=$(ynh_app_setting_get ${app} mysqlpwd)
|
2017-01-05 23:24:32 +01:00
|
|
|
final_path=/var/www/$app
|
|
|
|
seafile_user=www-data
|
2015-12-26 14:14:31 +01:00
|
|
|
|
|
|
|
# Check domain/path availability
|
2017-07-21 14:56:41 +02:00
|
|
|
ynh_webpath_available $domain $path || ynh_die "$domain/$path is not available, please use an other domain or path."
|
2015-12-26 14:14:31 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Restore dependencies
|
|
|
|
install_dependance
|
|
|
|
|
|
|
|
# Restore all config and data
|
|
|
|
ynh_restore
|
2015-12-26 14:14:31 +01:00
|
|
|
|
|
|
|
# Restore mysql dump
|
2017-01-31 23:25:17 +01:00
|
|
|
dbuser=seafile
|
|
|
|
ynh_mysql_create_db ccnetdb "$dbuser" "$db_pwd"
|
|
|
|
ynh_mysql_create_db seafiledb "$dbuser" "$db_pwd"
|
|
|
|
ynh_mysql_create_db seahubdb "$dbuser" "$db_pwd"
|
2017-07-21 14:56:41 +02:00
|
|
|
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 seahubdb < ${YNH_CWD}/seahubdb.dmp"
|
2016-02-08 02:06:58 +01:00
|
|
|
|
|
|
|
# Restore sso persistent config
|
2017-07-21 14:56:41 +02:00
|
|
|
python $final_path/add_sso_conf.py
|
|
|
|
|
|
|
|
# Add logrotate
|
|
|
|
ynh_use_logrotate $final_path/logs/seaf-server.log
|
|
|
|
ynh_use_logrotate $final_path/logs/ccnet.log
|
2015-12-26 14:14:31 +01:00
|
|
|
|
|
|
|
# Add Seafile to YunoHost's monitored services
|
2017-07-21 14:56:41 +02:00
|
|
|
yunohost service add seafile-server
|
2015-12-26 14:14:31 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Reload nginx
|
|
|
|
systemctl reload nginx.service
|
2015-12-26 14:14:31 +01:00
|
|
|
|
2017-08-09 15:34:10 +02:00
|
|
|
# Enable service and start seafile
|
|
|
|
systemctl daemon-reload
|
|
|
|
update-rc.d seafile-server defaults
|
2017-07-21 14:56:41 +02:00
|
|
|
systemctl start seafile-server.service
|