root/trunk/build/quickstart/adduser

Revision 1915 (checked in by douglm, 5 years ago)

Fix up code to add a user to the directory

Line 
1 #! /bin/sh
2
3 #
4 # This file is included by the quickstart script file "adduser" so that it can live
5 # within the svn repository.
6 #
7
8 ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0
9 ANT_HOME=`cd "$ANT_HOME" && pwd`
10
11 usage() {
12   echo "  $PRG help | ? | account firstname lastname [password]"
13   echo ""
14   echo "   Invokes ant to build the bedework tools then uses that tool to add"
15   echo "   an account in the directory."
16   echo ""
17   echo "   firstname and lastname are required"
18   echo ""
19   echo "   If the password is not supplied you will be prompted for the password."
20   echo ""
21 }
22
23 errorUsage() {
24   echo "*******************************************************"
25   echo "Error: $1"
26   echo "*******************************************************"
27   usage
28   exit 1
29 }
30
31 saveddir=`pwd`
32
33 export QUICKSTART_HOME=$saveddir
34
35 # Default some parameters
36
37 account=$1
38 firstname=$2
39 lastname=$3
40 password=$4
41
42 if [ "$account" = "help" -o "$account" = "?" ] ; then
43   usage
44   exit
45 fi
46
47 if [ "$account" = "" ] ; then
48   errorUsage "Must supply account, first name and last name"
49 fi
50
51 if [ "$firstname" = "" ] ; then
52   errorUsage "Must supply account, first name and last name"
53 fi
54
55 if [ "$lastname" = "" ] ; then
56   errorUsage "Must supply account, first name and last name"
57 fi
58
59 while [ "$password" = "" ]
60 do
61   echo "Password: "
62
63   stty -echo
64   read npassword
65   stty echo
66
67   echo "Reenter password: "
68
69   stty -echo
70   read checkpassword
71   stty echo
72
73   if [ "$npassword" != "$checkpassword" ] ; then
74     echo "Passwords do not match/"
75   else
76     password=npassword
77   fi
78 done
79
80 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
81   echo "*******************************************************"
82   echo "Error: JAVA_HOME is not defined correctly for bedework."
83   echo "*******************************************************"
84   exit 1
85 fi
86
87 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
88
89 ant_home_def="-Dant.home=$ANT"
90 ant_class_def="org.apache.tools.ant.launch.Launcher"
91
92 adduser_defs="-Dorg.bedework.adduser.account=$account"
93 adduser_defs="$adduser_defs -Dorg.bedework.adduser.firstname=$firstname"
94 adduser_defs="$adduser_defs -Dorg.bedework.adduser.lastname=$lastname"
95 adduser_defs="$adduser_defs -Dorg.bedework.adduser.password=$password"
96
97 $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_home_def $adduser_defs $ant_class_def addUser
98
99
100
101
Note: See TracBrowser for help on using the browser.