Compare commits

..

5 Commits

Author SHA1 Message Date
CanbiZ 7d2c5b15b3 Update spoolman-install.sh 2024-06-13 13:22:45 +02:00
CanbiZ 1cba847c0c URL Missing after Create 2024-06-13 13:21:08 +02:00
CanbiZ 1f2e451b40 Remove Unzip 2024-06-13 13:12:47 +02:00
CanbiZ 991ef1b734 Final Update spoolman-install.sh 2024-06-13 13:11:34 +02:00
CanbiZ c34c0afa82 Final Update Spoolman.sh 2024-06-13 13:06:41 +02:00
2 changed files with 38 additions and 49 deletions
+12 -15
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func) source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2024 tteck # Copyright (c) 2021-2024 tteck
# Author: MickLesk (Canbiz) # Author: tteck
# Co-Author: MickLesk (Canbiz)
# License: MIT # License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE # 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 read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit [[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
fi 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" msg_info "Stopping ${APP} Service"
systemctl stop spoolman systemctl stop spoolman
msg_ok "Stopped ${APP} Service" msg_ok "Stopped ${APP} Service"
msg_info "Updating ${APP} to latest Git" msg_info "Updating ${APP} to ${RELEASE}"
RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
cd /opt cd /opt
if [ -d spoolman_bak ]; then
rm -rf spoolman_bak rm -rf spoolman_bak
fi
mv spoolman spoolman_bak mv spoolman spoolman_bak
wget -q https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip wget -q https://github.com/Donkie/Spoolman/releases/download/${RELEASE}/spoolman.zip
unzip -q spoolman.zip -d spoolman unzip -q spoolman.zip -d spoolman
echo "${RELEASE}" >/opt/${APP}_version.txt
cd spoolman 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 pip3 install -r requirements.txt >/dev/null 2>&1
cp .env.example .env cp .env.example .env
chmod +x scripts/*.sh echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to latest Git" msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Starting ${APP} Service" msg_info "Starting ${APP} Service"
systemctl start spoolman systemctl start spoolman
sleep 1
msg_ok "Started ${APP} Service" msg_ok "Started ${APP} Service"
msg_info "Cleaning up" msg_info "Cleaning up"
if [ -d "/opt/spoolman_bak" ]; then
rm -rf /opt/spoolman_bak
rm -rf /opt/spoolman.zip rm -rf /opt/spoolman.zip
fi msg_ok "Cleaned"
msg_ok "Cleaning up Successfully!"
msg_ok "Updated Successfully!\n" msg_ok "Updated Successfully!\n"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit exit
} }
+7 -15
View File
@@ -16,42 +16,36 @@ network_check
update_os update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y --no-install-recommends \ $STD apt-get install -y \
build-essential \ build-essential \
curl \ curl \
unzip \
sudo \ sudo \
jq \
git \
make \ make \
libpq-dev \ libpq-dev \
gnupg \ gpg \
ca-certificates \ ca-certificates \
mc mc
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Python3" msg_info "Installing Python3"
$STD apt-get install -y \ $STD apt-get install -y \
python3 \
python3-dev \ python3-dev \
python3-setuptools \ python3-setuptools \
python3-wheel \ python3-wheel \
python3-pip \ python3-pip
python3-venv
msg_ok "Installed Python3" msg_ok "Installed Python3"
msg_info "Installing Spoolman" msg_info "Installing Spoolman"
cd /opt cd /opt
RELEASE=$(wget -q https://github.com/Donkie/Spoolman/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) 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 wget -q https://github.com/Donkie/Spoolman/releases/download/$RELEASE/spoolman.zip
unzip -q spoolman.zip -d spoolman unzip -q spoolman.zip -d spoolman
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt rm -rf spoolman.zip
cd spoolman cd spoolman
$STD python3 -m venv .venv
$STD source .venv/bin/activate
$STD pip3 install -r requirements.txt $STD pip3 install -r requirements.txt
cp .env.example .env cp .env.example .env
chmod +x scripts/*.sh echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed Spoolman" msg_ok "Installed Spoolman"
msg_info "Creating Service" msg_info "Creating Service"
@@ -59,15 +53,13 @@ cat <<EOF >/etc/systemd/system/spoolman.service
[Unit] [Unit]
Description=Spoolman Description=Spoolman
After=network.target After=network.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/opt/spoolman WorkingDirectory=/opt/spoolman
EnvironmentFile=/opt/spoolman/.env EnvironmentFile=/opt/spoolman/.env
ExecStart=/opt/spoolman/scripts/start.sh ExecStart=uvicorn spoolman.main:app --host 0.0.0.0 --port 7912
Restart=always Restart=always
User=root User=root
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF