mirror of
https://github.com/YunoHost-Apps/scrumblr_ynh.git
synced 2024-09-03 20:16:29 +02:00
Update restore
This commit is contained in:
parent
1d5155bca5
commit
bfba508932
1 changed files with 26 additions and 31 deletions
|
@ -1,43 +1,38 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
|
||||||
set -eu
|
set -eu
|
||||||
|
# Récupère les infos de l'application.
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Load common variables and functions
|
# Source app helpers
|
||||||
source ./_common
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve old app settings
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
codename=$(ynh_app_setting_get $app codename)
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
||||||
|
|
||||||
# Check domain/path availability
|
# The parameter $1 is the uncompressed restore directory location
|
||||||
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
backup_dir=$1/apps/$app
|
||||||
|| ynh_die "Path not available: ${domain}${path}"
|
|
||||||
|
|
||||||
# Check destination directory
|
# Restore sources & data
|
||||||
[[ -d $DESTDIR ]] && ynh_die \
|
sudo cp -a $backup_dir/sources/. $final_path
|
||||||
"The destination directory '$DESTDIR' already exists.\
|
|
||||||
You should safely delete it before restoring this app."
|
|
||||||
|
|
||||||
# Check configuration files
|
# Restore Nginx and YunoHost parameters
|
||||||
nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
|
||||||
[[ -f $nginx_conf ]] && ynh_die \
|
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
"The NGINX configuration already exists at '${nginx_conf}'.
|
|
||||||
You should safely delete it before restoring this app."
|
|
||||||
|
|
||||||
# backup the app
|
|
||||||
sudo cp -a ./www "$DESTDIR"
|
|
||||||
sudo cp -a ./data/. "$DATA_PATH"
|
|
||||||
# Restore directories and permissions
|
|
||||||
sudo chown -R "$app":"$app" "$DESTDIR" "$DATA_PATH"
|
|
||||||
|
|
||||||
# Restore NGINX configuration
|
# Installation de perlmagick, interface perl pour imagemagick et de carton, gestionnaire de dépendances perl
|
||||||
sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
sudo apt-get update
|
||||||
|
sudo apt-get install npm nodejs nodejs-legacy -qy
|
||||||
|
|
||||||
# Restart webserver and app
|
# Restauration des fichiers du script systemd
|
||||||
sudo systemctl reload nginx.service
|
sudo cp -a $backup_dir/scrumblr.service /etc/systemd/system/scrumblr.service
|
||||||
sudo systemctl start "$app".service
|
## Démarrage auto du service
|
||||||
|
sudo systemctl enable scrumblr.service
|
||||||
|
|
||||||
# Add Scrumblr to YunoHost's monitored services
|
# Restart webserver
|
||||||
sudo yunohost service add "$app" --log /var/log/"$app"/"$app".log
|
sudo service nginx reload
|
||||||
|
|
||||||
|
# Start scrumblr
|
||||||
|
sudo service scrumblr start
|
||||||
|
|
Loading…
Add table
Reference in a new issue