summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas <dr@jones.dk>2013-11-15 18:24:59 +0100
committerJonas <dr@jones.dk>2013-11-15 18:24:59 +0100
commitc1ca74cb08db55d10080a7d4ce1e576d69915115 (patch)
treea45ea2e152d840e921f9bec41f747e5a84228d73
parent814d88326a88a356f554cbd4e5f7aac0509ec895 (diff)
Stop bindmount'ing webuser subdirs by default.
-rwxr-xr-xadduser.local53
1 files changed, 29 insertions, 24 deletions
diff --git a/adduser.local b/adduser.local
index 340592e..9f1d127 100755
--- a/adduser.local
+++ b/adduser.local
@@ -184,30 +184,35 @@ if [ -n "$profile_web" ] && [ -d /var/www ]; then
install -d -o "$NEWUID" -g "$NEWGID" "$webroot" "$cgiroot"
install -d -o "$NEWUID" -g "$NEWGID" -m 0750 "$dataroot"
- echo >&2 "Adding subdirs below /var/www ..."
- install -d "$webmount" "$cgimount"
-
- echo >&2 "Adding bind mount entries to /etc/fstab ..."
- webroot="$webroot" cgiroot="$cgiroot" webmount="$webmount" cgimount="$cgimount" perl -w -p -0 -i.old \
- -e 'my $webroot = $ENV{"webroot"};' \
- -e 'my $cgiroot = $ENV{"cgiroot"};' \
- -e 'my $webmount = $ENV{"webmount"};' \
- -e 'my $cgimount = $ENV{"cgimount"};' \
- -e 'if (s/\n[# ]*($webroot[ \t]+$webmount[ \t]+[^\n]+)/\n$1/) {' \
- -e '$web_seen++;' \
- -e 'print STDERR "Using existing web entry in fstab\n";' \
- -e '};' \
- -e 'if (s/\n[# ]*($cgiroot[ \t]+$cgimount[ \t]+[^\n]+)/\n$1/) {' \
- -e '$cgi_seen++;' \
- -e 'print STDERR "Using existing cgi entry in fstab\n";' \
- -e '};' \
- -e 's/$/\n$webroot\t$webmount\tauto\tbind\n/ unless $web_seen;' \
- -e 's/\n[# ]*($webroot[ \t]+$webmount[ \t]+[^\n]+)/\n$1\n$cgiroot\t$cgimount\tauto\tbind/ unless $cgi_seen;' \
- /etc/fstab
-
- echo >&2 "Mount web and cgi subdirs ..."
- mount "$webmount"
- mount "$cgimount"
+ if [ -f /etc/local/webusers.conf ]; then
+ . /etc/local/webusers.conf
+
+ if [ -n "$WEBUSERS_BINDMOUNT" ]; then
+ echo >&2 "Adding subdirs below /var/www ..."
+ install -d "$webmount" "$cgimount"
+
+ echo >&2 "Adding bind mount entries to /etc/fstab ..."
+ webroot="$webroot" cgiroot="$cgiroot" webmount="$webmount" cgimount="$cgimount" perl -w -p -0 -i.old \
+ -e 'my $webroot = $ENV{"webroot"};' \
+ -e 'my $cgiroot = $ENV{"cgiroot"};' \
+ -e 'my $webmount = $ENV{"webmount"};' \
+ -e 'my $cgimount = $ENV{"cgimount"};' \
+ -e 'if (s/\n[# ]*($webroot[ \t]+$webmount[ \t]+[^\n]+)/\n$1/) {' \
+ -e '$web_seen++;' \
+ -e 'print STDERR "Using existing web entry in fstab\n";' \
+ -e '};' \
+ -e 'if (s/\n[# ]*($cgiroot[ \t]+$cgimount[ \t]+[^\n]+)/\n$1/) {' \
+ -e '$cgi_seen++;' \
+ -e 'print STDERR "Using existing cgi entry in fstab\n";' \
+ -e '};' \
+ -e 's/$/\n$webroot\t$webmount\tauto\tbind\n/ unless $web_seen;' \
+ -e 's/\n[# ]*($webroot[ \t]+$webmount[ \t]+[^\n]+)/\n$1\n$cgiroot\t$cgimount\tauto\tbind/ unless $cgi_seen;' \
+ /etc/fstab
+
+ echo >&2 "Mount web and cgi subdirs ..."
+ mount "$webmount"
+ mount "$cgimount"
+ fi
fi
if [ -z "$profile_aux" ] && [ -x /usr/local/sbin/user-init ]; then