Ubuntu Pastebin

Paste from sash_ at Sat, 29 Apr 2017 10:46:13 +0000

Download as text
 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
### Mariadb ###

# Create the credentials file if not present. On all new installs the
    # root account can be used directly for maintenance authenticated by
    # unix socket and on new installs there is no need to define a
    # separate Debian maintenance user account.
    dc=$mysql_cfgdir/debian.cnf;
    if [ ! -d "$mysql_cfgdir" ]; then
      install -o 0 -g 0 -m 0755 -d $mysql_cfgdir
    fi
    if [ ! -e "$dc" ]; then
      umask 066
      cat /dev/null > $dc
      umask 022
      echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc
      echo "[client]"                                                    >>$dc
      echo "host     = localhost"                                        >>$dc
      echo "user     = root"                                             >>$dc
      echo "password = "                                                 >>$dc
      echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
      echo "[mysql_upgrade]"                                             >>$dc
      echo "host     = localhost"                                        >>$dc
      echo "user     = root"                                             >>$dc
      echo "password = "                                                 >>$dc
      echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
      echo "basedir  = /usr"                                             >>$dc
    fi







### Mysql ###

# recreate the credentials file if not present or without mysql_upgrade stanza
    dc=$mysql_cfgdir/debian.cnf; 
    if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
      pass="`sed -n 's/^[     ]*password *= *// p' $dc | head -n 1`"
      # Basedir is deprecated. Remove the option if it's in an existing debian.cnf
      sed -i '/basedir/d' "$dc"
    else
      pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
      if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi
      umask 066
      cat /dev/null > $dc
      umask 022
      echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc
      echo "[client]"                                                    >>$dc
      echo "host     = localhost"                                        >>$dc
      echo "user     = debian-sys-maint"                                 >>$dc
      echo "password = $pass"                                            >>$dc
      echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
      echo "[mysql_upgrade]"                                             >>$dc
      echo "host     = localhost"                                        >>$dc
      echo "user     = debian-sys-maint"                                 >>$dc
      echo "password = $pass"                                            >>$dc
      echo "socket   = $mysql_rundir/mysqld.sock"                        >>$dc
    fi
Download as text