Update of /cvsroot/fink/experimental/thesin/finkinfo
In directory vz-cvs-3.sog:/tmp/cvs-serv13782

Added Files:
        dbd-mysql-pm.info mysql-server-5.5.info mysql-server-5.5.patch 
Log Message:
New MySQL 5.5 properly packaged and working beautifully and fast

--- NEW FILE: mysql-server-5.5.info ---
Package: mysql-server-5.5
Version: 5.5.24
Revision: 1
###
BuildDepends: libncurses5 (>= 5.0-6), readline6, po-debconf, cmake
Depends: mysql-common (= %v-%r), mysql-client-5.5 (= %v-%r), 
mysql-server-core-5.5 (= %v-%r), libmysqlclient18-shlibs (= %v-%r), dbi-pm, 
daemonic, debconf
Recommends: mailx, html-template-pm
Provides: virtual-mysql-server
Replaces: mysql-unified, mysql-unified-client
Conflicts: mysql-unified, mysql-unified-client
###
Source: mirror:debian:/pool/main/m/mysql-5.5/mysql-5.5_%v+dfsg.orig.tar.gz
SourceDirectory: mysql-5.5-%v+dfsg.orig
Source-MD5: 7212bcd7cd8a953a65d78a707ad97575
###
PatchFile: %n.patch
PatchFile-MD5: f81ef08184663ba79c759fe71179db29
PatchScript: <<
  sed -e 's,@FINKPREFIX@,%p,g' %{PatchFile} | patch -p1

  ### Include more patches, mostly from debian build
  patch -p1 < fink/patches/1_hurd.patch
  patch -p1 < fink/patches/2_main_openssl_1.patch
  patch -p1 < fink/patches/38_scripts__mysqld_safe.sh__signals.patch
  patch -p1 < fink/patches/62_disable_tests.patch
  patch -p1 < fink/patches/70_mysql_va_list.patch
  patch -p1 < fink/patches/71_disable_rpl_tests.patch
  patch -p1 < fink/patches/72_fix_standalone_tests.patch
  patch -p1 < fink/patches/73_mysqlcheck_tests.patch
  patch -p1 < fink/patches/93_kfreebsd_tests.patch
  patch -p1 < fink/patches/94_spelling.patch
  patch -p1 < fink/patches/regex_plus.patch
  patch -p1 < fink/patches/versioned_symbols.patch

  # Fix for cmake >= 2.8.8 and using fink's readline6
  patch -p1 < fink/patches/cmake_2.8.8_fix.patch
  patch -p1 < fink/patches/cmake_readline_fix.patch
  patch -p1 < fink/patches/disable_math_test.patch

  # Fix po stuff
  perl -pi -e 's,debian-,fink-,g' fink/po/*
  perl -pi -e 's,\/etc\/init\.d\/mysql,%p\/sbin\/mysqlctl,g' fink/po/*
  perl -pi -e 's,\/usr,%p,g' fink/po/*
  perl -pi -e 's,\/etc,%p\/etc,g' fink/po/*
  perl -pi -e 's,\/var,%p\/var,g' fink/po/*
<<
###
ConfFiles: <<
  %p/etc/logrotate.d/mysql-server
  %p/etc/mysql/conf.d/mysqld_safe_syslog.cnf
  %p/etc/mysql/fink-start
  %p/etc/logcheck/ignore.d.workstation/mysql-server-5_5
  %p/etc/logcheck/ignore.d.server/mysql-server-5_5
  %p/etc/logcheck/ignore.d.paranoid/mysql-server-5_5
<<
###
DaemonicName: mysql
DaemonicFile: <<
 <service>
  <description>MySQL database server</description>
  <message>MySQL database server</message>

  <daemon name="mysql">
    <executable background="yes">%p/sbin/mysqlctl</executable>
    <parameters> start</parameters>
  </daemon>
 </service>
<<
###
DocFiles: COPYING INSTALL-SOURCE README VERSION
###
SetCFLAGS: -arch x86_64 -m64 -O2 -DBIG_JOINS=1 -fno-strict-aliasing 
-Wno-gnu-designator -Wno-deprecated
SetCXXFLAGS: -arch x86_64 -m64 -O3 -DBIG_JOINS=1 -felide-constructors 
-fno-exceptions -fno-rtti -fno-strict-aliasing -Wno-gnu-designator 
-Wno-deprecated
SetLDFLAGS: -arch x86_64 -m64
###
CompileScript: <<
( test -d %b/builddir || mkdir %b/builddir ) && cd %b/builddir && \
cmake   -DCMAKE_INSTALL_PREFIX=%p \
        -DCMAKE_VERBOSE_MAKEFILE=ON \
        -DMYSQL_DATADIR=%p/var/lib/mysql \
        -DMYSQL_UNIX_ADDR=%p/var/run/mysqld/mysqld.sock \
        -DMYSQL_USER=mysql \
        -DWITH_LIBWRAP=ON \
        -DWITH_READLINE=OFF \
        -DWITH_LIBEDIT=OFF \
        -Dreadline_INCLUDE_DIR=%p/include \
        -Dreadline_LIBRARY=%p/lib/libreadline.dylib \
        -DCURSES_CURSES_H_PATH:PATH=%p/include \
        -DCURSES_CURSES_LIBRARY:FILEPATH=%p/lib/libcurses.dylib \
        -DCURSES_FORM_LIBRARY:FILEPATH=%p/lib/libform.dylib \
        -DCURSES_HAVE_CURSES_H:FILEPATH=%p/include/curses.h \
        -DCURSES_INCLUDE_PATH:FILEPATH=%p/include \
        -DCURSES_LIBRARY:FILEPATH=%p/lib/libcurses.dylib \
        -DCURSES_NCURSES_LIBRARY:FILEPATH=%p/lib/libncurses.dylib \
        -DWITH_SSL=bundled \
        -DCOMPILATION_COMMENT="(Fink)" \
        -DMYSQL_SERVER_SUFFIX="-5.5" \
        -DSYSTEM_TYPE="fink-darwin-gnu" \
        -DINSTALL_LAYOUT=RPM \
        -DINSTALL_LIBDIR=lib \
        -DINSTALL_PLUGINDIR=lib/mysql/plugin \
        -DINSTALL_MYSQLDATADIR=%p/var/lib/mysql \
        -DWITH_EMBEDDED_SERVER=ON \
        -DHAVE_EMBEDDED_PRIVILEGE_CONTROL=ON \
        -DWITH_ARCHIVE_STORAGE_ENGINE=ON \
        -DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
        -DWITH_FEDERATED_STORAGE_ENGINE=ON \
        -DWITH_EXTRA_CHARSETS=all ..
cd %b/builddir && make
<<
InstallScript: <<
# some self written manpages which hopefully
# gets overwritten sooner or later with upstreams
install -d -m 0755 %i/share/man/man1
install -d -m 0755 %i/share/man/man8
install -m 0644 fink/additions/*.1 %i/share/man/man1/

install -d -m 0755 %i/etc/mysql/conf.d
touch %i/etc/mysql/conf.d/.keepme
install -m 0644 fink/additions/my.cnf %i/etc/mysql/
install -m 0644 fink/additions/mysqld_safe_syslog.cnf %i/etc/mysql/conf.d/

# make install (trailing slash needed for innobase)
cd %b/builddir && make install DESTDIR=%d

# libmysqlclient_r is now a symlink to libmysqlclient. But it is
# created wrong by the cmake build system and points at
# libmysqlclient.dylib instead of the corresponding versioned lib.
for i in `ls %i/lib/libmysqlclient.*.dylib` ; do \
        rlib=`basename $i | sed -e 's/libmysqlclient\./libmysqlclient_r./'` ;\
        ln -sf `basename $i` %i/lib/$rlib ;\
done

# mysql-testsuite
mv %i/share/mysql-test %i/lib/mysql-testsuite

# mysql-client
install -m 0755 fink/additions/mysqlreport %i/bin/
install -m 0755 fink/additions/innotop/innotop %i/bin/
install -m 0644 fink/additions/innotop/innotop.1 %i/share/man/man1/
ln -s %p/bin/mysqlcheck %i/bin/mysqlrepair
ln -s %p/bin/mysqlcheck %i/bin/mysqlanalyze
ln -s %p/bin/mysqlcheck %i/bin/mysqloptimize
ln -s %p/share/man/man1/mysqlcheck.1 %i/share/man/man1/mysqlrepair.1
ln -s %p/share/man/man1/mysqlcheck.1 %i/share/man/man1/mysqlanalyze.1
ln -s %p/share/man/man1/mysqlcheck.1 %i/share/man/man1/mysqloptimize.1

# mysql-server
install -d -m 0755 %i/share/doc/%n/examples
mv %i/share/mysql/*cnf %i/share/doc/%n/examples/
rm -vf %i/share/mysql/mi_test_all* \
       %i/share/mysql/mysql-log-rotate \
       %i/share/mysql/mysql.server \
       %i/share/mysql/binary-configure
nm -n %b/builddir/sql/mysqld |gzip -9 > %i/share/doc/%n/mysqld.sym.gz
install -m 0755 fink/additions/echo_stderr %i/share/mysql/
install -m 0755 fink/additions/fink-start %i/etc/mysql/
install -m 0755 fink/additions/fink-start.inc.sh %i/share/mysql/

# start/stop script
install -m 0755 fink/%n.mysql.init %i/sbin/mysqlctl

# logcheck
install -d -m 0755 %i/etc/logcheck/ignore.d.paranoid
install -m 0644 fink/%n.logcheck.ignore.paranoid 
%i/etc/logcheck/ignore.d.paranoid/mysql-server-5_5
install -d -m 0755 %i/etc/logcheck/ignore.d.server
install -m 0644 fink/%n.logcheck.ignore.server 
%i/etc/logcheck/ignore.d.server/mysql-server-5_5
install -d -m 0755 %i/etc/logcheck/ignore.d.workstation
install -m 0644 fink/%n.logcheck.ignore.workstation 
%i/etc/logcheck/ignore.d.workstation/mysql-server-5_5

# logrotate
install -d -m 0755 %i/etc/logrotate.d
install -m 0644 fink/%n.mysql-server.logrotate %i/etc/logrotate.d/mysql-server

# remove empty dir, and superflous files
rm -rf %i/share/info
rm -vf %i/bin/mysql_client_test_embedded \
       %i/bin/mysql_embedded \
       %i/bin/mysqltest_embedded \
       %i/bin/mysqlaccess.conf

# debconf
po2debconf fink/%n.templates > fink/%n.templates.merged
install -m 0755 fink/%n.config %d/DEBIAN/config
install -m 0755 fink/%n.templates.merged %d/DEBIAN/templates
<<
InfoTest: <<
  TestScript: <<
    cp unittest/unit.pl %b/builddir/unittest/
    cp -r mysql-test/* %b/builddir/mysql-test/
    cp -r sql/share/* %b/builddir/sql/share/
    cp -r scripts/*sql %b/builddir/scripts/
    cd %b/builddir && make -j1 test-force || exit 2
  <<
<<
###
SplitOff: <<
  Package: libmysqlclient18-shlibs
  Depends: mysql-common (= %v-%r)
  Description: MySQL database client library
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes the client library.
  <<
  Files: <<
    lib/libmysqlclient.*.dylib
    lib/libmysqlclient_r.*.dylib
  <<
  Shlibs: <<
    %p/lib/libmysqlclient.18.dylib 18.0.0 libmysqlclient-shlibs (>= 5.5.24-1)
    %p/lib/libmysqlclient_r.18.dylib 18.0.0 libmysqlclient-shlibs (>= 5.5.24-1)
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
SplitOff2: <<
  Package: libmysqld18-dev
  BuildDependsOnly: true
  Replaces: mysql-unified-dev
  Conflicts: mysql-unified-dev
  Description: MySQL embedded database development files
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes the embedded server library and header files.
  <<
  Files: <<
    lib/libmysqld.a
    lib/libmysqlservices.a
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
SplitOff3: <<
  Package: libmysqlclient18-dev
  Depends: libmysqlclient18-shlibs (= %v-%r)
  BuildDependsOnly: true
  Provides: virtual-mysql-dev
  Replaces: mysql-unified-dev
  Conflicts: mysql-unified-dev
  Description: MySQL database development files
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes development libraries and header files.
  <<
  Files: <<
    bin/mysql_config
    include
    lib/libmysqlclient.{a,dylib}
    lib/libmysqlclient_r.{a,dylib}
    share/aclocal
    share/man/man1/mysql_config.1
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
SplitOff4: <<
  Package: mysql-common
  ConfFiles: <<
    %p/etc/mysql/conf.d/.keepme
    %p/etc/mysql/my.cnf
  <<
  Description: MySQL database common files, e.g. my.cnf
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes files needed by all versions of the client library,
e.g. %p/etc/mysql/my.cnf.
  <<
  Files: <<
    etc/mysql/my.cnf
    etc/mysql/conf.d/.keepme
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
  PostRmScript: <<
set -e

if [ "$1" = "purge" ]; then
  rmdir %p/etc/mysql 2>/dev/null || true
fi
  <<
<<
###
SplitOff5: <<
  Package: mysql-client-5.5
  Depends: libncurses5-shlibs, readline6-shlibs, dbi-pm, mysql-common (= 
%v-%r), libmysqlclient18-shlibs (= %v-%r)
  RuntimeDepends: dbd-mysql-pm5123 | dbd-mysql-pm5124
  Provides: virtual-mysql-client
  Suggests: term-readkey-pm5123 | term-readkey-pm5124
  Replaces: mysql-unified, mysql-unified-client
  Conflicts: mysql-unified, mysql-unified-client
  Description: MySQL database client binaries
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes the client binaries and the additional tools
innotop and mysqlreport.
  <<
  Files: <<
    bin/innochecksum
    bin/innotop
    bin/myisam_ftdump
    bin/mysql
    bin/mysql_client_test
    bin/mysql_find_rows
    bin/mysql_fix_extensions
    bin/mysql_plugin
    bin/mysql_waitpid
    bin/mysqlaccess
    bin/mysqladmin
    bin/mysqlanalyze
    bin/mysqlbug
    bin/mysqlcheck
    bin/mysqldump
    bin/mysqldumpslow
    bin/mysqlimport
    bin/mysqloptimize
    bin/mysqlrepair
    bin/mysqlreport
    bin/mysqlshow
    bin/mysqlslap
    share/man/man1/innotop.1
    share/man/man1/myisam_ftdump.1
    share/man/man1/mysql.1
    share/man/man1/mysql_client_test.1
    share/man/man1/mysql_client_test_embedded.1
    share/man/man1/mysql_find_rows.1
    share/man/man1/mysql_fix_extensions.1
    share/man/man1/mysql_plugin.1
    share/man/man1/mysql_tableinfo.1
    share/man/man1/mysql_waitpid.1
    share/man/man1/mysqlaccess.1
    share/man/man1/mysqladmin.1
    share/man/man1/mysqlanalyze.1
    share/man/man1/mysqlbug.1
    share/man/man1/mysqlcheck.1
    share/man/man1/mysqldump.1
    share/man/man1/mysqldumpslow.1
    share/man/man1/mysqlimport.1
    share/man/man1/mysqlman.1
    share/man/man1/mysqloptimize.1
    share/man/man1/mysqlrepair.1
    share/man/man1/mysqlreport.1
    share/man/man1/mysqlshow.1
    share/man/man1/mysqlslap.1
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
###
SplitOff6: <<
  Package: mysql-server-core-5.5
  Provides: virtual-mysql-server-core
  Replaces: mysql-unified, mysql-unified-client
  Conflicts: mysql-unified, mysql-unified-client
  Description: MySQL database server binaries
  DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes the server binaries but doesn't contain all the
infrastructure needed to setup system databases.
  <<
  Files: <<
    bin/my_print_defaults
    bin/mysql_install_db
    bin/mysql_upgrade
    sbin
    share/man/man1/my_print_defaults.1
    share/man/man1/mysql_install_db.1
    share/man/man1/mysql_upgrade.1
    share/man/man8/mysqld.8
    share/mysql
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
###
SplitOff7: <<
  Package: mysql-testsuite-5.5
  Depends: %N (= %v-%r), mysql-client-5.5 (= %v-%r)
  Description: MySQL testsuite
  DescDetail: <<
MySQL is a fast, stable, and true multi-user, multi-threaded SQL database
server.  SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package includes the MySQL testsuite.
  <<
  Files: <<
    lib/mysql-testsuite
  <<
  DocFiles: COPYING INSTALL-SOURCE README VERSION
<<
###
PreInstScript: <<
#
# summary of how this script can be called:
#        * <new-preinst> install
#        * <new-preinst> install <old-version>
#        * <new-preinst> upgrade <old-version>
#        * <old-preinst> abort-upgrade <new-version>
#

set -e

. %p/share/debconf/confmodule

MYADMIN="%p/bin/mysqladmin --defaults-file=%p/etc/mysql/fink.cnf"
DATADIR=%p/var/lib/mysql
LOGDIR=%p/var/log/mysql
UPGRADEDIR=%p/var/lib/mysql-upgrade

# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running! Another mysqld in e.g. a different chroot is fine for us.
stop_server() {
    if [ ! -x %p/sbin/mysqlctl ]; then return; fi

    set +e
    %p/sbin/mysqlctl stop
    errno=$?
    set -e
   
    # 0=ok, 100=no init script (fresh install)
    if [ "$errno" != 0 -a "$errno" != 100 ]; then
      /bin/echo "${cmd/ */} returned $errno" 1>&2
      /bin/echo "There is a MySQL server running, but we failed in our attempts 
to stop it." 1>&2
      /bin/echo "Stop it yourself and try again!" 1>&2
      db_stop   
      exit 1
    fi
}

################################ main() ##########################

this_version=5.5

# check for old verions for fink mysql
if [ -d "%p/var/mysql" ]; then
    # old mysql detected
    if [ ! -e "$DATADIR" ]; then
        # make a copy of the old one to the new location and preserve the old
        /bin/echo "Found old data copying %p/var/mysql to $DATADIR"
        cp -a %p/var/mysql $DATADIR
    fi
    /bin/echo "Preserving old data, moving %p/var/mysql to %p/var/mysql.old.5.0"
    mv %p/var/mysql %p/var/mysql.old.5.0
fi


# Abort if an NDB cluster is in use.
if egrep -qi -r '^[^#]*ndb.connectstring|^[[:space:]]*\[[[:space:]]*ndb_mgmd' 
%p/etc/mysql/; then
  db_fset mysql-server/no_upgrade_when_using_ndb seen false || true
  db_input high mysql-server/no_upgrade_when_using_ndb || true
  db_go
  db_stop
  exit 1
fi

# Abort if skip-bdb option is enabled, required for 5.0 -> 5.1 upgrades.
#TODO

# Safe the user from stupidities.
show_downgrade_warning=0
for i in `ls $DATADIR/fink-*.flag 2>/dev/null`; do
  found_version=`/bin/echo $i | sed 's/.*fink-\([0-9\.]\+\).flag/\1/'`
  if dpkg --compare-versions "$this_version" '<<' "$found_version"; then
    show_downgrade_warning=1
    break;
  fi
done
if [ "$show_downgrade_warning" = 1 ]; then
  db_fset %N/really_downgrade seen false || true
  db_input medium %N/really_downgrade || true
  db_go
  db_get %N/really_downgrade || true
  if [ "$RET" = "true" ]; then
    rm -f $DATADIR/fink-*.flag
    touch $DATADIR/fink-$this_version.flag
  else
    /bin/echo "Aborting downgrade from (at least) $found_version to 
$this_version." 1>&2
    /bin/echo "If are sure you want to downgrade to $this_version, remove the 
file" 1>&2
    /bin/echo "$DATADIR/fink-*.flag and try installing again." 1>&2
    db_stop
    exit 1
  fi
fi

# to be sure
stop_server

# If we use NIS then errors should be tolerated. It's up to the
# user to ensure that the mysql user is correctly setup.
# Beware that there are two ypwhich one of them needs the 2>/dev/null!
if test -n "`which ypwhich 2>/dev/null`"  &&  ypwhich >/dev/null 2>&1; then
  set +e
fi

# end of NIS tolerance zone
set -e

# if there's a symlink, let's store where it's pointing, because otherwise
# it's going to be lost in some situations
for dir in DATADIR LOGDIR; do
    checkdir=`eval /bin/echo "$"$dir`
    if [ -L "$checkdir" ]; then
        mkdir -p "$UPGRADEDIR"
        cp -d "$checkdir" "$UPGRADEDIR/$dir.link"
    fi
done

# creating mysql home directory
if [ ! -d $DATADIR -a ! -L $DATADIR ]; then
        mkdir $DATADIR
fi

# checking disc space
if LC_ALL=C BLOCKSIZE= /bin/df -k $DATADIR/. | tail -n 1 | awk '{ exit 
($4>1000) }'; then
  /bin/echo "ERROR: There's not enough space in $DATADIR/" 1>&2
  db_stop
  exit 1
fi

# Since the home directory was created before putting the user into
# the mysql group and moreover we cannot guarantee that the 
# permissions were correctly *before* calling this script, we fix them now.
# In case we use NIS and no mysql user is present then this script should
# better fail now than later..
# The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is
# not chgrp'able (#318435).
set +e
chown mysql:mysql $DATADIR
/usr/bin/find $DATADIR -follow -not -group mysql -exec chgrp mysql {} \; 
2>/dev/null
set -e

db_stop
<<
###
PostInstScript: <<
set -e

. %p/share/debconf/confmodule

# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"

invoke() {
  %p/sbin/mysqlctl $1
}

MYSQL_BOOTSTRAP="%p/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables"

test_mysql_access() {
       mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
}

# call with $1 = "online" to connect to the server, otherwise it bootstraps
set_mysql_rootpw() {
       # forget we ever saw the password.  don't use reset to keep the seen 
status
       db_set mysql-server/root_password ""
       db_set mysql-server/root_password_again ""

       tfile=`mktemp -t mysql-tmp-XXXXXX`
       if [ ! -f "$tfile" ]; then
               return 1
       fi

       # this avoids us having to call "test" or "[" on $rootpw
       cat << EOF > $tfile
USE mysql;
UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root';
FLUSH PRIVILEGES;
EOF
       if grep -q 'PASSWORD("")' $tfile; then
               retval=0
       elif [ "$1" = "online" ]; then
               mysql --no-defaults -u root -h localhost <$tfile >/dev/null
               retval=$?
       else
               $MYSQL_BOOTSTRAP <$tfile
               retval=$?
       fi
       rm -f $tfile
       return $retval
}

# This is necessary because mysql_install_db removes the pid file in /var/run
# and because changed configuration options should take effect immediately.
# In case the server wasn't running at all it should be ok if the stop
# script fails. I can't tell at this point because of the cleaned /var/run.
set +e; invoke stop; set -e
    
case "$1" in
  configure)
    mysql_datadir=%p/share/mysql
    mysql_statedir=%p/var/lib/mysql
    mysql_rundir=%p/var/run/mysqld
    mysql_logdir=%p/var/log
    mysql_cfgdir=%p/etc/mysql
    mysql_newlogdir=%p/var/log/mysql
    mysql_upgradedir=%p/var/lib/mysql-upgrade

    # first things first, if the following symlink exists, it is a preserved
    # copy the old data dir from a mysql upgrade that would have otherwise
    # been replaced by an empty mysql dir.  this should restore it.
    for dir in DATADIR LOGDIR; do
        if [ "$dir" = "DATADIR" ]; then targetdir=$mysql_statedir; else 
targetdir=$mysql_newlogdir; fi
        savelink="$mysql_upgradedir/$dir.link"
        if [ -L "$savelink" ]; then
            # If the targetdir was a symlink before we upgraded it is supposed
            # to be either still be present or not existing anymore now.
            if [ -L "$targetdir" ]; then
                rm "$savelink"
            elif [ ! -d "$targetdir" ]; then
                mv "$savelink" "$targetdir"
            else
                # this should never even happen, but just in case...
                mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX`
                /bin/echo "this is very strange!  see $mysql_tmp/README..." >&2
                mv "$targetdir" "$mysql_tmp"
                cat << EOF > "$mysql_tmp/README"

if you're reading this, it's most likely because you had replaced 
%p/var/lib/mysql
with a symlink, then upgraded to a new version of mysql, and then dpkg
removed your symlink (see #182747 and others).  the mysql packages noticed
that this happened, and as a workaround have restored it.  however, because
%p/var/lib/mysql seems to have been re-created in the meantime, and because
we don't want to rm -rf something we don't know as much about, we're going
to leave this unexpected directory here.  if your database looks normal,
and this is not a symlink to your database, you should be able to blow
this all away.

EOF
            fi
        fi
        rmdir $mysql_upgradedir 2>/dev/null || true
    done
    
    # Ensure the existence and right permissions for the database and
    # log files.
    if [ ! -d "$mysql_statedir"       -a ! -L "$mysql_statedir"       ]; then 
mkdir "$mysql_statedir"; fi
    if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then 
mkdir "$mysql_statedir/mysql"; fi
    if [ ! -d "$mysql_newlogdir"      -a ! -L "$mysql_newlogdir"      ]; then 
mkdir "$mysql_newlogdir"; fi
    # When creating an ext3 jounal on an already mounted filesystem like e.g.
    # /var/lib/mysql, you get a .journal file that is not modifyable by chown.
    # The mysql_datadir must not be writable by the mysql user under any
    # circumstances as it contains scripts that are executed by root.
    set +e
    chown -R 0:0 $mysql_datadir
    chown -R mysql $mysql_statedir
    chmod 700 $mysql_statedir $mysql_statedir/mysql
    if [ ! -d "$mysql_rundir" ]; then mkdir "$mysql_rundir"; fi
    chown -R mysql $mysql_rundir
    chown -R mysql:admin $mysql_newlogdir;      chmod 2750 $mysql_newlogdir;
    for i in log err; do
      touch             $mysql_logdir/mysql.$i
      chown mysql:admin   $mysql_logdir/mysql.$i
      chmod 0640        $mysql_logdir/mysql.$i
    done
    set -e

    # This is important to avoid dataloss when there is a removed
    # mysql-server version from Woody lying around which used the same
    # data directory and then somewhen gets purged by the admin.
    db_set mysql-server/postrm_remove_database false || true

    # To avoid downgrades.
    touch $mysql_statedir/fink-5.5.flag

    # initiate databases. Output is not allowed by debconf :-(
    set +e
    bash %p/bin/mysql_install_db --rpm 2>&1 | $ERR_LOGGER
    if [ "$?" != "0" ]; then
      /bin/echo "ATTENTION: An error has occured. More info is in the syslog!"
    fi
    set -e
    
    ## On every reconfiguration the maintenance user is recreated.
    #
    # - It is easier to regenerate the password every time but as people
    #   use fancy rsync scripts and file alteration monitors, the existing
    #   password is used and existing files not touched.
    # - The mysqld statement is like that in mysql_install_db because the
    #   server is not already running. This has some implications:
    #   - The amount of newlines and semicolons in the query is important!
    #   - GRANT is not possible with --skip-grant-tables and "INSERT
    #     (user,host..) VALUES" is not --ansi compliant
    # - The echo is just for readability. ash's buildin has no "-e" so use 
/bin/echo.
    # - The Super_priv, Show_db_priv, Create_tmp_table_priv and Lock_tables_priv
    #   may not be present as old Woody 3.23 databases did not have it and the
    #   admin might not already have run mysql_upgrade which adds them.
    #   As the binlog cron scripts to need at least the Super_priv, I do first
    #   the old query which always succeeds and then the new which may or may 
not.

    # recreate the credentials file if not present or without mysql_upgrade 
stanza
    dc=$mysql_cfgdir/fink.cnf; 
    if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
        pass="`sed -n 's/^[     ]*password *= *// p' $dc | head -n 1`"
    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
        cat /dev/null > $dc
        /bin/echo "# Automatically generated for Fink scripts. DO NOT TOUCH!" 
>>$dc
        /bin/echo "[client]" >>$dc
        /bin/echo "host     = localhost" >>$dc
        /bin/echo "user     = fink-sys-maint" >>$dc
        /bin/echo "password = $pass" >>$dc
        /bin/echo "socket   = $mysql_rundir/mysqld.sock" >>$dc
        /bin/echo "[mysql_upgrade]" >>$dc
        /bin/echo "host     = localhost" >>$dc
        /bin/echo "user     = fink-sys-maint" >>$dc
        /bin/echo "password = $pass" >>$dc
        /bin/echo "socket   = $mysql_rundir/mysqld.sock" >>$dc
        /bin/echo "basedir  = %p" >>$dc
    fi
    # If this dir chmod go+w then the admin did it. But this file should not.
    chown 0:0 $dc
    chmod 0600 $dc

    # update privilege tables
    password_column_fix_query=`printf \
        "USE mysql;\n \
         ALTER TABLE user CHANGE Password Password char(41) character set 
latin1 collate latin1_bin DEFAULT '' NOT NULL\n"`;
    replace_query=`printf \
        "USE mysql;\n \
         REPLACE INTO user SET \
           host='localhost', user='fink-sys-maint', password=password('$pass'), 
\
           Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', \
           Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', \
           Process_priv='Y',  File_priv='Y', Grant_priv='Y', 
References_priv='Y', \
           Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', \
           Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', \
           Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', \
           Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', 
\
           Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y'\n"`;
    fix_privs1=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER 
SET utf8 NOT NULL DEFAULT 'N';\n"`
    fix_privs2=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET 
utf8 NOT NULL DEFAULT 'N';\n"`
    fix_privs3=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Create_routine_priv enum('N','Y') 
CHARACTER SET utf8 NOT NULL DEFAULT 'N';\n"`
    fix_privs4=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Alter_routine_priv enum('N','Y') CHARACTER 
SET utf8 NOT NULL DEFAULT 'N';\n"`
    fix_privs5=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Create_user_priv enum('N','Y') CHARACTER 
SET utf8 NOT NULL DEFAULT 'N';\n"`
    fix_privs6=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Event_priv enum('N','Y') CHARACTER SET 
utf8 NOT NULL DEFAULT 'N';\n"` 
    fix_privs7=`printf \
        "USE mysql;\n \
         ALTER TABLE user ADD column Trigger_priv enum('N','Y') CHARACTER SET 
utf8 NOT NULL DEFAULT 'N';\n"`
    # Engines supported by etch should be installed per default. The query 
sequence is supposed
    # to be aborted if the CREATE TABLE fails due to an already existent table 
in which case the
    # admin might already have chosen to remove one or more plugins. Newlines 
are necessary.
    install_plugins=`printf \
        "USE mysql;\n \
         CREATE TABLE IF NOT EXISTS plugin (name char(64) COLLATE utf8_bin NOT 
NULL DEFAULT '', \
           dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', \
           PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 
COLLATE=utf8_bin COMMENT='MySQL plugins';\n \
         REPLACE INTO plugin VALUES ('innodb',    'ha_innodb.so');\n \
         REPLACE INTO plugin VALUES ('federated', 'ha_federated.so');\n \
         REPLACE INTO plugin VALUES ('blackhole', 'ha_blackhole.so');\n \
         REPLACE INTO plugin VALUES ('archive',   'ha_archive.so');\n"`

    # Upgrade password column format before the root password gets set.
    /bin/echo "$password_column_fix_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER

    db_get mysql-server/root_password && rootpw="$RET"
    if ! set_mysql_rootpw; then
        password_error="yes"
    fi

    /bin/echo "$fix_privs1" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs2" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs3" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs4" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs5" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs6" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$fix_privs7" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    /bin/echo "$replace_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    set +e
    /bin/echo "$install_plugins" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER
    set -e

    db_get mysql-server-5.5/start_on_boot && startup="$RET"
    if [ $startup ]; then
        daemonic enable mysql
        mysqlctl start
    fi
  ;;

  abort-upgrade|abort-remove|abort-configure)
  ;;

  *)
    /bin/echo "postinst called with unknown argument '$1'" 1>&2
    exit 1
  ;;
esac

# here we check to see if we can connect as root without a password
# this should catch upgrades from previous versions where the root
# password wasn't set.  if there is a password, or if the connection
# fails for any other reason, nothing happens.
if [ "$1" = "configure" ]; then
       if test_mysql_access; then
               db_input medium mysql-server/root_password || true
               db_go
               db_get mysql-server/root_password && rootpw="$RET"

               if ! set_mysql_rootpw "online"; then
                       password_error="yes"
               fi
       fi

       if [ "$password_error" = "yes" ]; then
               db_input high mysql-server/error_setting_password || true
               db_go
       fi

fi

db_stop # in case invoke failes
<<
###
PostRmScript: <<
set -e

# It is possible that Debconf has already been removed, too.
if [ -f %p/share/debconf/confmodule ]; then
  . %p/share/debconf/confmodule
fi

MYADMIN="%p/bin/mysqladmin --defaults-file=%p/etc/mysql/fink.cnf"

# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running!
stop_server() {
  set +e
  %p/sbin/mysqlctl stop
  errno=$?
  set -e

  if [ "$?" != 0 ]; then
    /bin/echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2
    /bin/echo "Stop it yourself and try again!" 1>&2
    exit 1
  fi
}

case "$1" in
  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then
      stop_server
      sleep 2
    fi
    if [ -f %p/bin/daemonic ]; then
      daemonic disable mysql
    done
  ;;
  *)
    /bin/echo "postrm called with unknown argument '$1'" 1>&2
    exit 1
  ;;
esac

#
# - Do NOT purge logs or data if another mysql-sever* package is installed 
(#307473)
#   
if [ "$1" = "purge" -a ! \( -x %p/sbin/mysqld -o -L %p/sbin/mysqld \) ]; then
  rm -f %p/var/log/mysql.{log,err}{,.0,.[1234567].gz}
  rm -rf %p/var/log/mysql

  db_input high %N/postrm_remove_databases || true
  db_go || true
  db_get %N/postrm_remove_databases || true
  if [ "$RET" = "true" ]; then
    # never remove the fink.cnf when the databases are still existing
    # else we ran into big trouble on the next install!
    rm -f %p/etc/mysql/fink.cnf
    rm -rf %p/var/lib/mysql
    rm -rf %p/var/run/mysqld
  fi
  # (normally) End automatically added section
fi

# (normally) Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e %p/share/debconf/confmodule ]; then
        . %p/share/debconf/confmodule
        db_purge
fi
<<
###
Description: MySQL database server binaries
DescDetail: <<
MySQL is a fast, stable and true multi-user, multi-threaded SQL database
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MySQL are speed, robustness and
ease of use.
.
This package contains all the infrastructure needed to setup system
databases.
<<
DescPort: <<
Test "main.func_math" fails because of overflow error:
http://bugs.mysql.com/bug.php?id=8433
http://dev.mysql.com/doc/refman/5.5/en/out-of-range-and-overflow.html<\
<<
License: GPL
Homepage: http://dev.mysql.com/
Maintainer: Justin F. Hallett <[email protected]>

--- NEW FILE: dbd-mysql-pm.info ---
Info2: <<
Package: dbd-mysql-pm%type_pkg[perl]
Version: 4.021
Revision: 1.1
Architecture: (%type_pkg[perl] = 581) powerpc, (%type_pkg[perl] = 584) powerpc
Distribution: (%type_pkg[perl] = 581) 10.4, (%type_pkg[perl] = 584) 10.4, 
(%type_pkg[perl] = 586) 10.4, (%type_pkg[perl] = 586) 10.5, (%type_pkg[perl] = 
5100) 10.5, (%type_pkg[perl] = 5100) 10.6, (%type_pkg[perl] = 5123) 10.7, 
(%type_pkg[perl] = 588) 10.4, (%type_pkg[perl] = 588) 10.5, (%type_pkg[perl] = 
588) 10.6
Description: Perl5 Database Interface to MySQL
Type: perl (5.8.1 5.8.4 5.8.6 5.8.8 5.10.0 5.12.3)
License: Artistic
Maintainer: Christian Schaffner <[email protected]>

# Dependencies:
Depends: perl%type_pkg[perl]-core, libmysqlclient18-shlibs, 
dbi-pm%type_pkg[perl] (>= 1.37-2), data-showtable-pm
BuildDepends: libmysqlclient18-dev, fink (>= 0.20.1-1), 
extutils-makemaker-pm%type_pkg[perl]
Replaces: dbd-mysql-pm (<= 2.1026-1), dbd-mysql-pm560, dbd-mysql-pm580, %N-man
Conflicts: %N-man
PostInstScript: <<
 rm -rf %p/lib/perl5/darwin/auto/DBD/mysql/
 rm -f %p/lib/perl5/darwin/Bundle/DBD/mysql.pm
 rm -rf %p/lib/perl5/darwin/DBD/mysql/
 rm -f %p/lib/perl5/darwin/DBD/mysql.pm
 rm -f %p/lib/perl5/darwin/DBD/mysql.pod
 rm -rf %p/lib/perl5/darwin/Mysql/
 rm -f %p/lib/perl5/darwin/Mysql.pm
<<

# Unpack Phase:
Source: mirror:cpan:authors/id/C/CA/CAPTTOFU/DBD-mysql-%v.tar.gz
Source-MD5: 35653efca4bbe6e49ef31d237b4a50b7

# Patch Phase:
PatchScript: <<
 head -n 25 dbdimp.h >> LICENSE
<<

# Compile Phase:
ConfigureParams: --nocatchstderr --mysql_config=%p/bin/mysql_config
NoPerlTests: true

# Install Phase:
UpdatePOD: true
DocFiles: README INSTALL.html ChangeLog LICENSE
InstallScript: <<
  %{default_script}
  mv %i/share/man %i/lib/perl5/%type_raw[perl]
<<

# Additional Data:
DescDetail: <<
 DBD::mysql is an interface between the Perl programming 
 language and the mysql programming API that come with the 
 mysql relational database management systems. Most 
 functions provided by the programming API are supported.
 Some rarely used functions are missing, mainly because noone 
 ever requested them. :-)
<<
DescPort: <<
Disabled default tests since 'make test' normally
wouldn't pass: it needs a running mysql server
Can't use default CompileScript on 10.3 so we can add --nocatchstderr (work 
around perl config bug)

ABSPERL hack to make makemaker in perl 5.8.8 happy. It was using the wrong 
ABSPERL path, pointing to the build directory instead of /sw/bin/perl...
<<
Homepage: http://search.cpan.org/dist/DBD-mysql
<<

--- NEW FILE: mysql-server-5.5.patch ---
diff -ruN 
mysql-5.5-5.5.24+dfsg.orig.orig/fink/additions/Docs__Images__Makefile.in 
mysql-5.5-5.5.24+dfsg.orig/fink/additions/Docs__Images__Makefile.in
--- mysql-5.5-5.5.24+dfsg.orig.orig/fink/additions/Docs__Images__Makefile.in    
1969-12-31 17:00:00.000000000 -0700
+++ mysql-5.5-5.5.24+dfsg.orig/fink/additions/Docs__Images__Makefile.in 
2012-07-12 15:48:13.000000000 -0600
@@ -0,0 +1,6 @@
+all:
+
+distclean:
+       -rm -f Makefile
+
+.PHONY: all distclean clean install check
diff -ruN mysql-5.5-5.5.24+dfsg.orig.orig/fink/additions/Docs__Makefile.in 
mysql-5.5-5.5.24+dfsg.orig/fink/additions/Docs__Makefile.in
--- mysql-5.5-5.5.24+dfsg.orig.orig/fink/additions/Docs__Makefile.in    
1969-12-31 17:00:00.000000000 -0700
+++ mysql-5.5-5.5.24+dfsg.orig/fink/additions/Docs__Makefile.in 2012-07-12 
15:48:13.000000000 -0600
@@ -0,0 +1,6 @@
+all:
+
+distclean:
+       -rm -f Makefile
+
[...22762 lines suppressed...]
+#~ "Should MySQL listen on a network reachable TCP port? This is not "
+#~ "necessary for use on a single computer and could be a security problem."
+#~ msgstr ""
+#~ "MySQL ağ üzerinde ulaşılabilen bir TCP portunu dinlesin mi? Tek olan 
bir "
+#~ "bilgisayar için bu ayar gerekli değildir ve bir güvenlik sorunu "
+#~ "oluşturabilir."
+
+#~ msgid "Enable chroot mode?"
+#~ msgstr "chroot kipi etkinleştirilsin mi?"
+
+#~ msgid ""
+#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so "
+#~ "that users cannot modify any files outside this directory. This improves "
+#~ "resistence against crackers, too, as they are not able to modify system "
+#~ "files."
+#~ msgstr ""
+#~ "MySQL kendini /var/lib/mysql_jail dizinine hapsederek kullanıcıların bu 
"
+#~ "dizin dışındaki hiç bir dosyayı değiştirmemesini sağlayabilir. Bu "
+#~ "düzenleme, sistem dosyalarını değiştirmelerini engelleyeceğinden, "
+#~ "cracker'lara karşı dayanıklılığı arttırır."


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fink-commits mailing list
[email protected]
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to