/[PAMELA software]/DarthVader/docs/install_GL_PARAM.sh
ViewVC logotype

Diff of /DarthVader/docs/install_GL_PARAM.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mocchiut, Wed Sep 6 15:20:21 2006 UTC revision 1.3 by mocchiut, Tue Nov 7 17:12:50 2006 UTC
# Line 1  Line 1 
1  #!/bin/bash --norc  #!/bin/bash --norc
2  THISDIR=`pwd`  THISDIR=`pwd`
3  USERNAME=""  USERNAME=${PAM_DBUSER}
4  HOST=""  HOST=""
5  DBNAME=""  DBNAME=""
6  PASSWORD=""  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
7  if [ $# -gt 0 ] && [ $# -le 4 ]; then  PASSWORD=${PAM_DBPSW}
8    if [ $# -gt 0 ]; then
9      I=1      I=1
10      while [ $I -le $# ]; do      while [ $I -le $# ]; do
11          if [ $I -eq 1 ]; then          if [ $I -eq 1 ]; then
# Line 40  if [ $# -gt 0 ] && [ $# -le 4 ]; then Line 41  if [ $# -gt 0 ] && [ $# -le 4 ]; then
41          fi          fi
42          TEST=`echo $INPUT | sed 's/--host=//g'`          TEST=`echo $INPUT | sed 's/--host=//g'`
43          if [ $TEST != $INPUT  ]; then          if [ $TEST != $INPUT  ]; then
44              COUNT=0;for word in `echo $TEST | 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              COUNT=0;for word in `echo $TEST | 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
45              export DBNAME;              export DBNAME;
46              export HOST;              export HOST;
47          fi          fi
# Line 52  if [ $# -gt 0 ] && [ $# -le 4 ]; then Line 53  if [ $# -gt 0 ] && [ $# -le 4 ]; then
53          let I=$I+1          let I=$I+1
54      done      done
55  else  else
56      echo ""      if [ "$USERNAME" == "" ] || [ "$HOST" == "" ] || [ "$DBNAME" == "" ]; then
57      echo " Usage: ./install_GL_PARAM.sh [options] "          echo ""
58      echo ""          echo " Usage: ./install_GL_PARAM.sh [options] "
59      echo " Options: "          echo ""
60      echo ""          echo " Options: "
61      echo " --user=username : MySQL username. "          echo ""
62      echo ""          echo " --user=username : MySQL username. "
63      echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."          echo ""
64      echo ""          echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."
65      echo " --psw=password :  MySQL password"          echo ""
66      echo ""              echo " --psw=password :  MySQL password"
67      exit 0          echo ""    
68            exit 0
69        fi
70  fi;  fi;
71    echo ""
72    echo " Updating GL_PARAM table on DB $DBNAME, $HOST with user $USERNAME and password $PASSWORD "
73    echo "               (you have 30 seconds to stop me using CTRL+c)       "
74    echo ""
75    sleep 30;
76    echo " Updating GL_PARAM table"
77  #  #
78  rm -rf ${THISDIR}/temp.sql  rm -rf ${THISDIR}/temp.sql
79  PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g')  PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g')
# Line 75  mysql --user=$USERNAME --password=$PASSW Line 84  mysql --user=$USERNAME --password=$PASSW
84  cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql  cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql
85  mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql  mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
86  #  #
87    echo " done! "
88  echo ""  echo ""
89  echo "GL_PARAM TABLE NOW CONTAINS:"  echo "GL_PARAM TABLE NOW CONTAINS:"
90  echo ""  echo ""

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23