97 lines
2.9 KiB
Bash
97 lines
2.9 KiB
Bash
#!/usr/bin/env bash
|
|
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
|
# Copyright (c) 2021-2025 community-scripts ORG
|
|
# Author: GitHub Copilot
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/Dictionarry-Hub/profilarr
|
|
|
|
# App Default Values
|
|
APP="Profilarr"
|
|
var_tags="arr;automation"
|
|
var_cpu="2"
|
|
var_ram="2048"
|
|
var_disk="8"
|
|
var_os="debian"
|
|
var_version="12"
|
|
var_unprivileged="1"
|
|
|
|
header_info "$APP"
|
|
variables
|
|
color
|
|
catch_errors
|
|
|
|
function update_script() {
|
|
header_info
|
|
check_container_storage
|
|
check_container_resources
|
|
|
|
# Check if installation is present
|
|
if [[ ! -d /opt/${APP}/backend ]]; then
|
|
msg_error "No ${APP} Installation Found!"
|
|
exit
|
|
fi
|
|
|
|
# Crawling the new version and checking whether an update is required
|
|
RELEASE=$(curl -fsSL https://api.github.com/repos/Dictionarry-Hub/profilarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
|
|
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
|
# Stopping Services
|
|
msg_info "Stopping $APP"
|
|
systemctl stop profilarr
|
|
msg_ok "Stopped $APP"
|
|
|
|
# Creating Backup
|
|
msg_info "Creating Backup"
|
|
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" /opt/${APP} /opt/${APP}_config
|
|
msg_ok "Backup Created"
|
|
|
|
# Execute Update
|
|
msg_info "Updating $APP to v${RELEASE}"
|
|
temp_file=$(mktemp)
|
|
curl -fsSL -o "$temp_file" "https://github.com/Dictionarry-Hub/profilarr/archive/refs/tags/v${RELEASE}.zip"
|
|
cd /tmp
|
|
unzip -q "$temp_file"
|
|
rm -rf /opt/${APP}/backend /opt/${APP}/frontend
|
|
mv "profilarr-${RELEASE}/backend" /opt/${APP}/
|
|
mv "profilarr-${RELEASE}/frontend" /opt/${APP}/
|
|
|
|
# Update Python dependencies
|
|
cd /opt/${APP}/backend
|
|
/opt/${APP}/venv/bin/pip install -r requirements.txt
|
|
|
|
# Build frontend
|
|
cd /opt/${APP}/frontend
|
|
npm install
|
|
npm run build
|
|
cp -r dist/* /opt/${APP}/backend/app/static/
|
|
|
|
msg_ok "Updated $APP to v${RELEASE}"
|
|
|
|
# Starting Services
|
|
msg_info "Starting $APP"
|
|
systemctl start profilarr
|
|
msg_ok "Started $APP"
|
|
|
|
# Cleaning up
|
|
msg_info "Cleaning Up"
|
|
rm -f "$temp_file"
|
|
rm -rf "/tmp/profilarr-${RELEASE}"
|
|
msg_ok "Cleanup Completed"
|
|
|
|
# Last Action
|
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
msg_ok "Update Successful"
|
|
else
|
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
|
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}:6868${CL}"
|