2015-11-18 00:28:42 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Récupère les infos de l'application.
|
2016-08-05 16:59:55 +02:00
|
|
|
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2) # Récupère le numéro de version de Yunohost.
|
2016-11-08 13:33:28 +01:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2015-11-18 00:28:42 +01:00
|
|
|
final_path=$(sudo yunohost app setting $app final_path)
|
|
|
|
domain=$(sudo yunohost app setting $app domain)
|
2016-03-31 22:41:54 +02:00
|
|
|
codename=$(sudo yunohost app setting $app codename)
|
2015-11-18 00:28:42 +01:00
|
|
|
|
|
|
|
# The parameter $1 is the uncompressed restore directory location
|
|
|
|
backup_dir=$1/apps/$app
|
|
|
|
|
|
|
|
# Restore sources & data
|
|
|
|
sudo cp -a $backup_dir/sources/. $final_path
|
|
|
|
|
|
|
|
# Restore Nginx and YunoHost parameters
|
|
|
|
sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app
|
|
|
|
sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
|
|
|
|
|
2016-03-31 22:41:54 +02:00
|
|
|
if [ "$codename" = "wheezy" ]
|
|
|
|
then
|
|
|
|
# Restauration des fichiers du script init
|
|
|
|
sudo cp -a $backup_dir/init.d_lutim /etc/init.d/lutim
|
|
|
|
sudo cp -a $backup_dir/default_lutim /etc/default/lutim
|
2016-08-05 16:59:55 +02:00
|
|
|
## Démarrage auto du service
|
|
|
|
sudo update-rc.d lutim defaults
|
2016-03-31 22:41:54 +02:00
|
|
|
else
|
|
|
|
# Restauration des fichiers du script systemd
|
|
|
|
sudo cp -a $backup_dir/lutim.service /etc/systemd/system/lutim.service
|
2016-08-05 16:59:55 +02:00
|
|
|
## Démarrage auto du service
|
|
|
|
sudo systemctl enable lutim.service
|
2016-03-31 22:41:54 +02:00
|
|
|
fi
|
2015-11-18 00:28:42 +01:00
|
|
|
|
2016-08-05 16:59:55 +02:00
|
|
|
|
2015-11-18 00:28:42 +01:00
|
|
|
# Restauration du fichier du cron
|
|
|
|
sudo cp -a $backup_dir/cron_$app /etc/cron.d/$app
|
|
|
|
|
2016-08-05 16:59:55 +02:00
|
|
|
# Making log symbolic link to /var/log
|
|
|
|
sudo mkdir -p /var/log/$app/
|
|
|
|
sudo touch /var/log/$app/production.log
|
|
|
|
sudo chown www-data: /var/log/$app/production.log
|
2016-05-15 11:36:31 +02:00
|
|
|
# Restaure la configuration de logrotate
|
|
|
|
sudo cp -a $backup_dir/logrotate /etc/logrotate.d/$app
|
|
|
|
|
2015-11-18 00:28:42 +01:00
|
|
|
# Restart webserver
|
|
|
|
sudo service nginx reload
|
2016-08-05 16:59:55 +02:00
|
|
|
|
|
|
|
# Start lutim
|
|
|
|
sudo service lutim start
|