File: mysql.get

package info (click to toggle)
wwwconfig-common 0.3.0
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • sloc: sh: 952; makefile: 5
file content (45 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download | duplicates (4)
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
43
44
45
# File:		mysql.get
# Changes:
#	20010224 Ola Lundqvist <opal@debian.org>
#	20011022 Luca De Vitis <luca@debian.org>
#		Allowed reinclusion.
#	20020116 Ola Lundqvist <opal@debian.org>
#		Documented the reinclusion.
#	20020126 Ola Lundqvist <opal@debian.org>
#		Removed the reinclusion.
#	20040216 Marc Horowitz <marc@mit.edu>
#		Support using a socket connection to the server
#	20040915 Ola Lundqvist <opal@debian.org>
#		Quote mysql password so it can have other chars in it.
#       20060314 Ola Lundqvist <opal@debian.org>,
#                Manu Benoit <tseeker@nocternity.net>
#		Allow passwords to contain quotes.
#       20080424 Ola Lundqvist <opal@debian.org>
#               Removed single quotes for dbserver according to bug report
#               #477624 from Bryan McLellan <btm@loftninjas.org>.
# Needs:	$dbserver  - the server to connect to.
#		$dbadmin   - the administrator name.
#		$dbadmpass - the administrator password.
# Sets:		$mysqlcmd so that administration access are prepared

if [ -z "$dbserver" ] || [ "$dbserver" = "localhost" ]; then
	hostopt=""
    dbserver=localhost
else
    case "$dbserver" in
	:*)
	    dbsocket=`echo $dbserver | sed -e 's/^://'`
	    hostopt="-S $dbsocket"
	    ;;
	*)
	    hostopt="-h $dbserver"
	    ;;
    esac
fi
if [ -z "$dbadmpass" ] ; then
    log="${log}No password used."
    passopt=""
else
    passopt="--password='"`echo "$dbadmpass" | sed -e "s/'/'"'"'"'"'"'"'/g"`"'"
fi
mysqlcmd="mysql $hostopt $passopt -u $dbadmin"