Skip to content

Commit 19c29c9

Browse files
committed
Invoke via sudo if the execution user is not "root".
1 parent 099fcc0 commit 19c29c9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

mt/docker-entrypoint.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
#!/bin/sh
22

3+
[ "$(id -u)" -eq 0 ] && SUDO= || SUDO=sudo
4+
35
if [ -n "$DOCKER_MT_SERVICES" ]; then
46
for s in $DOCKER_MT_SERVICES; do
5-
service $s start
7+
$SUDO service $s start
68
done
79
fi
810

911
if [ -n "$DOCKER_MT_CPANFILES" ]; then
1012
for f in $DOCKER_MT_CPANFILES; do
1113
if [ -f $f ]; then
12-
cpm install -g --cpanfile=$f
14+
$SUDO cpm install -g --cpanfile=$f
1315
fi
1416
done
1517
fi
1618

17-
chmod 777 /var/www/html
18-
chmod 777 /var/www/cgi-bin/mt/mt-static/support
19-
chmod 777 /var/www/cgi-bin/mt/themes
19+
$SUDO chmod 777 /var/www/html
20+
$SUDO chmod 777 /var/www/cgi-bin/mt/mt-static/support
21+
$SUDO chmod 777 /var/www/cgi-bin/mt/themes
2022

2123
if [ "$1" = "apache2-foreground" ]; then
2224
# invoke php-fpm

0 commit comments

Comments
 (0)