LibrePortal/scripts/update/backup/use_git_backup.sh
librelad 92c731952b refactor(de-sudo): update/git backup helpers off raw sudo
The git-update backup helpers operate on the manager-owned $backup_install_dir:
use_git_backup unzip + config_git_check find -> runInstallOp; install_git_backup
standalone find -> runInstallOp (drop the nested -exec sudo rm), and its
cd && find | xargs rm pipeline drops its sudos (manager owns the dir). The
many 'sudo -u $sudo_user_name git/rm/zip' calls stay (already least-privilege).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 17:05:37 +01:00

31 lines
897 B
Bash
Executable File

#!/bin/bash
gitUseExistingBackup()
{
isHeader "Installing LibrePortal Backup"
local backup_file="$1"
local backup_file_without_zip=$(basename "$backup_file" .zip)
update_done=false
local result=$(runInstallOp unzip -o $backup_file -d $backup_install_dir)
checkSuccess "Copy the configs to the backup folder"
gitReset;
local result=$(copyFolders "$backup_install_dir$backup_install_dir/$backup_file_without_zip/" "$docker_dir" "$sudo_user_name")
checkSuccess "Copy the backed up folders back into the installation directory"
gitCleanInstallBackups;
gitUntrackFiles;
isSuccessful "Custom changes have been discarded successfully"
echo ""
isNotice "You have restored the configuration files for LibrePortal."
isNotice "To avoid any issues please rerun the 'libreportal' command."
echo ""
exit
update_done=true
}