#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= ynh_script_progression --message="Reinstalling borg env..." install_borg_with_pip #================================================= # CREATE SSH USER USED BY BORG #================================================= ynh_script_progression --message="Making sure SSH user exists with appropriate permissions..." ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app home=/home/$ssh_user mkdir -p $home/.ssh chmod o=--- $home extra="--storage-quota $quota" if [ "$quota" = "" ]; then extra="" fi echo "command=\"borg serve $extra --restrict-to-repository $home/backup\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc $public_key" >> $home/.ssh/authorized_keys chown -R $ssh_user:$ssh_user $home # Tweak to prevent the backup of the backup itself touch $home/.nobackup # Actual restore of ...? ynh_restore #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Restoration completed for $app" --last