@@ -58,32 +58,36 @@ header_info
5858check_container_storage
5959check_container_resources
6060if [[ ! -d /opt/snipe-it ]]; then msg_error " No ${APP} Installation Found!" ; exit ; fi
61- msg_info " Updating ${APP} LXC"
62- apt-get update & > /dev/null
63- apt-get -y upgrade & > /dev/null
64- mv /opt/snipe-it /opt/snipe-it-backup
65- cd /opt
6661RELEASE=$( curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
67- wget -q " https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE} .zip" & > /dev/null
68- unzip -q v${RELEASE} .zip
69- mv snipe-it-${RELEASE} /opt/snipe-it
70- cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
71- cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
72- cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
73- cd /opt/snipe-it/
74- export COMPOSER_ALLOW_SUPERUSER=1
75- composer install --no-dev --prefer-source & > /dev/null
76- composer dump-autoload & > /dev/null
77- php artisan migrate --force & > /dev/null
78- php artisan config:clear & > /dev/null
79- php artisan route:clear & > /dev/null
80- php artisan cache:clear & > /dev/null
81- php artisan view:clear & > /dev/null
82- chown -R www-data: /opt/snipe-it
83- chmod -R 755 /opt/snipe-it
84- rm -rf /opt/v${RELEASE} .zip
85- rm -rf /opt/snipe-it-backup
86- msg_ok " Updated ${APP} LXC"
62+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
63+ msg_info " Updating ${APP} to v${RELEASE} "
64+ apt-get update & > /dev/null
65+ apt-get -y upgrade & > /dev/null
66+ mv /opt/snipe-it /opt/snipe-it-backup
67+ cd /opt
68+ wget -q " https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE} .zip" & > /dev/null
69+ unzip -q v${RELEASE} .zip
70+ mv snipe-it-${RELEASE} /opt/snipe-it
71+ cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
72+ cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
73+ cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
74+ cd /opt/snipe-it/
75+ export COMPOSER_ALLOW_SUPERUSER=1
76+ composer install --no-dev --prefer-source & > /dev/null
77+ composer dump-autoload & > /dev/null
78+ php artisan migrate --force & > /dev/null
79+ php artisan config:clear & > /dev/null
80+ php artisan route:clear & > /dev/null
81+ php artisan cache:clear & > /dev/null
82+ php artisan view:clear & > /dev/null
83+ chown -R www-data: /opt/snipe-it
84+ chmod -R 755 /opt/snipe-it
85+ rm -rf /opt/v${RELEASE} .zip
86+ rm -rf /opt/snipe-it-backup
87+ msg_ok " Updated ${APP} LXC"
88+ else
89+ msg_ok " No update required. ${APP} is already at v${RELEASE} ."
90+ fi
8791exit
8892}
8993
0 commit comments