| 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 |
# |
|---|
| 141 |
# Now unzip the dump/restore package and run it to initialise the system |
|---|
| 142 |
# |
|---|
| 143 |
|
|---|
| 144 |
cd $BEDEWORK_HOME/dist |
|---|
| 145 |
rm -r temp |
|---|
| 146 |
mkdir temp |
|---|
| 147 |
cd temp |
|---|
| 148 |
unzip ../dumpres.zip |
|---|
| 149 |
cd dumpres |
|---|
| 150 |
chmod +x bwrun |
|---|
| 151 |
|
|---|
| 152 |
cd $QUICKSTART_HOME |
|---|
| 153 |
|
|---|
| 154 |
$qsantrunner "-Dorg.bedework.newsys.rootid=$rootAccount" $ant_class_def create-newsys |
|---|