mariadb/debian/mysql-server-PREV.preinst.in
unknown 6d296e5e0a BUG#27769 - MySQL should include debian packaging dir
Replaced hardcoded sover reference with variable.
Removed references to added manpages.
---
BUG#27769 
Cleaned up some things to make building the packages go a little smoother. 
---
debian/rules really does need to be called from the source root.
---
Fixed two problems with the build caused by adding debian to the source tree
---
Left off the debian/ prefix to the Makefile filter.
---
BUG#27769 - MySQL should include debian packaging dir
Changed substitution variables to match already existing autoconf vars.
Generate debian/control and debian/defs.mk from autoconf now, since we run that
to make a source package. 
---
Corrected incorrect variable name
---
Renamed template files to have shorter names. 
---
Moved generation of debian/control to dist-hook so make clean won't eat it.
---
A few final changes to make debs build from a source tarball dist. 


debian/libmysqlclientSLIB-dev.README.Maintainer.in:
  Rename: debian/libmysqlclientMYSOVER-dev.README.Maintainer.in -> debian/libmysqlclientSLIB-dev.README.Maintainer.in
debian/libmysqlclientSLIB-dev.dirs.in:
  Rename: debian/libmysqlclientMYSOVER-dev.dirs.in -> debian/libmysqlclientSLIB-dev.dirs.in
debian/libmysqlclientSLIB-dev.docs.in:
  Rename: debian/libmysqlclientMYSOVER-dev.docs.in -> debian/libmysqlclientSLIB-dev.docs.in
debian/libmysqlclientSLIB-dev.examples.in:
  Rename: debian/libmysqlclientMYSOVER-dev.examples.in -> debian/libmysqlclientSLIB-dev.examples.in
debian/libmysqlclientSLIB-dev.files.in:
  Rename: debian/libmysqlclientMYSOVER-dev.files.in -> debian/libmysqlclientSLIB-dev.files.in
debian/libmysqlclientSLIB-dev.links.in:
  Rename: debian/libmysqlclientMYSOVER-dev.links.in -> debian/libmysqlclientSLIB-dev.links.in
debian/libmysqlclientSLIB.README.Debian.in:
  Rename: debian/libmysqlclientMYSOVER.README.Debian.in -> debian/libmysqlclientSLIB.README.Debian.in
debian/libmysqlclientSLIB.dirs.in:
  Rename: debian/libmysqlclientMYSOVER.dirs.in -> debian/libmysqlclientSLIB.dirs.in
debian/libmysqlclientSLIB.docs.in:
  Rename: debian/libmysqlclientMYSOVER.docs.in -> debian/libmysqlclientSLIB.docs.in
debian/libmysqlclientSLIB.files.in:
  Rename: debian/libmysqlclientMYSOVER.files.in -> debian/libmysqlclientSLIB.files.in
debian/libmysqlclientSLIB.postinst.in:
  Rename: debian/libmysqlclientMYSOVER.postinst.in -> debian/libmysqlclientSLIB.postinst.in
debian/libndbclientNLIB-dev.dirs.in:
  Rename: debian/libndbclientNDBSOVER-dev.dirs.in -> debian/libndbclientNLIB-dev.dirs.in
debian/libndbclientNLIB-dev.files.in:
  Rename: debian/libndbclientNDBSOVER-dev.files.in -> debian/libndbclientNLIB-dev.files.in
debian/libndbclientNLIB-dev.links.in:
  Rename: debian/libndbclientNDBSOVER-dev.links.in -> debian/libndbclientNLIB-dev.links.in
debian/libndbclientNLIB.README.Debian.in:
  Rename: debian/libndbclientNDBSOVER.README.Debian.in -> debian/libndbclientNLIB.README.Debian.in
debian/libndbclientNLIB.dirs.in:
  Rename: debian/libndbclientNDBSOVER.dirs.in -> debian/libndbclientNLIB.dirs.in
debian/libndbclientNLIB.files.in:
  Rename: debian/libndbclientNDBSOVER.files.in -> debian/libndbclientNLIB.files.in
debian/libndbclientNLIB.postinst.in:
  Rename: debian/libndbclientNDBSOVER.postinst.in -> debian/libndbclientNLIB.postinst.in
debian/mysql-client-BASE.NEWS.in:
  Rename: debian/mysql-client-MYVER.NEWS.in -> debian/mysql-client-BASE.NEWS.in
debian/mysql-client-BASE.README.Debian.in:
  Rename: debian/mysql-client-MYVER.README.Debian.in -> debian/mysql-client-BASE.README.Debian.in
debian/mysql-client-BASE.dirs.in:
  Rename: debian/mysql-client-MYVER.dirs.in -> debian/mysql-client-BASE.dirs.in
debian/mysql-client-BASE.docs.in:
  Rename: debian/mysql-client-MYVER.docs.in -> debian/mysql-client-BASE.docs.in
debian/mysql-extra-BASE.dirs.in:
  Rename: debian/mysql-extra-MYVER.dirs.in -> debian/mysql-extra-BASE.dirs.in
debian/mysql-extra-BASE.files.in:
  Rename: debian/mysql-extra-MYVER.files.in -> debian/mysql-extra-BASE.files.in
debian/mysql-management-BASE.dirs.in:
  Rename: debian/mysql-management-MYVER.dirs.in -> debian/mysql-management-BASE.dirs.in
debian/mysql-management-BASE.files.in:
  Rename: debian/mysql-management-MYVER.files.in -> debian/mysql-management-BASE.files.in
debian/mysql-management-BASE.mysql-management.init.in:
  Rename: debian/mysql-management-MYVER.mysql-management.init.in -> debian/mysql-management-BASE.mysql-management.init.in
debian/mysql-server-BASE.NEWS.in:
  Rename: debian/mysql-server-MYVER.NEWS.in -> debian/mysql-server-BASE.NEWS.in
debian/mysql-server-BASE.README.Debian.in:
  Rename: debian/mysql-server-MYVER.README.Debian.in -> debian/mysql-server-BASE.README.Debian.in
debian/mysql-server-BASE.dirs.in:
  Rename: debian/mysql-server-MYVER.dirs.in -> debian/mysql-server-BASE.dirs.in
debian/mysql-server-BASE.docs.in:
  Rename: debian/mysql-server-MYVER.docs.in -> debian/mysql-server-BASE.docs.in
debian/mysql-server-BASE.links.in:
  Rename: debian/mysql-server-MYVER.links.in -> debian/mysql-server-BASE.links.in
debian/mysql-server-BASE.logcheck.ignore.paranoid.in:
  Rename: debian/mysql-server-MYVER.logcheck.ignore.paranoid.in -> debian/mysql-server-BASE.logcheck.ignore.paranoid.in
debian/mysql-server-BASE.logcheck.ignore.server.in:
  Rename: debian/mysql-server-MYVER.logcheck.ignore.server.in -> debian/mysql-server-BASE.logcheck.ignore.server.in
debian/mysql-server-BASE.logcheck.ignore.workstation.in:
  Rename: debian/mysql-server-MYVER.logcheck.ignore.workstation.in -> debian/mysql-server-BASE.logcheck.ignore.workstation.in
debian/mysql-server-BASE.mysql-server.logrotate.in:
  Rename: debian/mysql-server-MYVER.mysql-server.logrotate.in -> debian/mysql-server-BASE.mysql-server.logrotate.in
debian/mysql-server-BASE.preinst.in:
  Rename: debian/mysql-server-MYVER.preinst.in -> debian/mysql-server-BASE.preinst.in
debian/mysql-server-BASE.prerm.in:
  Rename: debian/mysql-server-MYVER.prerm.in -> debian/mysql-server-BASE.prerm.in
debian/mysql-server-PREV.preinst.in:
  Rename: debian/mysql-server-MYOLDVER.preinst.in -> debian/mysql-server-PREV.preinst.in
debian/mysql-storage-BASE.dirs.in:
  Rename: debian/mysql-storage-MYVER.dirs.in -> debian/mysql-storage-BASE.dirs.in
debian/mysql-storage-BASE.files.in:
  Rename: debian/mysql-storage-MYVER.files.in -> debian/mysql-storage-BASE.files.in
debian/mysql-storage-BASE.mysql-storage.init.in:
  Rename: debian/mysql-storage-MYVER.mysql-storage.init.in -> debian/mysql-storage-BASE.mysql-storage.init.in
debian/mysql-test-BASE.dirs.in:
  Rename: debian/mysql-test-MYVER.dirs.in -> debian/mysql-test-BASE.dirs.in
debian/mysql-test-BASE.files.in:
  Rename: debian/mysql-test-MYVER.files.in -> debian/mysql-test-BASE.files.in
debian/mysql-tools-BASE.dirs.in:
  Rename: debian/mysql-tools-MYVER.dirs.in -> debian/mysql-tools-BASE.dirs.in
debian/mysql-tools-BASE.files.in:
  Rename: debian/mysql-tools-MYVER.files.in -> debian/mysql-tools-BASE.files.in
Makefile.am:
  Moved generation of debian/control to dist-hook so make clean won't eat it.
  ---
  Need to generate the control file in the dist dir - not the source dir.
configure.in:
  Added variables to support the generation of debian/control and debian/defs.mk from configure
  ---
  Moved generation of debian/control to dist-hook so make clean won't eat it.
debian/Makefile.am:
  Distribute the generated control file so that debuild will work naturally.
  ---
  Broke the EXTRA_DIST line into separate lines. 
  Added defs.mk.in
  ---
  Modified debian/Makefile to use the new shorter template file names.
debian/control.in:
  Changed substitution variables to match already existing autoconf vars.
debian/defs.mk.in:
  Changed substitution variables to match already existing autoconf vars.
  Made defs.mk.in generated from template. 
  Persisted variables here. 
  ---
  Corrected incorrect variable name
debian/mysql-client-BASE.files.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-client-BASE.lintian-overrides.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.config.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.files.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.lintian-overrides.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.postinst.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.postrm.in:
  Changed substitution variables to match already existing autoconf vars.
debian/mysql-server-BASE.templates.in:
  Changed substitution variables to match already existing autoconf vars.
debian/po/POTFILES.in.in:
  Changed substitution variables to match already existing autoconf vars.
debian/rules:
  BUG#27769 - MySQL should include debian packaging dir
  Replaced hardcoded sover reference with variable.
  Removed references to added manpages.
  ---
  Prevented the test suite from being run unless requested. 
  ---
  Needed a space between ifneq and (
  ---
  The variable substitution was stepping on the Makefile from automake. 
  ---
  Left off the debian/ prefix to the Makefile filter.
  ---
  Changed substitution variables to match already existing autoconf vars.
  ---
  Save debian/defs.mk from make distclean
debian/source.lintian-overrides.in:
  Changed substitution variables to match already existing autoconf vars.
2007-04-17 18:12:43 -07:00

191 lines
5 KiB
Bash

#!/bin/bash -e
#
# 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>
#
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
# 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 /etc/init.d/mysql ]; then return; fi
set +e
if [ -x /usr/sbin/invoke-rc.d ]; then
cmd="invoke-rc.d mysql stop"
else
cmd="/etc/init.d/mysql stop"
fi
$cmd
errno=$?
set -e
# 0=ok, 100=no init script (fresh install)
if [ "$errno" != 0 -a "$errno" != 100 ]; then
echo "${cmd/ */} returned $errno" 1>&2
echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
exit 1
fi
}
##### here's a bunch of helper functions for converting database formats ######
cvt_get_param(){
/usr/sbin/mysqld --print-defaults \
| tr " " "\n" \
| grep -- "--$1" \
| tail -n 1 \
| cut -d= -f2
}
cvt_setup_stuff(){
mytmp=`mktemp -d -t mysql-ISAM-convert.XXXXXX`
cvt_log="$mytmp/conversion.log"
if [ ! -d "$mytmp" ]; then
echo "can't create temporary directory, oh well." >&2
exit 1
fi
chgrp mysql $mytmp
chmod g+rwx $mytmp
cvt_socket=${mytmp}/mysql.sock
cvt_mysqld="mysqld --skip-grant-tables --skip-networking --socket $cvt_socket"
cvt_mysql="mysql --socket $cvt_socket"
cvt_mysqladmin="mysqladmin --socket $cvt_socket"
}
cvt_get_databases(){
echo fetching database list ... >&2
$cvt_mysql -e 'show databases' | sed -n -e '2,$p'
}
cvt_get_tables(){
echo querying tables in $1 ... >&2
$cvt_mysql $1 -e 'show table status' | sed -n -e '2,$p' | \
cut -f 1,2 | grep -w 'ISAM$' | cut -f 1
}
cvt_convert_table(){
echo converting $1.$2 ... >&2
$cvt_mysql $1 -e "alter table $2 type=MyISAM"
}
cvt_wait_for_server(){
local count
echo -n waiting for server startup.. >&2
while ! $cvt_mysql </dev/null >/dev/null 2>&1; do
echo -n . >&2
sleep 1
count=".$count"
if [ -f $mytmp/mysql.done ]; then
echo "sorry... looks like the server crashed :(" >&2
return 1
elif [ "$count" = "...................." ]; then
echo "sorry... looks like the server didn't start :(" >&2
return 1
fi
done
echo ok. >&2
}
cvt_wait_for_exit(){
local count
echo -n waiting for server shutdown.. >&2
while [ ! -f $mytmp/mysql.done ]; do
echo -n . >&2
sleep 1
count=".$count"
if [ "$count" = "...................." ]; then
echo "hrm... guess it never started?" >&2
return 0
fi
done
echo ok. >&2
}
cvt_cleanup(){
local mysql_kids
rm -rf $mytmp
# kill any mysqld child processes left over. there *shouldn't* be any,
# but let's not take chances with that
mysql_kids=`ps o 'pid command' --ppid $$ | grep -E '^[[:digit:]]+ mysqld ' | cut -d' ' -f1`
if [ "$mysql_kids" ]; then
echo "strange, some mysql processes left around. killing them now." >&2
kill $mysql_kids
sleep 10
mysql_kids=`ps o 'pid command' --ppid $$ | grep -E '^[[:digit:]]+ mysqld ' | cut -d' ' -f1`
if [ "$mysql_kids" ]; then
echo "okay, they're really not getting the hint..." >&2
kill -9 $mysql_kids
fi
fi
}
################################ main() ##########################
# to be sure
stop_server
# test if upgrading from non conffile state
if [ "$1" = "upgrade" ] && [ -x /usr/sbin/mysqld ]; then
cvt_datadir=`cvt_get_param datadir`
# test for ISAM tables, which we must convert NOW
if [ -n "`find $cvt_datadir -name '*.ISM' 2>/dev/null`" ]; then
set +e
cat << EOF >&2
----------------------------------------
WARNING WARNING WARNING
----------------------------------------
It has been detected that are are using ISAM format on some of your
mysql database tables. This format has been deprecated and no longer
supported. to prevent these databases from essentially disappearing,
an attempt at format conversion will now be made. please check after
your upgrade that all tables are present and accounted for.
apologies for the noise, but we thought you'd appreciate it :)
----------------------------------------
WARNING WARNING WARNING
----------------------------------------
EOF
cvt_setup_stuff
($cvt_mysqld >$cvt_log 2>&1; touch $mytmp/mysql.done ) &
if cvt_wait_for_server; then
dbs=`cvt_get_databases`
for db in $dbs; do
tables=`cvt_get_tables $db`
for tbl in $tables; do
cvt_convert_table $db $tbl
done
done
else
cvt_error="yes"
fi
echo shutting down server... >&2
$cvt_mysqladmin shutdown
cvt_wait_for_exit
echo "all done!" >&2
if [ ! "$cvt_error" = "yes" ]; then
cvt_cleanup
else
echo "you might want to look in $mytmp..." >&2
fi
set -e
fi
fi
exit 0