LibrePortal/scripts/install/install_restic.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

43 lines
1.1 KiB
Bash

#!/bin/bash
installResticHost()
{
if ! command -v restic >/dev/null 2>&1; then
isHeader "Installing restic backup engine"
resticInstall
fi
installResticMigrateLegacyPasswords
if declare -f backupLocationsMigrate >/dev/null 2>&1; then
backupLocationsMigrate
fi
if [[ -n "$(resticEnabledLocations)" ]]; then
engineInitAllLocations
else
isNotice "No locations enabled — skipping init. Add one via the Locations page to start."
fi
}
installResticMigrateLegacyPasswords()
{
local pass_dir="/docker/configs/security/restic"
[[ ! -d "$pass_dir" ]] && return 0
declare -A legacy_map=(
[local]=1
[remote_1]=2
[remote_2]=3
)
local old new
for old in "${!legacy_map[@]}"; do
local new="${legacy_map[$old]}"
if [[ -f "$pass_dir/${old}.pass" && ! -f "$pass_dir/loc_${new}.pass" ]]; then
sudo mv "$pass_dir/${old}.pass" "$pass_dir/loc_${new}.pass"
isNotice "Migrated legacy password ${old}.pass → loc_${new}.pass"
fi
done
}