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
fi
mountpoint -q ${php}
mp=$?
# Only adjust perms if this is an external mountpoint
if mountpoint -q ${php}; then
if [ "${env}" != "dev" -a -z "${SKIP_PERM}" ]; then
if [ ${mp} -eq 0 -o -n "${FORCE_PERMS}" ] ; then
if [ -n "${FORCE_PERMS}" -o "${env}" != "dev" -a -z "${SKIP_PERM}" ]; then
echo "* Setting Permissions..."
# Make sure our permissions are appropraite
find ${php} -type f -exec chmod 640 {} \;
@ -42,14 +45,17 @@ if [ "${role}" = "app" -a -e artisan ]; then
NODEV="--no-dev"
fi
if mountpoint -q ${composer}; then
[ "${env}" != "dev" -a -z "${SKIP_PERM}" ] && chown -R www-data:www-data ${composer}
mountpoint -q ${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
[ "${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
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
if [ -r .migrate ]; then