Rework SnipeIT: Tarball & Tempfile (#2963)

* SnipeIT: Change Release to tarball

* Update snipeit.sh

* Update snipeit-install.sh

* Update snipeit.sh
This commit is contained in:
CanbiZ
2025-03-10 17:18:45 +01:00
committed by GitHub
parent 60994b6851
commit 1de7e428cd
2 changed files with 23 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# Source: https://snipeitapp.com/
APP="SnipeIT"
var_tags="assat-management;foss"
var_tags="asset-management;foss"
var_cpu="2"
var_ram="2048"
var_disk="4"
@@ -27,13 +27,20 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "v([^"]+).*/\1/')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Services"
systemctl stop nginx
msg_ok "Services Stopped"
msg_info "Updating ${APP} to v${RELEASE}"
$STD apt-get update
$STD apt-get -y upgrade
mv /opt/snipe-it /opt/snipe-it-backup
cd /opt
temp_file=$(mktemp)
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
tar zxf $temp_file
mv snipe-it-${RELEASE} /opt/snipe-it
$STD wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
mv snipe-it-${RELEASE} /opt/snipe-it
@@ -53,9 +60,13 @@ function update_script() {
chmod -R 755 /opt/snipe-it
rm -rf /opt/v${RELEASE}.zip
rm -rf /opt/snipe-it-backup
msg_ok "Updated ${APP} LXC"
msg_ok "Updated ${APP}"
msg_info "Starting Service"
systemctl start nginx
msg_ok "Started Service"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
exit
}
@@ -67,4 +78,4 @@ 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}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"