Skip to content

Commit 68936f0

Browse files
authored
SnipeIT: Harmonize Composer to Dockerfile (#3009)
1 parent 5ce76f0 commit 68936f0

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

install/snipeit-install.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ update_os
1515

1616
msg_info "Installing Dependencies"
1717
$STD apt-get install -y \
18-
curl \
19-
composer \
20-
git \
21-
sudo \
22-
mc \
23-
nginx \
24-
php8.2-{bcmath,common,ctype,curl,fileinfo,fpm,gd,iconv,intl,mbstring,mysql,soap,xml,xsl,zip,cli} \
25-
mariadb-server
18+
curl \
19+
composer \
20+
git \
21+
sudo \
22+
mc \
23+
nginx \
24+
php8.2-{bcmath,common,ctype,curl,fileinfo,fpm,gd,iconv,intl,mbstring,mysql,soap,xml,xsl,zip,cli} \
25+
mariadb-server
2626
msg_ok "Installed Dependencies"
2727

2828
msg_info "Setting up database"
@@ -37,12 +37,12 @@ mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVI
3737
echo "SnipeIT Database User: $DB_USER"
3838
echo "SnipeIT Database Password: $DB_PASS"
3939
echo "SnipeIT Database Name: $DB_NAME"
40-
} >> ~/snipeit.creds
40+
} >>~/snipeit.creds
4141
msg_ok "Set up database"
4242

4343
msg_info "Installing Snipe-IT"
4444
temp_file=$(mktemp)
45-
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep '"tag_name"' | sed -E 's/.*"tag_name": "v([^"]+).*/\1/')
45+
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
4646
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.tar.gz" -O $temp_file
4747
tar zxf $temp_file
4848
mv snipe-it-${RELEASE} /opt/snipe-it
@@ -51,15 +51,15 @@ cp .env.example .env
5151
IPADDRESS=$(hostname -I | awk '{print $1}')
5252

5353
sed -i -e "s|^APP_URL=.*|APP_URL=http://$IPADDRESS|" \
54-
-e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
55-
-e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
56-
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
54+
-e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
55+
-e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
56+
-e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
5757

5858
chown -R www-data: /opt/snipe-it
5959
chmod -R 755 /opt/snipe-it
6060
export COMPOSER_ALLOW_SUPERUSER=1
6161
$STD composer update --no-plugins --no-scripts
62-
$STD composer install --no-dev --prefer-source --no-plugins --no-scripts
62+
$STD composer install --no-dev
6363
$STD php artisan key:generate --force
6464
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
6565
msg_ok "Installed SnipeIT"
@@ -69,13 +69,13 @@ cat <<EOF >/etc/nginx/conf.d/snipeit.conf
6969
server {
7070
listen 80;
7171
root /opt/snipe-it/public;
72-
server_name $IPADDRESS;
72+
server_name $IPADDRESS;
7373
index index.php;
74-
74+
7575
location / {
7676
try_files \$uri \$uri/ /index.php?\$query_string;
7777
}
78-
78+
7979
location ~ \.php\$ {
8080
include fastcgi.conf;
8181
include snippets/fastcgi-php.conf;
@@ -90,7 +90,6 @@ EOF
9090
systemctl reload nginx
9191
msg_ok "Configured Service"
9292

93-
9493
motd_ssh
9594
customize
9695

0 commit comments

Comments
 (0)