This commit is contained in:
Slaviša Arežina
2025-12-13 11:30:06 +01:00
committed by GitHub
parent 52db0d94ed
commit 13cbe0fdbf
2 changed files with 20 additions and 29 deletions

View File

@ -27,32 +27,29 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
RELEASE=$(curl -fsSL https://github.com/Donkie/Spoolman/releases/latest | grep "title>Release" | cut -d " " -f 4)
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
if check_for_gh_release "spoolman" "Donkie/Spoolman"; then
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl stop spoolman systemctl stop spoolman
msg_ok "Stopped Service" msg_ok "Stopped Service"
msg_info "Updating ${APP} to ${RELEASE}" msg_info "Creating Backup"
cd /opt [ -d /opt/spoolman_bak ] && rm -rf /opt/spoolman_bak
rm -rf spoolman_bak mv /opt/spoolman /opt/spoolman_bak
mv spoolman spoolman_bak msg_ok "Created Backup"
curl -fsSL "https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip" -o $(basename "https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip")
$STD unzip spoolman.zip -d spoolman fetch_and_deploy_gh_release "spoolman" "Donkie/Spoolman" "prebuild" "latest" "/opt/spoolman" "spoolman.zip"
cd spoolman
msg_info "Updating Spoolman"
cd /opt/spoolman
$STD pip3 install -r requirements.txt $STD pip3 install -r requirements.txt
curl -fsSL "https://raw.githubusercontent.com/Donkie/Spoolman/master/.env.example" -o ".env" cp /opt/spoolman_bak/.env /opt/spoolman
rm -rf /opt/spoolman.zip msg_ok "Updated Spoolman"
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start spoolman systemctl start spoolman
msg_ok "Started Service" msg_ok "Started Service"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi fi
exit exit
} }

View File

@ -17,12 +17,10 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
build-essential \ build-essential \
make \ libpq-dev
libpq-dev \
ca-certificates
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setup Python3" msg_info "Setting up Python3"
$STD apt install -y \ $STD apt install -y \
python3-dev \ python3-dev \
python3-setuptools \ python3-setuptools \
@ -30,17 +28,13 @@ $STD apt install -y \
python3-pip python3-pip
msg_ok "Setup Python3" msg_ok "Setup Python3"
msg_info "Installing Spoolman" fetch_and_deploy_gh_release "spoolman" "Donkie/Spoolman" "prebuild" "latest" "/opt/spoolman" "spoolman.zip"
RELEASE=$(curl -fsSL https://github.com/Donkie/Spoolman/releases/latest | grep "title>Release" | cut -d " " -f 4)
cd /opt msg_info "Setting up Spoolman"
curl -fsSL "https://github.com/Donkie/Spoolman/releases/download/$RELEASE/spoolman.zip" -o "spoolman.zip" cd /opt/spoolman
$STD unzip spoolman.zip -d spoolman
rm -rf spoolman.zip
cd spoolman
$STD pip3 install --upgrade --ignore-installed -r requirements.txt $STD pip3 install --upgrade --ignore-installed -r requirements.txt
curl -fsSL "https://raw.githubusercontent.com/Donkie/Spoolman/master/.env.example" -o ".env" cp .env.example .env
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup Spoolman"
msg_ok "Installed Spoolman"
msg_info "Creating Service" msg_info "Creating Service"
cat <<'EOF' >/etc/systemd/system/spoolman.service cat <<'EOF' >/etc/systemd/system/spoolman.service