- ct/vm scripts: split to 2-line pattern (variable + source) - func files: remove redundant inline defaults - Only entry points keep the default (ct/*.sh, vm/*.sh, build.func, install.func, alpine-install.func) - Downstream sources use $COMMUNITY_SCRIPTS_URL without default
87 lines
2.7 KiB
Bash
87 lines
2.7 KiB
Bash
#!/usr/bin/env bash
|
|
COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main}"
|
|
source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/build.func")
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: Tom Frenzel (tomfrenzel)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
|
# Source: https://github.com/CodeWithCJ/SparkyFitness
|
|
|
|
APP="SparkyFitness"
|
|
var_tags="${var_tags:-health;fitness}"
|
|
var_cpu="${var_cpu:-2}"
|
|
var_ram="${var_ram:-2048}"
|
|
var_disk="${var_disk:-4}"
|
|
var_os="${var_os:-debian}"
|
|
var_version="${var_version:-13}"
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
function update_script() {
|
|
header_info
|
|
check_container_storage
|
|
check_container_resources
|
|
|
|
if [[ ! -d /opt/sparkyfitness ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
NODE_VERSION="25" setup_nodejs
|
|
PG_VERSION="18" setup_postgresql
|
|
|
|
if check_for_gh_release "sparkyfitness" "CodeWithCJ/SparkyFitness"; then
|
|
msg_info "Stopping Services"
|
|
systemctl stop sparkyfitness-server nginx
|
|
msg_ok "Stopped Services"
|
|
|
|
msg_info "Backing up data"
|
|
mkdir -p "/opt/sparkyfitness_backup"
|
|
if [[ -d "/opt/sparkyfitness/SparkyFitnessServer/uploads" ]]; then
|
|
cp -r "/opt/sparkyfitness/SparkyFitnessServer/uploads" "/opt/sparkyfitness_backup/"
|
|
fi
|
|
if [[ -d "/opt/sparkyfitness/SparkyFitnessServer/backup" ]]; then
|
|
cp -r "/opt/sparkyfitness/SparkyFitnessServer/backup" "/opt/sparkyfitness_backup/"
|
|
fi
|
|
msg_ok "Backed up data"
|
|
|
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "sparkyfitness" "CodeWithCJ/SparkyFitness" "tarball"
|
|
|
|
msg_info "Updating Sparky Fitness Backend"
|
|
cd "/opt/sparkyfitness/SparkyFitnessServer"
|
|
$STD npm install
|
|
msg_ok "Updated Sparky Fitness Backend"
|
|
|
|
msg_info "Updating Sparky Fitness Frontend (Patience)"
|
|
cd "/opt/sparkyfitness/SparkyFitnessFrontend"
|
|
$STD npm install
|
|
$STD npm run build
|
|
cp -a "/opt/sparkyfitness/SparkyFitnessFrontend/dist/." "/var/www/sparkyfitness/"
|
|
msg_ok "Updated Sparky Fitness Frontend"
|
|
|
|
msg_info "Restoring data"
|
|
cp -r "/opt/sparkyfitness_backup/." "/opt/sparkyfitness/SparkyFitnessServer/"
|
|
rm -rf "/opt/sparkyfitness_backup"
|
|
msg_ok "Restored data"
|
|
|
|
msg_info "Starting Services"
|
|
$STD systemctl start sparkyfitness-server nginx
|
|
msg_ok "Started Services"
|
|
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 URL:${CL}"
|
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
|