#!/bin/sh set -e [ "$1" = "configure" ] || exit 0 [ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx PKG="mysql-cn" # Load CARNet Tools . /usr/share/carnet-tools/functions.sh if [ -f /etc/mysql/my.cnf ]; then # iskljuci zastarjelu opciju cp_check_and_sed '^skip-networking' \ 's/^skip-networking$/#skip-networking/' \ /etc/mysql/my.cnf && restart=yes || true # ukljuci podrsku za innodb, istinabog neznam zasto, al neka :-) cp_check_and_sed '^skip-innodb$' \ 's/^skip-innodb$/#skip-innodb/' \ /etc/mysql/my.cnf && restart=yes || true # izgasi logiranje zbog prelude logova cp_check_and_sed '^log.*mysql.log' \ "s,^\([\t ]*log[\t ]*=\),#\1," \ /etc/mysql/my.cnf && restart=yes || true # iskljuci zastarjeli skip-bdb cp_check_and_sed '^skip-bdb' \ 's/^skip-bdb$/#skip-bdb/' \ /etc/mysql/my.cnf && restart=yes || true fi # pristup samo sa lokalne mreze, preko tcp-wrappera... DOMAIN=`hostname -d` if ! grep -q '^mysqld' /etc/hosts.deny; then echo "mysqld: ALL" >> /etc/hosts.deny fi if ! grep -q '^mysqld' /etc/hosts.allow; then echo "mysqld: .$DOMAIN 127.0.0.1" >> /etc/hosts.allow fi # ako nije setiran admin pass, setiraj [ -f ~root/.my.cnf ] && grep -q "password.*=" ~root/.my.cnf && rootmycnf=1 if [ -z "$rootmycnf" ]; then if ! grep -q "password.*=" /etc/mysql/my.cnf; then if echo | mysql mysql 2> /dev/null; then mypwd="`makepasswd`" mysqladmin password $mypwd cp_echo "CN: Password for MySQL administrator (root@localhost) is: $mypwd" cp_mail $PKG fi fi fi if su - nobody -c '[ -r ~root/.my.cnf ]' 2>&1 > /dev/null; then if grep -q "password.*=" ~root/.my.cnf; then echo "CN: WARNING: ~root/.my.cnf is world readable." fi fi [ "$restart" = "yes" ] || exit 0 # restart mysql-a if [ -x /usr/sbin/invoke-rc.d ]; then [ -x /etc/init.d/mysql ] && invoke-rc.d mysql restart else [ -x /etc/init.d/mysql ] && /etc/init.d/mysql restart fi #DEBHELPER#