#!/bin/bash # Récupère les infos de l'application. app=$YNH_APP_INSTANCE_NAME # Source app helpers source /usr/share/yunohost/helpers domain=$(sudo yunohost app setting $app domain) path=$(sudo yunohost app setting $app path) final_path=$(sudo yunohost app setting $app final_path) if [ -d $final_path ]; then echo "There is already a directory: $final_path " >&2 exit 1 fi # The parameter $1 is the uncompressed restore directory location backup_dir=$1/apps/$app # Restore Nginx conf=/etc/nginx/conf.d/$domain.d/$app.conf if [ -f $conf ]; then echo "There is already a nginx conf file at this path: $conf " >&2 exit 1 fi sudo cp -a $backup_dir/nginx.conf $conf # Restore YunoHost parameters sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app echo "Reinstall dependencies..." wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins -y # Restore sources & data sudo cp -a "$backup_dir/sources/." $final_path # Restauration de la configuration de démarrage de Jenkins sudo cp -a $backup_dir/etc/. /etc/default/$app sudo service $app restart # Redémarre jenkins pour prendre en compte les modifications # Ajoute le service au monitoring de Yunohost. sudo yunohost service add $app --log "/var/log/$app/$app.log" # Reload webserver sudo service nginx reload