From c1ca74cb08db55d10080a7d4ce1e576d69915115 Mon Sep 17 00:00:00 2001 From: Jonas Date: Fri, 15 Nov 2013 18:24:59 +0100 Subject: Stop bindmount'ing webuser subdirs by default. --- adduser.local | 53 +++++++++++++++++++++++++++++------------------------ 1 file 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 -- cgit v1.2.3