Compare commits

...

5 Commits

Author SHA1 Message Date
Michel Roegl-Brunner
fcb589e0ca
Merge 00e73e369d into 84b982ffa8 2025-01-28 09:22:59 +01:00
community-scripts-pr-app[bot]
84b982ffa8
Update CHANGELOG.md (#1790)
Some checks are pending
Auto Update .app-files / update-app-files (push) Waiting to run
Shellcheck / Shellcheck (push) Waiting to run
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Frontend CI/CD / build (push) Waiting to run
Frontend CI/CD / deploy (push) Blocked by required conditions
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-27 21:42:01 +01:00
Saif
53c7ab19f8
Update frontend alpine-vaultwarden hdd size and OS version (#1789)
* Update alpine-vaultwarden hdd size

* Increase version

---------

Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
2025-01-27 21:41:15 +01:00
Saif
d13c1e5722
Increase default var_disk size (#1788) 2025-01-27 21:38:02 +01:00
Michel Roegl-Brunner
00e73e369d [core]: Create Backup Handler for Updates 2025-01-10 13:52:21 +01:00
4 changed files with 35 additions and 3 deletions

View File

@ -27,10 +27,12 @@ Do not break established syntax in this file, as it is automatically updated by
### 🚀 Updated Scripts ### 🚀 Updated Scripts
- Increase alpine-vaultwarden default var_disk size [@nayzm](https://github.com/nayzm) ([#1788](https://github.com/community-scripts/ProxmoxVE/pull/1788))
- Added change of the mobile GUI to disable nag request [@GarryG](https://github.com/GarryG) ([#1785](https://github.com/community-scripts/ProxmoxVE/pull/1785)) - Added change of the mobile GUI to disable nag request [@GarryG](https://github.com/GarryG) ([#1785](https://github.com/community-scripts/ProxmoxVE/pull/1785))
### 🌐 Website ### 🌐 Website
- Update frontend alpine-vaultwarden hdd size and OS version [@nayzm](https://github.com/nayzm) ([#1789](https://github.com/community-scripts/ProxmoxVE/pull/1789))
- Website: Add Description for Metadata Categories [@MickLesk](https://github.com/MickLesk) ([#1783](https://github.com/community-scripts/ProxmoxVE/pull/1783)) - Website: Add Description for Metadata Categories [@MickLesk](https://github.com/MickLesk) ([#1783](https://github.com/community-scripts/ProxmoxVE/pull/1783))
- [Fix] Double "VM" on website (Arch Linux) [@lasharor](https://github.com/lasharor) ([#1782](https://github.com/community-scripts/ProxmoxVE/pull/1782)) - [Fix] Double "VM" on website (Arch Linux) [@lasharor](https://github.com/lasharor) ([#1782](https://github.com/community-scripts/ProxmoxVE/pull/1782))

View File

@ -9,7 +9,7 @@ APP="Alpine-Vaultwarden"
var_tags="alpine;vault" var_tags="alpine;vault"
var_cpu="1" var_cpu="1"
var_ram="256" var_ram="256"
var_disk="0.3" var_disk="0.5"
var_os="alpine" var_os="alpine"
var_version="3.20" var_version="3.20"
var_unprivileged="1" var_unprivileged="1"

View File

@ -31,9 +31,9 @@
"resources": { "resources": {
"cpu": 1, "cpu": 1,
"ram": 256, "ram": 256,
"hdd": 0.3, "hdd": 0.5,
"os": "alpine", "os": "alpine",
"version": "3.19" "version": "3.20"
} }
} }
], ],

View File

@ -9,6 +9,8 @@ variables() {
var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP. var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP.
INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern. INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern.
PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase
APP_PATH="/opt/$NSAPP" # sets the APP_PATH variable to the path where the application will be installed.
UPDATE="no" # sets the UPDATE variable to "no" to indicate that the script is not in the process of updating.
} }
# This function sets various color variables using ANSI escape codes for formatting text in the terminal. # This function sets various color variables using ANSI escape codes for formatting text in the terminal.
@ -56,6 +58,31 @@ color() {
ADVANCED="${TAB}🧩${TAB}${CL}" ADVANCED="${TAB}🧩${TAB}${CL}"
} }
backup_data() {
UPDATE="yes"
backup_count=$(find /opt/ -maxdepth 1 -type f -name '[0-9]*-*[0-9]*-*[0-9]*.tar.gz' | wc -l)
if [ "$backup_count" -gt 3 ]; then
oldest_file=$(find /opt/ -maxdepth 1 -type f -name '[0-9]*-*[0-9]*-*[0-9]*.tar.gz' | sort | head -n 1)
rm -f "$oldest_file"
fi
APP_PATH=${var_apppath:-$APP_PATH}
msg_ok "Creating Backup [/opt/$(date '+%Y-%m-%d').tar.gz]"
tar -zcf "/opt/$(date '+%Y-%m-%d').tar.gz" "$APP_PATH" &>/dev/null
}
restore_backup() {
latest_file=$(find /opt/ -maxdepth 1 -type f -name '[0-9]*-*[0-9]*-*[0-9]*.tar.gz' | sort -r | head -n 1)
if [[ -n "$latest_file" ]]; then
msg_error "Restoring Backup due to script failure: $latest_file"
rm -rf "${APP_PATH:?}/*"
tar -xzf "$latest_file" -C "$APP_PATH" &>/dev/null
else
msg_error "No tarball found matching the format Y-m-d.tar.gz in /opt/"
fi
}
# This function enables error handling in the script by setting options and defining a trap for the ERR signal. # This function enables error handling in the script by setting options and defining a trap for the ERR signal.
catch_errors() { catch_errors() {
set -Eeuo pipefail set -Eeuo pipefail
@ -66,6 +93,9 @@ catch_errors() {
error_handler() { error_handler() {
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then kill $SPINNER_PID > /dev/null; fi
printf "\e[?25h" printf "\e[?25h"
if [ "$UPDATE" == "yes" ]; then
restore_backup
fi
local exit_code="$?" local exit_code="$?"
local line_number="$1" local line_number="$1"
local command="$2" local command="$2"