Rework SnipeIT: Tarball & Tempfile (#2963)
Some checks are pending
Auto Update .app-files / update-app-files (push) Waiting to run
Shellcheck / Shellcheck (push) Waiting to run
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Frontend CI/CD / build (push) Waiting to run
Frontend CI/CD / deploy (push) Blocked by required conditions

* 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

@ -41,13 +41,11 @@ mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVI
msg_ok "Set up database"
msg_info "Installing Snipe-IT"
cd /opt
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
unzip -q v${RELEASE}.zip
temp_file=$(mktemp)
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "v([^"]+).*/\1/')
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
cd /opt/snipe-it
cp .env.example .env
IPADDRESS=$(hostname -I | awk '{print $1}')
@ -59,17 +57,14 @@ sed -i -e "s|^APP_URL=.*|APP_URL=http://$IPADDRESS|" \
chown -R www-data: /opt/snipe-it
chmod -R 755 /opt/snipe-it
export COMPOSER_ALLOW_SUPERUSER=1
$STD composer update --no-plugins --no-scripts
$STD composer install --no-dev --prefer-source --no-plugins --no-scripts
$STD php artisan key:generate --force
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed SnipeIT"
msg_info "Creating Service"
cat <<EOF >/etc/nginx/conf.d/snipeit.conf
server {
listen 80;
@ -100,7 +95,7 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf /opt/v${RELEASE}.zip
rm -f $temp_file
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"