LibrePortal/scripts/backup/engine/restic_dump.sh
librelad 0b27ed1072 refactor(desudo): funnel backup-engine privilege drop through runBackupOp
The borg/restic/kopia engines all dropped to the dedicated backup user
via scattered 'sudo -E -u $docker_install_user'. Centralize that into a
single runBackupOp helper so the backup subsystem has one audit point and
the scoped sudoers needs only the (dockerinstall) drop rule.

Also:
- owncloud config heredoc tees -> runSystem (container-UID file)
- webui_display_logins: fix the broken 'command -v sudo sqlite3' guard
  to 'command -v sqlite3' (body already runs sqlite3 via runInstallOp)

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

21 lines
433 B
Bash

#!/bin/bash
resticDumpFile()
{
local idx="$1"
local snapshot_id="$2"
local file_path="$3"
local target_file="$4"
resticEnvExport "$idx" || return 1
if [[ -n "$target_file" ]]; then
runBackupOp restic dump "$snapshot_id" "$file_path" | sudo tee "$target_file" >/dev/null
else
runBackupOp restic dump "$snapshot_id" "$file_path"
fi
local rc=$?
resticEnvUnset
return $rc
}