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

Contents of /DarthVader/docs/install_GL_PARAM.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download) (as text)
Tue Apr 17 12:03:18 2007 UTC (17 years, 7 months ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +0 -0 lines
File MIME type: application/x-sh
FILE REMOVED
install_GL_PARAM.* moved into profiler, parameters still here... to be fixed?

1 #!/bin/bash --norc
2 THISDIR=`pwd`
3 USERNAME=${PAM_DBUSER}
4 HOST=""
5 DBNAME=""
6 FORCE="no"
7 STATIC="no"
8 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
9 PASSWORD=${PAM_DBPSW}
10 if [ $# -gt 0 ]; then
11 for INPUT in $*; do
12 if [ $INPUT == "--help" ] || [ $INPUT == "-h" ]; then
13 echo ""
14 echo " Usage: ./install_GL_PARAM.sh [options] "
15 echo ""
16 echo " Options: "
17 echo ""
18 echo " --user=username : MySQL username. "
19 echo ""
20 echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."
21 echo ""
22 echo " --psw=password : MySQL password"
23 echo ""
24 echo " --force : do not wait [default: wait]"
25 echo ""
26 echo " --static : use static path instead of symbolic ones ($PAM_CALIB) [default: no]"
27 echo ""
28 exit 0
29 fi
30 TEST=`echo $INPUT | sed 's/--user=//g'`
31 if [ $TEST != $INPUT ]; then
32 USERNAME=`echo $TEST`
33 export USERNAME;
34 fi
35 TEST=`echo $INPUT | sed 's/--host=//g'`
36 if [ $TEST != $INPUT ]; then
37 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
38 export DBNAME;
39 export HOST;
40 fi
41 TEST=`echo $INPUT | sed 's/--psw=//g'`
42 if [ $TEST != $INPUT ]; then
43 PASSWORD=`echo $TEST`
44 export PASSWORD;
45 fi
46 if [ "$INPUT" == "--force" ]; then
47 FORCE="yes";
48 export FORCE;
49 fi
50 if [ "$INPUT" == "--static" ]; then
51 STATIC="yes";
52 export STATIC;
53 fi
54 done
55 else
56 if [ "$USERNAME" == "" ] || [ "$HOST" == "" ] || [ "$DBNAME" == "" ]; then
57 echo ""
58 echo " Usage: ./install_GL_PARAM.sh [options] "
59 echo ""
60 echo " Options: "
61 echo ""
62 echo " --user=username : MySQL username. "
63 echo ""
64 echo " --host=mysql://localhost/pamelaprod : MySQL host and DB name."
65 echo ""
66 echo " --psw=password : MySQL password"
67 echo ""
68 exit 0
69 fi
70 fi;
71 echo ""
72 echo " Updating GL_PARAM table on DB $DBNAME, $HOST with user $USERNAME and password $PASSWORD "
73 echo ""
74 if [ "$FORCE" == "no" ]; then
75 echo " WARNING: if already existing the GL_PARAM table will be RECREATED and you will LOSE all data in that table! "
76 echo ""
77 echo " =======> You have 30 seconds to stop me using CTRL+c <======= "
78 echo ""
79 sleep 30;
80 fi;
81 echo " Updating GL_PARAM table"
82 #
83 rm -rf ${THISDIR}/temp.sql
84 PAM_CALIB2=$(echo $PAM_CALIB | sed 's/\//\\\//g')
85 #
86 echo "delete from GL_PARAM;" > ${THISDIR}/temp.sql
87 mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
88 #
89 if [ "$STATIC" == "no" ]; then
90 cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/$PAM_CALIB/g' >> ${THISDIR}/temp.sql
91 else
92 cat ${THISDIR}/install_GL_PARAM.sql | sed 's/fullpathgoesere/'${PAM_CALIB2}'/g' >> ${THISDIR}/temp.sql
93 fi;
94 mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
95 #
96 echo " done! "
97 echo ""
98 echo "GL_PARAM TABLE NOW CONTAINS:"
99 echo ""
100 echo "SET time_zone='+0:00';" > ${THISDIR}/temp.sql
101 echo "select * from GL_PARAM;" >> ${THISDIR}/temp.sql
102 mysql --user=$USERNAME --password=$PASSWORD --host=$HOST $DBNAME < ${THISDIR}/temp.sql
103 echo ""
104 echo "Please check that path and names are correct."
105 echo ""
106 #
107 rm -rf ${THISDIR}/temp.sql

  ViewVC Help
Powered by ViewVC 1.1.23