use create_backup und restore_backup

This commit is contained in:
MickLesk
2026-08-01 22:35:32 +02:00
parent cb58c616f7
commit 084706a3d5
6 changed files with 30 additions and 51 deletions
+3 -7
View File
@@ -92,16 +92,12 @@ function update() {
fi
msg_ok "Stopped service"
msg_info "Backing up configuration"
cp "$CONFIG_PATH" /tmp/adguardhome-sync.yaml.bak 2>/dev/null || true
msg_ok "Backed up configuration"
BACKUP_DIR="/opt/adguardhome-sync_backup"
create_backup "$CONFIG_PATH"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "adguardhome-sync" "bakito/adguardhome-sync" "prebuild" "latest" "$INSTALL_PATH" "adguardhome-sync_*_linux_amd64.tar.gz"
msg_info "Restoring configuration"
cp /tmp/adguardhome-sync.yaml.bak "$CONFIG_PATH" 2>/dev/null || true
rm -f /tmp/adguardhome-sync.yaml.bak
msg_ok "Restored configuration"
restore_backup
msg_info "Starting service"
if [[ "$OS" == "Alpine" ]]; then
+3 -7
View File
@@ -62,16 +62,12 @@ function update() {
systemctl stop cronmaster.service &>/dev/null || true
msg_ok "Stopped service"
msg_info "Backing up configuration"
cp "$CONFIG_PATH" /tmp/cronmaster.env.bak 2>/dev/null || true
msg_ok "Backed up configuration"
BACKUP_DIR="/opt/cronmaster_backup"
create_backup "$CONFIG_PATH"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "cronmaster" "fccview/cronmaster" "prebuild" "latest" "$INSTALL_PATH" "cronmaster_*_prebuild.tar.gz"
msg_info "Restoring configuration"
cp /tmp/cronmaster.env.bak "$CONFIG_PATH" 2>/dev/null || true
rm -f /tmp/cronmaster.env.bak
msg_ok "Restored configuration"
restore_backup
msg_info "Starting service"
systemctl start cronmaster
-1
View File
@@ -11,7 +11,6 @@ INSTALL_PATH="/usr/local/bin/filebrowser"
CONFIG_PATH="/usr/local/community-scripts/fq-config.yaml"
DEFAULT_PORT=8080
SRC_DIR="/"
TMP_BIN="/tmp/filebrowser.$$"
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
+3 -9
View File
@@ -68,19 +68,13 @@ function update() {
systemctl stop immich-proxy.service &>/dev/null || true
msg_ok "Stopped service"
msg_info "Backing up configuration"
cp "$CONFIG_PATH"/.env /tmp/ipp.env.bak 2>/dev/null || true
cp "$CONFIG_PATH"/config.json /tmp/ipp.config.json.bak 2>/dev/null || true
msg_ok "Backed up configuration"
BACKUP_DIR="/opt/immich-public-proxy_backup"
create_backup "$CONFIG_PATH"/.env "$CONFIG_PATH"/config.json
NODE_VERSION="24" setup_nodejs
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Immich Public Proxy" "alangrainger/immich-public-proxy" "tarball" "latest" "$INSTALL_PATH"
msg_info "Restoring configuration"
cp /tmp/ipp.env.bak "$CONFIG_PATH"/.env 2>/dev/null || true
cp /tmp/ipp.config.json.bak "$CONFIG_PATH"/config.json 2>/dev/null || true
rm -f /tmp/ipp.*.bak
msg_ok "Restored configuration"
restore_backup
msg_info "Installing dependencies"
cd "$CONFIG_PATH"
+3 -7
View File
@@ -87,16 +87,12 @@ function update() {
systemctl stop jellystat.service &>/dev/null || true
msg_ok "Stopped service"
msg_info "Backing up configuration"
cp "$CONFIG_PATH" /tmp/jellystat.env.bak 2>/dev/null || true
msg_ok "Backed up configuration"
BACKUP_DIR="/opt/jellystat_backup"
create_backup "$CONFIG_PATH"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "jellystat" "CyferShepard/Jellystat" "tarball" "latest" "$INSTALL_PATH"
msg_info "Restoring configuration"
cp /tmp/jellystat.env.bak "$CONFIG_PATH" 2>/dev/null || true
rm -f /tmp/jellystat.env.bak
msg_ok "Restored configuration"
restore_backup
msg_info "Installing dependencies"
cd "$INSTALL_PATH"
+18 -20
View File
@@ -112,7 +112,7 @@ function install_php_and_modules() {
function install_phpmyadmin() {
msg_info "Fetching latest phpMyAdmin release from GitHub"
LATEST_VERSION_RAW=$(curl -s https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest | grep tag_name | cut -d '"' -f4)
LATEST_VERSION_RAW=$(curl -fsSL https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest | grep tag_name | cut -d '"' -f4)
LATEST_VERSION=$(echo "$LATEST_VERSION_RAW" | sed -e 's/^RELEASE_//' -e 's/_/./g')
if [[ -z "$LATEST_VERSION" ]]; then
msg_error "Could not determine latest phpMyAdmin version from GitHub falling back to 5.2.2"
@@ -122,13 +122,15 @@ function install_phpmyadmin() {
TARBALL_URL="https://files.phpmyadmin.net/phpMyAdmin/${LATEST_VERSION}/phpMyAdmin-${LATEST_VERSION}-all-languages.tar.gz"
msg_info "Downloading ${TARBALL_URL}"
if ! curl -fsSL "$TARBALL_URL" -o /tmp/phpmyadmin.tar.gz; then
tarball=$(mktemp)
if ! curl -fsSL "$TARBALL_URL" -o "$tarball"; then
msg_error "Download failed: $TARBALL_URL"
exit 115
fi
mkdir -p "$INSTALL_DIR"
tar xf /tmp/phpmyadmin.tar.gz --strip-components=1 -C "$INSTALL_DIR"
tar xf "$tarball" --strip-components=1 -C "$INSTALL_DIR"
rm -f "$tarball"
}
function configure_phpmyadmin() {
@@ -215,7 +217,7 @@ function uninstall_phpmyadmin() {
function update_phpmyadmin() {
msg_info "Fetching latest phpMyAdmin release from GitHub"
LATEST_VERSION_RAW=$(curl -s https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest | grep tag_name | cut -d '"' -f4)
LATEST_VERSION_RAW=$(curl -fsSL https://api.github.com/repos/phpmyadmin/phpmyadmin/releases/latest | grep tag_name | cut -d '"' -f4)
LATEST_VERSION=$(echo "$LATEST_VERSION_RAW" | sed -e 's/^RELEASE_//' -e 's/_/./g')
if [[ -z "$LATEST_VERSION" ]]; then
@@ -226,30 +228,26 @@ function update_phpmyadmin() {
TARBALL_URL="https://files.phpmyadmin.net/phpMyAdmin/${LATEST_VERSION}/phpMyAdmin-${LATEST_VERSION}-all-languages.tar.gz"
msg_info "Downloading ${TARBALL_URL}"
tarball=$(mktemp)
if ! curl -fsSL "$TARBALL_URL" -o /tmp/phpmyadmin.tar.gz; then
if ! curl -fsSL "$TARBALL_URL" -o "$tarball"; then
msg_error "Download failed: $TARBALL_URL"
exit 115
fi
BACKUP_DIR="/tmp/phpmyadmin-backup-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BACKUP_DIR"
BACKUP_ITEMS=("config.inc.php" "upload" "save" "tmp" "themes")
BACKUP_DIR="/opt/phpmyadmin_backup"
create_backup \
"$INSTALL_DIR/config.inc.php" \
"$INSTALL_DIR/upload" \
"$INSTALL_DIR/save" \
"$INSTALL_DIR/tmp" \
"$INSTALL_DIR/themes"
msg_info "Backing up existing phpMyAdmin data"
for item in "${BACKUP_ITEMS[@]}"; do
[[ -e "$INSTALL_DIR/$item" ]] && cp -a "$INSTALL_DIR/$item" "$BACKUP_DIR/" && echo " ↪︎ $item"
done
msg_ok "Backup completed: $BACKUP_DIR"
tar xf /tmp/phpmyadmin.tar.gz --strip-components=1 -C "$INSTALL_DIR"
tar xf "$tarball" --strip-components=1 -C "$INSTALL_DIR"
rm -f "$tarball"
msg_ok "Extracted phpMyAdmin $LATEST_VERSION"
msg_info "Restoring preserved files"
for item in "${BACKUP_ITEMS[@]}"; do
[[ -e "$BACKUP_DIR/$item" ]] && cp -a "$BACKUP_DIR/$item" "$INSTALL_DIR/" && echo " ↪︎ $item restored"
done
msg_ok "Restoration completed"
restore_backup
configure_phpmyadmin
}