#!/bin/sh

. `dirname $0`/sub.defaults
TLD="$1"
SLD="$2"
SUBDOMAIN="$3"
VUSER="$4"

if [ $# -ne 4 ]; then
   echo $0: TLD SLD SUBDOMAIN VUSER
   exit 1
fi

echo -n adding wwwroot for $SUBDOMAIN.$SLD.$TLD and links for $VUSER ...

# root
mkdir -p $WEBBASE/$VUSER/$TLD/$SLD/$SUBDOMAIN

# cgi-bin
mkdir -p $WEBBASE/$VUSER/$TLD/$SLD/$SUBDOMAIN/cgi-bin

# webalizer
mkdir -p $WEBBASE/$VUSER/$TLD/$SLD/$SUBDOMAIN/logs/webalizer

# sample
cp $WEBPAGE_DEFAULT $WEBBASE/$VUSER/$TLD/$SLD/$SUBDOMAIN/index.html

# permissions
chown -R $VUSER /home/server/www/$VUSER/$TLD/$SLD/
chgrp -R $WWWOWNER /home/server/www/$VUSER/$TLD/$SLD/

echo done.