File: create_db.sh.in

package info (click to toggle)
tango 9.3.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 95,792 kB
  • sloc: cpp: 138,382; sh: 8,009; ansic: 1,083; makefile: 996; java: 800; python: 264; xml: 54
file content (42 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
mysql=@MYSQL@
mysql_admin=@MYSQL_ADMIN@
mysql_admin_passwd=@MYSQL_ADMIN_PASSWD@
mysql_host=@MYSQL_HOST@
db_name=@TANGO_DB_NAME@


if test "x$mysql_admin" = "x"; then
	user_switch="";
else
	user_switch="-u$x$mysql_admin";
fi

if test "x$mysql_admin_passwd" = "x"; then
   passwd_switch="";
else
   passwd_switch="-p$mysql_admin_passwd"
fi

if test "x$mysql_host" = "x"; then
  host_switch="";
else
  host_switch="-h$mysql_host";
fi




connect="$mysql $user_switch $passwd_switch $host_switch $db_name"

if `echo quit | $connect >/dev/null 2>&1`; then
   if test "x$mysql_host" = "x"; then
      echo "The $db_name database is already defined on this host"
   else
      echo "The $db_name database is already defined on $mysql_host"
   fi
   echo "Please run "
   echo "$connect < ./update_db.sql"
   echo "manually to force a db update"
else
  $mysql $user_switch $passwd_switch $host_switch < ./create_db.sql > /dev/null
fi