2
0
Fork 0
mirror of https://github.com/friendica/docker synced 2024-05-28 04:58:18 +02:00

improve "run_as()" now runs inside the /var/www/html directory

This commit is contained in:
Philipp Holzer 2019-11-16 21:55:08 +01:00
parent 5da7979222
commit 6e566394d2
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
7 changed files with 35 additions and 28 deletions

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi

View file

@ -3,10 +3,11 @@ set -eu
# run an command with the www-data user
run_as() {
set -- -eu -c "cd /var/www/html; $*"
if [ "$(id -u)" -eq 0 ]; then
su - www-data -s /bin/sh -c "cd /var/www/html;$1"
su - www-data -s /bin/sh "$@"
else
sh -c "$1"
sh "$@"
fi
}
@ -200,7 +201,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
echo "Starting Friendica installation ..."
# TODO Let the database time to warm up - not winning a beauty contest
sleep 10s
run_as "cd /var/www/html; php /var/www/html/bin/console.php autoinstall $install_options"
run_as "php /var/www/html/bin/console.php autoinstall $install_options"
# TODO Workaround because of a strange permission issue
rm -fr /var/www/html/view/smarty3/compiled
@ -217,7 +218,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
# upgrade
else
echo "Upgrading Friendica ..."
run_as 'cd /var/www/html; php /var/www/html/bin/console.php dbstructure update'
run_as 'php /var/www/html/bin/console.php dbstructure update'
echo "Upgrading finished"
fi
fi