1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/borgserver_ynh.git synced 2024-09-03 20:36:20 +02:00
borgserver_ynh/scripts/restore
2024-08-12 15:38:08 +02:00

43 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the user and SSH configuration..." --weight=1
ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app
mkdir -p "/home/$ssh_user"
chmod 700 "/home/$ssh_user"
chown "$ssh_user" "/home/$ssh_user"
ynh_restore_file --origin_path="/home/$ssh_user/.ssh"
ynh_restore_file --origin_path="/home/$ssh_user/.nobackup"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last