5 [ "$1" = "configure" ] || exit 0
6 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx
11 . /usr/share/carnet-tools/functions.sh
13 if [ -f /etc/mysql/my.cnf ]; then
14 # ukljuci networking, da mysql visi na portu 3306
15 cp_check_and_sed '^skip-networking' \
16 's/^skip-networking$/#skip-networking/' \
17 /etc/mysql/my.cnf && restart=yes || true
19 # ukljuci podrsku za innodb, istinabog neznam zasto, al neka :-)
20 cp_check_and_sed '^skip-innodb$' \
21 's/^skip-innodb$/#skip-innodb/' \
22 /etc/mysql/my.cnf && restart=yes || true
24 # izgasi logiranje zbog prelude logova
25 cp_check_and_sed '^log.*mysql.log' \
26 "s,^\([\t ]*log[\t ]*=\),#\1," \
27 /etc/mysql/my.cnf && restart=yes || true
30 # pristup samo sa lokalne mreze, preko tcp-wrappera...
32 if ! grep -q '^mysqld' /etc/hosts.deny; then
33 echo "mysqld: ALL" >> /etc/hosts.deny
35 if ! grep -q '^mysqld' /etc/hosts.allow; then
36 echo "mysqld: .$DOMAIN 127.0.0.1" >> /etc/hosts.allow
39 # ako nije setiran admin pass, setiraj
40 [ -f ~root/.my.cnf ] && grep -q "password.*=" ~root/.my.cnf && rootmycnf=1
41 if [ -z "$rootmycnf" ]; then
42 if ! grep -q "password.*=" /etc/mysql/my.cnf; then
43 if echo | mysql mysql 2> /dev/null; then
45 mysqladmin password $mypwd
46 cp_echo "CN: Password for MySQL administrator (root@localhost) is: $mypwd"
52 if su - nobody -c '[ -r ~root/.my.cnf ]' 2>&1 > /dev/null; then
53 if grep -q "password.*=" ~root/.my.cnf; then
54 echo "CN: WARNING: ~root/.my.cnf is world readable."
58 [ "$restart" = "yes" ] || exit 0
60 if [ -x /usr/sbin/invoke-rc.d ]; then
61 [ -x /etc/init.d/mysql ] && invoke-rc.d mysql restart
63 [ -x /etc/init.d/mysql ] && /etc/init.d/mysql restart