mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
58 lines
1.6 KiB
Bash
58 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
# Récupère les infos de l'application.
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
# Source app helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
codename=$(ynh_app_setting_get $app codename)
|
|
|
|
# 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
|
|
|
|
|
|
# Installation de perlmagick, interface perl pour imagemagick et de carton, gestionnaire de dépendances perl
|
|
sudo apt-get update
|
|
sudo apt-get install carton perlmagick -qy
|
|
|
|
|
|
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
|
|
## Démarrage auto du service
|
|
sudo update-rc.d lutim defaults
|
|
else
|
|
# Restauration des fichiers du script systemd
|
|
sudo cp -a $backup_dir/lutim.service /etc/systemd/system/lutim.service
|
|
## Démarrage auto du service
|
|
sudo systemctl enable lutim.service
|
|
fi
|
|
|
|
|
|
# Restauration du fichier du cron
|
|
sudo cp -a $backup_dir/cron_$app /etc/cron.d/$app
|
|
|
|
# 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
|
|
# Restaure la configuration de logrotate
|
|
sudo cp -a $backup_dir/logrotate /etc/logrotate.d/$app
|
|
|
|
# Restart webserver
|
|
sudo service nginx reload
|
|
|
|
# Start lutim
|
|
sudo service lutim start
|