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

9
init
View File

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