#!/bin/bash
umask 022    
domain=$1  
user=$2       

pub=`readlink -f  /mnt/public`
MDBASE=`dirname $pub`
homepath=${MDBASE}/User/

if [ -f "/etc/domain.config" ];then
	STAT=`iniparse  -c -f  /etc/domain.config  -s domain -k connection_status`
	if [ $STAT -eq 1 ]; then
		user=$domain/$user
	fi
else
	exit 0
fi


STAT=`iniparse  -c -f  /etc/domain.config  -s domain -k connection_status`
if [ $STAT -eq 1 ]; then
     user=$domain/$user
fi

if [ -z "$MDBASE" ]; then
    MDBASE="/mnt/md0"
fi

if [ ! -d ${homepath}${user} ] ; then
    mkdir -p  ${homepath}$2/home
    chown -R  $user ${homepath}$2
    ln -s ${homepath}$2/home   /home/$2
fi
