2020-03-31 21:02:10 -07:00
|
|
|
#!/bin/bash
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
# fix key if needed
|
2016-05-14 15:43:46 -07:00
|
|
|
if [ -z "$APP_KEY" ]
|
2016-03-25 01:18:05 -07:00
|
|
|
then
|
2016-05-14 15:43:46 -07:00
|
|
|
echo "Please re-run this container with an environment variable \$APP_KEY"
|
|
|
|
echo "An example APP_KEY you could use is: "
|
2019-03-07 12:42:00 -08:00
|
|
|
/var/www/html/artisan key:generate --show
|
2016-05-14 15:43:46 -07:00
|
|
|
exit
|
2016-03-25 01:18:05 -07:00
|
|
|
fi
|
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
if [ -f /var/lib/snipeit/ssl/snipeit-ssl.crt -a -f /var/lib/snipeit/ssl/snipeit-ssl.key ]
|
2016-03-25 01:18:05 -07:00
|
|
|
then
|
|
|
|
a2enmod ssl
|
|
|
|
else
|
|
|
|
a2dismod ssl
|
|
|
|
fi
|
|
|
|
|
2016-05-14 15:43:46 -07:00
|
|
|
# create data directories
|
2018-09-11 04:07:45 -07:00
|
|
|
for dir in \
|
|
|
|
'data/private_uploads' \
|
|
|
|
'data/uploads/accessories' \
|
|
|
|
'data/uploads/avatars' \
|
|
|
|
'data/uploads/barcodes' \
|
|
|
|
'data/uploads/categories' \
|
|
|
|
'data/uploads/companies' \
|
|
|
|
'data/uploads/components' \
|
|
|
|
'data/uploads/consumables' \
|
|
|
|
'data/uploads/departments' \
|
|
|
|
'data/uploads/locations' \
|
|
|
|
'data/uploads/manufacturers' \
|
|
|
|
'data/uploads/models' \
|
|
|
|
'data/uploads/suppliers' \
|
|
|
|
'dumps' \
|
|
|
|
'keys'
|
|
|
|
do
|
|
|
|
[ ! -d "/var/lib/snipeit/$dir" ] && mkdir -p "/var/lib/snipeit/$dir"
|
2016-05-14 15:43:46 -07:00
|
|
|
done
|
|
|
|
|
|
|
|
chown -R docker:root /var/lib/snipeit/data/*
|
|
|
|
chown -R docker:root /var/lib/snipeit/dumps
|
2018-06-07 22:29:00 -07:00
|
|
|
chown -R docker:root /var/lib/snipeit/keys
|
|
|
|
|
2020-03-31 21:02:10 -07:00
|
|
|
# Fix php settings
|
|
|
|
if [ -v "PHP_UPLOAD_LIMIT" ]
|
|
|
|
then
|
|
|
|
echo "Changing upload limit to ${PHP_UPLOAD_LIMIT}"
|
|
|
|
sed -i "s/^upload_max_filesize.*/upload_max_filesize = ${PHP_UPLOAD_LIMIT}M/" /etc/php/*/apache2/php.ini
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2018-06-07 22:29:00 -07:00
|
|
|
# If the Oauth DB files are not present copy the vendor files over to the db migrations
|
2018-09-11 04:07:45 -07:00
|
|
|
if [ ! -f "/var/www/html/database/migrations/*create_oauth*" ]
|
|
|
|
then
|
2018-06-07 22:29:00 -07:00
|
|
|
cp -ax /var/www/html/vendor/laravel/passport/database/migrations/* /var/www/html/database/migrations/
|
|
|
|
fi
|
2016-05-14 15:43:46 -07:00
|
|
|
|
2019-03-07 12:42:00 -08:00
|
|
|
exec supervisord -c /supervisord.conf
|