Files
albumik_ynh/scripts/restore
2026-05-01 10:22:31 +02:00

20 lines
646 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/_common.sh"
if [ -f "$YNH_BACKUP_DIR/albumik-data.tar.gz" ]; then
tar -C / -xzf "$YNH_BACKUP_DIR/albumik-data.tar.gz"
fi
if [ -f "$YNH_BACKUP_DIR/$app.service" ]; then
cp "$YNH_BACKUP_DIR/$app.service" "$service_file"
fi
if ! id "$app" >/dev/null 2>&1; then
useradd --system --home "$install_dir" --shell /usr/sbin/nologin "$app"
fi
chown -R "$app:$app" "$install_dir" "$data_dir" "$config_dir" 2>/dev/null || true
systemctl daemon-reload
systemctl enable --now "$app"
systemctl reload nginx || true
echo "Albumik restored"