mirror of
https://github.com/tteck/Proxmox.git
synced 2026-07-04 21:22:39 +02:00
Compare commits
5 Commits
26ab8e01ee
...
7d2c5b15b3
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d2c5b15b3 | |||
| 1cba847c0c | |||
| 1f2e451b40 | |||
| 991ef1b734 | |||
| c34c0afa82 |
+12
-15
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
|
||||
# Copyright (c) 2021-2024 tteck
|
||||
# Author: MickLesk (Canbiz)
|
||||
# Author: tteck
|
||||
# Co-Author: MickLesk (Canbiz)
|
||||
# License: MIT
|
||||
# https://github.com/tteck/Proxmox/raw/main/LICENSE
|
||||
|
||||
@@ -59,41 +60,37 @@ if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
|
||||
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
|
||||
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
|
||||
fi
|
||||
RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
|
||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||
|
||||
msg_info "Stopping ${APP} Service"
|
||||
systemctl stop spoolman
|
||||
msg_ok "Stopped ${APP} Service"
|
||||
|
||||
msg_info "Updating ${APP} to latest Git"
|
||||
RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
|
||||
msg_info "Updating ${APP} to ${RELEASE}"
|
||||
cd /opt
|
||||
if [ -d spoolman_bak ]; then
|
||||
rm -rf spoolman_bak
|
||||
fi
|
||||
mv spoolman spoolman_bak
|
||||
wget -q https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip
|
||||
unzip -q spoolman.zip -d spoolman
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
cd spoolman
|
||||
python3 -m venv .venv >/dev/null 2>&1
|
||||
source .venv/bin/activate >/dev/null 2>&1
|
||||
pip3 install -r requirements.txt >/dev/null 2>&1
|
||||
cp .env.example .env
|
||||
chmod +x scripts/*.sh
|
||||
msg_ok "Updated ${APP} to latest Git"
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated ${APP} to ${RELEASE}"
|
||||
|
||||
msg_info "Starting ${APP} Service"
|
||||
systemctl start spoolman
|
||||
sleep 1
|
||||
msg_ok "Started ${APP} Service"
|
||||
|
||||
msg_info "Cleaning up"
|
||||
if [ -d "/opt/spoolman_bak" ]; then
|
||||
rm -rf /opt/spoolman_bak
|
||||
rm -rf /opt/spoolman.zip
|
||||
fi
|
||||
msg_ok "Cleaning up Successfully!"
|
||||
msg_ok "Cleaned"
|
||||
|
||||
msg_ok "Updated Successfully!\n"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -16,42 +16,36 @@ network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y --no-install-recommends \
|
||||
$STD apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
unzip \
|
||||
sudo \
|
||||
jq \
|
||||
git \
|
||||
make \
|
||||
libpq-dev \
|
||||
gnupg \
|
||||
gpg \
|
||||
ca-certificates \
|
||||
mc
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Python3"
|
||||
$STD apt-get install -y \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-setuptools \
|
||||
python3-wheel \
|
||||
python3-pip \
|
||||
python3-venv
|
||||
python3-pip
|
||||
msg_ok "Installed Python3"
|
||||
|
||||
msg_info "Installing Spoolman"
|
||||
cd /opt
|
||||
RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
|
||||
cd /opt
|
||||
wget -q https://github.com/Donkie/Spoolman/releases/download/$RELEASE/spoolman.zip
|
||||
unzip -q spoolman.zip -d spoolman
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
rm -rf spoolman.zip
|
||||
cd spoolman
|
||||
$STD python3 -m venv .venv
|
||||
$STD source .venv/bin/activate
|
||||
$STD pip3 install -r requirements.txt
|
||||
cp .env.example .env
|
||||
chmod +x scripts/*.sh
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Spoolman"
|
||||
|
||||
msg_info "Creating Service"
|
||||
@@ -59,15 +53,13 @@ cat <<EOF >/etc/systemd/system/spoolman.service
|
||||
[Unit]
|
||||
Description=Spoolman
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/spoolman
|
||||
EnvironmentFile=/opt/spoolman/.env
|
||||
ExecStart=/opt/spoolman/scripts/start.sh
|
||||
ExecStart=uvicorn spoolman.main:app --host 0.0.0.0 --port 7912
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user