Added FORCE_PERMS

This commit is contained in:
Deon George 2020-01-24 23:51:41 +11:00
parent 3bddae369e
commit f99cd2f308

18
init
View File

@ -19,9 +19,12 @@ if [ "${role}" = "app" -a -e artisan ]; then
exec /bin/bash exec /bin/bash
fi fi
mountpoint -q ${php}
mp=$?
# Only adjust perms if this is an external mountpoint # Only adjust perms if this is an external mountpoint
if mountpoint -q ${php}; then if [ ${mp} -eq 0 -o -n "${FORCE_PERMS}" ] ; then
if [ "${env}" != "dev" -a -z "${SKIP_PERM}" ]; then if [ -n "${FORCE_PERMS}" -o "${env}" != "dev" -a -z "${SKIP_PERM}" ]; then
echo "* Setting Permissions..." 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 {} \;
@ -42,14 +45,17 @@ if [ "${role}" = "app" -a -e artisan ]; then
NODEV="--no-dev" NODEV="--no-dev"
fi fi
if mountpoint -q ${composer}; then mountpoint -q ${composer}
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chown -R www-data:www-data ${composer} mp=$?
if [ ${mp} -eq 0 -o -n "${FORCE_PERMS}" ] ; then
[ -n "${FORCE_PERMS}" -o "${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
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chmod g+w ${php} [ -n "${FORCE_PERMS}" -o "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chmod g+w ${php}
fi fi
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 )
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && mountpoint -q ${composer} && chmod g-w ${php} [ -n "${FORCE_PERMS}" -o "${env}" != "dev" -a -z "${SKIP_PERM}" ] && [ ${mp} -eq 0 ] && chmod g-w ${php}
fi fi
if [ -r .migrate ]; then if [ -r .migrate ]; then