root/trunk/build/quickstart/linux/install

Revision 2011 (checked in by douglm, 4 years ago)

Fix install script and dirtools so that we can add a user

Line 
1 #! /bin/sh
2
3 #
4 # This file is included by the quickstart script file "bwinstall" so that it can live
5 # within the svn repository.
6 #
7
8 errorMsg() {
9   echo "*******************************************************"
10   echo "Error: $1"
11   echo "*******************************************************"
12   exit 1
13 }
14
15 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
16   errorMsg "JAVA_HOME is not defined correctly for bedework."
17 fi
18
19 # Ant
20 ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0
21 ANT_HOME=`cd "$ANT_HOME" && pwd`
22 saveddir=`pwd`
23
24 export QUICKSTART_HOME=$saveddir
25
26 # Directory server
27 export DS_HOME=$QUICKSTART_HOME/apacheds-1.5.3-fixed
28
29 # ------------- Should not need to change anything below this ----------
30
31 ANT=$ANT_HOME/bin/ant
32
33 export BEDEWORK_HOME=$QUICKSTART_HOME/bedework
34
35 libcache=$BEDEWORK_HOME/libcache
36
37 quickStartBuildFile=$QUICKSTART_HOME/build.xml
38
39 qsant="$ANT -buildfile $quickStartBuildFile"
40
41 ANT_CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
42
43 qsantrunner="$JAVA_HOME/bin/java -classpath $ANT_HOME/lib/ant-launcher.jar -Dant.home=$ANT_HOME"
44 ant_class_def="org.apache.tools.ant.launch.Launcher"
45
46 shutdownServer() {
47   echo "Stopping directory server"
48   $JAVA_HOME/bin/java -jar $DS_HOME/bin/apacheds-tools.jar graceful --install-path $DS_HOME --configuration
49 }
50
51 readVal() {
52   val=
53   until [ "$val" != "" ] ; do
54     echo "Enter $1"
55     read val
56   done
57 }
58
59 echo "========================================================"
60 echo "This script will create a set of configurations in your "
61 echo "home directory ($HOME) for you to customize"
62 echo "In addition we create an initial set of users and groups"
63 echo "which allow an initial system to run"
64 echo ""
65 echo "Further changes can then be made to the running quickstart"
66 echo "using the tools provided"
67 echo ""
68 echo "The following information will be requested:"
69 echo "  One or more administrative group names"
70 echo "  One or more administrative users"
71 echo "  One or more non-administrative users"
72 echo ""
73 echo "The ldap directory will be initialised with this information"
74 echo "then you will provide the account which will be made superuser"
75 echo "which must be one of those supplied above."
76 echo "========================================================"
77
78 # Ensure we shut down the directory server at program termination
79 # or after we received a signal:
80 trap 'shutdownServer' 0
81 trap "exit 2" 1 2 3 15
82
83 #XXif [ -d "$HOME/bwbuild" ] ; then
84 #XX  echo "========================================================"
85 #XX  echo "You already have a bwbuild in user home $HOME"
86 #XX  echo "Enter 'yes' to continue with the directory unchanged"
87 #XX  echo "(you may need to update it afterwards)"
88 #XX  echo "Enter anything else to terminate the install allowing "
89 #XX  echo "you to rename or destroy it."
90 #XX  echo "========================================================"
91 #XX
92 #XX  echo "Continue? yes/no"
93 #XX  read reply
94 #XX
95 #XX  if [ "$reply" != "yes" ] ; then
96 #XX    exit 1
97 #XX  fi
98 #XXelse
99 #XX  cp $BEDEWORK_HOME/config/bwbuild $USER_HOME
100 #XXfi
101
102 $qsant install-configs
103
104   echo "========================================================"
105   echo "We need to create a new ldap directory for the quickstart"
106 #  <!-- This after 3.5
107 #  <echo message="or copy a previous quickstart ldap directory into the new quickstart" />
108 #  -->
109   echo "========================================================"
110
111   echo "Starting directory server"
112
113   export DS_OPTS="-Dapacheds.log.dir=$DS_HOME/logs"
114   cd $DS_HOME && ./apacheds.sh &
115
116   echo "Pausing while the server starts"
117
118   sleep 10
119
120 $qsant initDirForQuickstart
121
122 echo "Now we invoke the adduser script to add a superuser to the system"
123 echo "We need to know the account, first name last name and a password"
124
125 readVal "account"
126 rootAccount=$val
127 adduser_defs="-Dorg.bedework.directory.account=$val"
128
129 readVal "firstname"
130 adduser_defs="$adduser_defs -Dorg.bedework.directory.firstname=$val"
131
132 readVal "lastname"
133 adduser_defs="$adduser_defs -Dorg.bedework.directory.lastname=$val"
134
135 readVal "password"
136 adduser_defs="$adduser_defs -Dorg.bedework.directory.password=$val"
137
138 $qsantrunner $adduser_defs $ant_class_def addUser
139
140 exit 2
141
142 $qsant addUserPrompt
143
144   DIRTOOL_HOME=$BEDEWORK_HOME/projects/bwtools
145   DIRTOOL_CP=$libcache/commons-codec-1.3.jar:$libcache/log4j-1.2.8.jar
146   DIRTOOL_CP=$DIRTOOL_CP:$BEDEWORK_HOME/dist/bw-tools-3.5.jar
147   dirtool="$JAVA_HOME/bin/java -classpath $DIRTOOL_CP org.bedework.tools.directory.DirTool"
148
149 #  $dirtool -initSystem
150 superuser
151   superuser=
152   until [ "$superuser" != "" ] ; do
153     echo "Enter superuser account"
154     read superuser
155
156     if [ "$superuser" != "" ] ; then
157       $dirtool -userExists $superuser
158       dirstat=$?
159       echo "status is $dirstat"
160       if [ "$dirstat" != "0" ] ; then
161         echo "user $superuser does not exist"
162         superuser=
163       fi
164     fi
165   done
166
167
168
169   echo "create data"
Note: See TracBrowser for help on using the browser.