#! /bin/sh # # This file is included by the quickstart script file "bwadduser" so that it can live # within the svn repository. # if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then echo "*******************************************************" echo "Error: JAVA_HOME is not defined correctly for Bedework." echo "*******************************************************" exit 1 fi ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0 ANT_HOME=`cd "$ANT_HOME" && pwd` usage() { echo " $PRG help | ? | account firstname lastname caladdr [password]" echo "" echo " Invokes ant to run dirtool to add an account to the directory." echo "" echo " firstname, lastname and caladdr are required" echo "" echo " If the password is not supplied you will be prompted for the password." echo "" } errorUsage() { echo "*******************************************************" echo "Error: $1" echo "*******************************************************" usage exit 1 } saveddir=`pwd` export QUICKSTART_HOME=$saveddir # Default some parameters account=$1 firstname=$2 lastname=$3 caladdr=$4 password=$5 if [ "$account" = "help" -o "$account" = "?" ] ; then usage exit fi if [ "$account" = "" ] ; then errorUsage "Must supply account, first name, last name adn calladdr" fi if [ "$firstname" = "" ] ; then errorUsage "Must supply account, first name, last name adn calladdr" fi if [ "$lastname" = "" ] ; then errorUsage "Must supply account, first name, last name adn calladdr" fi if [ "$caladdr" = "" ] ; then errorUsage "Must supply account, first name, last name adn calladdr" fi while [ "$password" = "" ] do echo "Password: " stty -echo read npassword stty echo echo "Reenter password: " stty -echo read checkpassword stty echo if [ "$npassword" != "$checkpassword" ] ; then echo "Passwords do not match/" else password=npassword fi done ANT_CLASSPATH=$ANT_HOME/lib/ant-launcher.jar ant_home_def="-Dant.home=$ANT_HOME" ant_class_def="org.apache.tools.ant.launch.Launcher" adduser_defs="-Dorg.bedework.directory.account=$account" adduser_defs="$adduser_defs -Dorg.bedework.directory.firstname=$firstname" adduser_defs="$adduser_defs -Dorg.bedework.directory.lastname=$lastname" adduser_defs="$adduser_defs -Dorg.bedework.directory.caladdr=$caladdr" adduser_defs="$adduser_defs -Dorg.bedework.directory.password=$password" $JAVA_HOME/bin/java -classpath $ANT_CLASSPATH $ant_home_def $adduser_defs $ant_class_def addUser