Files
ProxmoxVE/ct/snipeit.sh
T

87 lines
2.9 KiB
Bash
Raw Normal View History

2024-12-02 09:05:12 +01:00
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
2024-12-02 09:05:12 +01:00
# Author: Michel Roegl-Brunner (michelroegl-brunner)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://snipeitapp.com/ | Github: https://github.com/grokability/snipe-it
2024-12-02 09:05:12 +01:00
APP="SnipeIT"
var_tags="${var_tags:-asset-management;foss}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
2025-10-15 22:58:08 +02:00
var_version="${var_version:-13}"
2026-06-12 00:16:15 +10:00
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
2024-12-02 09:05:12 +01:00
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/snipe-it ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
setup_mariadb
2025-09-02 22:16:48 +02:00
if ! grep -q "client_max_body_size[[:space:]]\+100M;" /etc/nginx/conf.d/snipeit.conf; then
sed -i '/index index.php;/i \ client_max_body_size 100M;' /etc/nginx/conf.d/snipeit.conf
fi
2025-08-23 10:24:57 +02:00
2025-11-23 07:41:51 -03:00
if check_for_gh_release "snipe-it" "grokability/snipe-it"; then
2025-03-10 17:18:45 +01:00
msg_info "Stopping Services"
systemctl stop nginx
msg_ok "Services Stopped"
2025-12-11 12:08:16 +01:00
msg_info "Creating Backup"
2025-08-23 10:24:57 +02:00
mv /opt/snipe-it /opt/snipe-it-backup
2025-12-11 12:08:16 +01:00
msg_ok "Created Backup"
2025-08-23 10:24:57 +02:00
fetch_and_deploy_gh_release "snipe-it" "grokability/snipe-it" "tarball"
[[ "$(php -v 2>/dev/null)" == PHP\ 8.2* ]] && PHP_VERSION="8.3" PHP_FPM="YES" PHP_MODULE="ldap,soap,xsl" setup_php
2025-08-25 14:10:52 +02:00
sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/snipeit.conf
2025-08-23 10:24:57 +02:00
setup_composer
2025-12-11 12:08:16 +01:00
msg_info "Updating Snipe-IT"
apt_update_safe
2025-10-15 22:58:08 +02:00
$STD apt -y upgrade
cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
cp -r /opt/snipe-it-backup/public/uploads/. /opt/snipe-it/public/uploads/
cp -r /opt/snipe-it-backup/storage/private_uploads/. /opt/snipe-it/storage/private_uploads/
cd /opt/snipe-it/
export COMPOSER_ALLOW_SUPERUSER=1
$STD composer install --no-dev --optimize-autoloader --no-interaction
$STD composer dump-autoload
$STD php artisan migrate --force
$STD php artisan config:clear
$STD php artisan route:clear
$STD php artisan cache:clear
$STD php artisan view:clear
chown -R www-data: /opt/snipe-it
chmod -R 755 /opt/snipe-it
rm -rf /opt/snipe-it-backup
2025-12-11 12:08:16 +01:00
msg_ok "Updated Snipe-IT"
2025-03-10 17:18:45 +01:00
msg_info "Starting Service"
systemctl start nginx
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
2024-12-02 09:05:12 +01:00
}
start
build_container
description
2026-01-06 22:57:40 +01:00
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 "${GATEWAY}${BGN}http://${IP}${CL}"