#!/bin/sh
# the current working directory is always where hxd was started from

# PARAMETERS
# Where to link the dropbox (usually in files)
DROPBOXE="./files/account boxes/$ACCOUNT drop box"
# Enforce special rights for admin/members overriding possible manual settings when creating new account
CHECKRIGHTS=0

# Check thoses files if you want to change the defaults rights for members/admin (to use with CHECKRIGHTS=1)
source ./etc/skel/.config
source ./etc/skel.admin/.config

# You need to have getudbit compiled and installed for admin/member separation to work
admin=`/usr/local/bin/getudbit $ACCOUNTDIR/$ACCOUNT/UserData disconnect_users`


if [ $admin -eq 1 ]; then
	/bin/cp -r ./etc/skel.admin/* $ACCOUNTDIR/$ACCOUNT
	/bin/mkdir "$DROPBOXE"
	/bin/ln -s "$DROPBOXE" $ACCOUNTDIR/$ACCOUNT/dropbox
	[ $CHECKRIGHTS -eq 1 ] && adminrights $ACCOUNTDIR/$ACCOUNT/UserData
else
	/bin/cp -r ./etc/skel/* $ACCOUNTDIR/$ACCOUNT
	/bin/mkdir "$DROPBOXE"
	/bin/ln -s "$DROPBOXE" $ACCOUNTDIR/$ACCOUNT/dropbox
	[ $CHECKRIGHTS -eq 1 ] && memberrights $ACCOUNTDIR/$ACCOUNT/UserData
fi
