mirror of
https://github.com/YunoHost-Apps/kanboard_ynh.git
synced 2024-09-03 19:36:17 +02:00
47 lines
1.1 KiB
Bash
47 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Source local helpers
|
|
source ./_common.sh
|
|
|
|
# Source app helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Abort script if errors
|
|
ynh_abort_if_errors
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Set app specific variables
|
|
dbname=$app
|
|
dbuser=$app
|
|
|
|
# Retrieve old app settings
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
path=$(ynh_app_setting_get "$app" path)
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
final_path=$(ynh_app_setting_get "$app" final_path)
|
|
|
|
# Check web path availability
|
|
ynh_webpath_available "$domain" "$path"
|
|
|
|
# Check destination directory
|
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
|
|
|
# Restore the app files
|
|
ynh_restore_file "$final_path"
|
|
|
|
# Create and restore the database
|
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
|
|
|
|
# Restore permissions
|
|
chown -R root:root "$final_path"
|
|
chown -R www-data ${final_path}/{data,plugins}
|
|
|
|
# Restore configuration files
|
|
ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|
ynh_restore_file "/etc/php5/fpm/pool.d/${app}.conf"
|
|
|
|
# Reload services
|
|
service php5-fpm restart || true
|
|
service nginx reload || true
|