--- DarthVader/docs/install_GL_PARAM.sh 2006/11/07 17:12:50 1.3 +++ DarthVader/docs/install_GL_PARAM.sh 2006/11/09 17:05:51 1.4 @@ -3,23 +3,11 @@ USERNAME=${PAM_DBUSER} HOST="" DBNAME="" +FORCE="no" COUNT=0;for word in `echo ${PAM_DBHOST} | tr [\/] [" "] |tr [?] [" "] |sed 's/mysql://g' `; do if [ $COUNT -eq 0 ]; then HOST=`echo $word`; fi; if [ $COUNT -eq 1 ]; then DBNAME=`echo $word`; fi; let COUNT=$COUNT+1; done PASSWORD=${PAM_DBPSW} if [ $# -gt 0 ]; then - I=1 - while [ $I -le $# ]; do - if [ $I -eq 1 ]; then - INPUT=$1 - fi - if [ $I -eq 2 ]; then - INPUT=$2 - fi - if [ $I -eq 3 ]; then - INPUT=$3 - fi - if [ $I -eq 4 ]; then - INPUT=$4 - fi + for INPUT in $*; do if [ $INPUT == "--help" ] || [ $INPUT == "-h" ]; then echo "" echo " Usage: ./install_GL_PARAM.sh [options] " @@ -32,6 +20,8 @@ echo "" echo " --psw=password : MySQL password" echo "" + echo " --force : do not wait [default: wait]" + echo "" exit 0 fi TEST=`echo $INPUT | sed 's/--user=//g'` @@ -50,7 +40,10 @@ PASSWORD=`echo $TEST` export PASSWORD; fi - let I=$I+1 + if [ "$INPUT" == "--force" ]; then + FORCE="yes"; + export FORCE; + fi done else if [ "$USERNAME" == "" ] || [ "$HOST" == "" ] || [ "$DBNAME" == "" ]; then @@ -70,9 +63,14 @@ fi; echo "" echo " Updating GL_PARAM table on DB $DBNAME, $HOST with user $USERNAME and password $PASSWORD " -echo " (you have 30 seconds to stop me using CTRL+c) " echo "" -sleep 30; +if [ "$FORCE" == "no" ]; then + echo " WARNING: if already existing the GL_PARAM table will be RECREATED and you will LOSE all data in that table! " + echo "" + echo " =======> You have 30 seconds to stop me using CTRL+c <======= " + echo "" + sleep 30; +fi; echo " Updating GL_PARAM table" # rm -rf ${THISDIR}/temp.sql @@ -88,7 +86,8 @@ echo "" echo "GL_PARAM TABLE NOW CONTAINS:" echo "" -echo "select * from GL_PARAM;" > ${THISDIR}/temp.sql +echo "SET time_zone='+0:00';" > ${THISDIR}/temp.sql +echo "select * from GL_PARAM;" >> ${THISDIR}/temp.sql mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql echo "" echo "Please check that path and names are correct."