Skip permissions adjustments if dev mode or SKIP_PERM=1

This commit is contained in:
Deon George 2020-01-15 21:36:53 +11:00
parent c6f4d4835b
commit 528051fe04

21
init
View File

@ -19,26 +19,29 @@ if [ "${role}" = "app" -a -e artisan ]; then
exec /bin/bash
fi
# Make sure our permissions are appropraite
find ${php} -type f -exec chmod 640 {} \;
find ${php} -type d -exec chmod 750 {} \;
chown -R lamp:www-data ${php}
chown -R www-data:www-data ${php}/storage ${php}/bootstrap ${php}/composer.*
[ -e ${php}/vendor ] && chown -R www-data:www-data ${php}/vendor
if [ "${env}" != "dev" -a -z "${SKIP_PERM}" ]; then
echo "* Setting Permissions..."
# Make sure our permissions are appropraite
find ${php} -type f -exec chmod 640 {} \;
find ${php} -type d -exec chmod 750 {} \;
chown -R lamp:www-data ${php}
chown -R www-data:www-data ${php}/storage ${php}/bootstrap ${php}/composer.*
[ -e ${php}/vendor ] && chown -R www-data:www-data ${php}/vendor
fi
if [ "${env}" != "local" -a -r "artisan" ]; then
# See if we need to refresh our dependancies
if [[ -r composer.lock && ( -e .composer.refresh || ! -d vendor ) ]]; then
rm -f ${php}/bootstrap/cache/*.php
chown -R www-data:www-data ${composer}
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chown -R www-data:www-data ${composer}
[ ! -d ${php}/vendor ] && mkdir -m 750 ${php}/vendor && chown www-data:www-data ${php}/vendor
if [ "${env}" != "dev" ]; then
NODEV="--no-dev"
fi
chmod g+w ${php}
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chmod g+w ${php}
su www-data -s /bin/sh -c "composer install --optimize-autoloader ${NODEV}" && ( test -e .composer.refresh && rm -f .composer.refresh )
chmod g-w ${php}
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chmod g-w ${php}
fi
if [ -r .migrate ]; then