Compare commits

...

3 Commits

Author SHA1 Message Date
Michel Roegl-Brunner c247f8a1df Implement backup and restore functions
Added create_backup and restore_backup functions for standardized data backup and restoration.
2026-06-12 10:17:48 +02:00
community-scripts-pr-app[bot] 4cdb2b88f5 Update CHANGELOG.md (#15066)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-06-12 07:28:11 +00:00
push-app-to-main[bot] 94442524f6 Alpine-Cinny (#15044)
* Add alpine-cinny (ct)

* Update install/alpine-cinny-install.sh

Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>

---------

Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com>
Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
2026-06-12 09:27:45 +02:00
5 changed files with 208 additions and 0 deletions
+6
View File
@@ -480,6 +480,12 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-06-12
### 🆕 New Scripts
- Alpine-Cinny ([#15044](https://github.com/community-scripts/ProxmoxVE/pull/15044))
## 2026-06-11
### 🆕 New Scripts
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Tobias Salzmann (Eun)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/cinnyapp/cinny
APP="Alpine-Cinny"
var_tags="${var_tags:-alpine;matrix}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-256}"
var_disk="${var_disk:-1}"
var_os="${var_os:-alpine}"
var_version="${var_version:-3.23}"
var_arm64="${var_arm64:-no}"
var_unprivileged="${var_unprivileged:-1}"
var_nesting="${var_nesting:-0}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
if [[ ! -d /opt/cinny ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "cinny" "cinnyapp/cinny"; then
msg_info "Backing up Configuration"
cp /opt/cinny/config.json /opt/cinny_config.json.bak
msg_ok "Backed up Configuration"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "cinny" "cinnyapp/cinny" "prebuild" "latest" "/opt/cinny" "cinny-*.tar.gz"
msg_info "Restoring Configuration"
cp /opt/cinny_config.json.bak /opt/cinny/config.json
rm -f /opt/cinny_config.json.bak
msg_ok "Restored Configuration"
msg_info "Restarting nginx"
$STD rc-service nginx restart
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following IP:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}"
+6
View File
@@ -0,0 +1,6 @@
___ __ _ _______
/ | / /___ (_)___ ___ / ____(_)___ ____ __ __
/ /| | / / __ \/ / __ \/ _ \______/ / / / __ \/ __ \/ / / /
/ ___ |/ / /_/ / / / / / __/_____/ /___/ / / / / / / / /_/ /
/_/ |_/_/ .___/_/_/ /_/\___/ \____/_/_/ /_/_/ /_/\__, /
/_/ /____/
+50
View File
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Tobias Salzmann (Eun)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/cinnyapp/cinny
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apk add --no-cache nginx
msg_ok "Installed Dependencies"
fetch_and_deploy_gh_release "cinny" "cinnyapp/cinny" "prebuild" "latest" "/opt/cinny" "cinny-*.tar.gz"
msg_info "Configuring Cinny"
cat <<'EOF' >/etc/nginx/http.d/default.conf
server {
listen 8080;
server_name localhost;
location / {
root /opt/cinny;
rewrite ^/config.json$ /config.json break;
rewrite ^/manifest.json$ /manifest.json break;
rewrite ^/sw.js$ /sw.js break;
rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break;
rewrite ^/public/(.*)$ /public/$1 break;
rewrite ^/assets/(.*)$ /assets/$1 break;
rewrite ^(.+)$ /index.html break;
}
}
EOF
$STD rc-update add nginx default
$STD rc-service nginx start
msg_ok "Configured Cinny"
motd_ssh
customize
cleanup_lxc
+88
View File
@@ -1123,6 +1123,94 @@ create_temp_dir() {
echo "$tmp_dir"
}
# ------------------------------------------------------------------------------
# create_backup <path> [<path> ...] / restore_backup
#
# Standardized data backup helpers for update_script(). They replace the
# hand-rolled "cp/mv to a sibling dir, update, copy back, rm" dance that is
# duplicated across the ct/*.sh update functions.
#
# create_backup <path> [<path> ...]
# - Copies each given file/directory into a persistent store at
# /opt/<NSAPP>.backup, mirroring its absolute path inside the store, and
# records it in a manifest so restore_backup needs no arguments.
# - Idempotent: if a store from a previous (failed) run already exists, it is
# left untouched and no new backup is taken. This keeps the last-known-good
# data instead of overwriting it with now-partially-updated data on retry.
# - Missing source paths are skipped with a warning (not fatal).
# - Aborts the update on copy failure: if any file/dir cannot be backed up,
# the half-written store is removed and the script exits, so the update
# never runs against unprotected data (and a retry re-attempts a clean
# backup rather than skipping it).
#
# restore_backup
# - Copies every path recorded in the manifest back to its origin (replacing
# whatever the update left there), then deletes the store.
# - No-op (with a warning) if no store exists.
#
# Override the store location with BACKUP_DIR if the default does not fit.
# ------------------------------------------------------------------------------
create_backup() {
local store manifest path dest
store="${BACKUP_DIR:-/opt/${NSAPP:-app}.backup}"
manifest="${store}/.manifest"
[[ $# -eq 0 ]] && {
msg_warn "create_backup called without any paths"
return 0
}
if [[ -f "$manifest" ]]; then
msg_ok "Existing backup found at ${store}, skipping backup"
return 0
fi
msg_info "Backing up data"
if ! mkdir -p "$store" || ! : >"$manifest"; then
msg_error "Backup failed: could not create store at ${store} - aborting update"
rm -rf "$store"
exit 1
fi
for path in "$@"; do
path="${path%/}"
if [[ ! -e "$path" ]]; then
msg_warn "Skipping backup of '${path}' (not found)"
continue
fi
dest="${store}/files${path}"
if ! mkdir -p "$(dirname "$dest")" || ! cp -a "$path" "$dest"; then
msg_error "Backup of '${path}' failed - aborting update"
rm -rf "$store"
exit 1
fi
echo "$path" >>"$manifest"
done
msg_ok "Backed up data to ${store}"
}
restore_backup() {
local store manifest path src
store="${BACKUP_DIR:-/opt/${NSAPP:-app}.backup}"
manifest="${store}/.manifest"
if [[ ! -f "$manifest" ]]; then
msg_warn "No backup found to restore"
return 0
fi
msg_info "Restoring data"
while IFS= read -r path; do
[[ -z "$path" ]] && continue
src="${store}/files${path}"
[[ -e "$src" ]] || continue
mkdir -p "$(dirname "$path")"
rm -rf "$path"
cp -a "$src" "$path"
done <"$manifest"
rm -rf "$store"
msg_ok "Restored data"
}
# ------------------------------------------------------------------------------
# Check if package is installed (supports both Debian and Alpine)
# ------------------------------------------------------------------------------