OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src openpkg-web Date: 23-Jul-2003 22:27:10
Branch: HEAD Handle: 2003072321270801
Modified files:
openpkg-src/mysql mysql.spec rc.mysql
openpkg-web news.txt
Log:
PR#202 run-time check and related issues
Summary:
Revision Changes Path
1.73 +36 -13 openpkg-src/mysql/mysql.spec
1.17 +11 -14 openpkg-src/mysql/rc.mysql
1.5772 +1 -0 openpkg-web/news.txt
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/mysql/mysql.spec
============================================================================
$ cvs diff -u -r1.72 -r1.73 mysql.spec
--- openpkg-src/mysql/mysql.spec 22 Jul 2003 19:35:36 -0000 1.72
+++ openpkg-src/mysql/mysql.spec 23 Jul 2003 20:27:09 -0000 1.73
@@ -39,7 +39,7 @@
Group: Database
License: GPL
Version: %{V_opkg}
-Release: 20030722
+Release: 20030723
# package options
%option with_berkeleydb yes
@@ -183,17 +183,40 @@
%clean
rm -rf $RPM_BUILD_ROOT
+%pre
+ # before upgrade, save status and stop service
+ [ $1 -eq 2 ] || exit 0
+ eval `%{l_rc} mysql status 2>/dev/null | tee %{l_tmpfile}`
+ %{l_rc} mysql stop 2>/dev/null
+ exit 0
+
%post
- # create initial database
- $RPM_INSTALL_PREFIX/bin/mysql_install_db \
- --defaults-file=$RPM_INSTALL_PREFIX/etc/mysql/my.cnf
- chown %{l_rusr}:%{l_rgrp} \
- $RPM_INSTALL_PREFIX/etc/mysql/my.cnf \
- $RPM_INSTALL_PREFIX/etc/mysql/my.pwd
- chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/
- ( echo "The MySQL package includes automated maintenance procedures"
- echo "that require administrator access to the database. For this"
- echo "to work you must keep a copy (plain text) of the administrator"
- echo "account in '$RPM_INSTALL_PREFIX/etc/mysql/my.pwd'."
- ) | %{l_rpmtool} msg -b -t notice
+ if [ $1 -eq 1 ]; then
+ # after install, create initial database
+ $RPM_INSTALL_PREFIX/bin/mysql_install_db \
+ --defaults-file=$RPM_INSTALL_PREFIX/etc/mysql/my.cnf
+ chown %{l_rusr}:%{l_rgrp} \
+ $RPM_INSTALL_PREFIX/etc/mysql/my.cnf \
+ $RPM_INSTALL_PREFIX/etc/mysql/my.pwd
+ chown -R %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/mysql/
+ ( echo "The MySQL package includes automated maintenance procedures"
+ echo "that require administrator access to the database. For this"
+ echo "to work you must keep a copy (plain text) of the administrator"
+ echo "account in '$RPM_INSTALL_PREFIX/etc/mysql/my.pwd'."
+ ) | %{l_rpmtool} msg -b -t notice
+ fi
+ if [ $1 -eq 2 ]; then
+ # after upgrade, restore status
+ { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
+ [ ".$mysql_active" = .yes ] && %{l_rc} mysql start
+ fi
+ exit 0
+
+%preun
+ # before erase, stop service and remove log files
+ [ $1 -eq 0 ] || exit 0
+ %{l_rc} mysql stop 2>/dev/null
+ rm -f $RPM_INSTALL_PREFIX/var/mysql/*.log* >/dev/null 2>&1 || true
+ rm -f $RPM_INSTALL_PREFIX/var/mysql/*.err* >/dev/null 2>&1 || true
+ exit 0
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/mysql/rc.mysql
============================================================================
$ cvs diff -u -r1.16 -r1.17 rc.mysql
--- openpkg-src/mysql/rc.mysql 22 Jul 2003 08:10:53 -0000 1.16
+++ openpkg-src/mysql/rc.mysql 23 Jul 2003 20:27:09 -0000 1.17
@@ -20,12 +20,12 @@
[EMAIL PROTECTED]@/var/mysql/common.log
[EMAIL PROTECTED]@/var/mysql/update.log
-%status -u @l_susr@ -o
+%status -u @l_rusr@ -o
mysql_usable="unknown"
mysql_active="no"
@l_prefix@/bin/mysqladmin \
--defaults-extra-file=${mysql_pwd_file} \
- ping 2>/dev/null && mysql_active="yes"
+ ping >/dev/null 2>&1 && mysql_active="yes"
if [ $mysql_active = "no" -a -f $mysql_pid_file ] ; then
kill -0 `cat $mysql_pid_file` && mysql_active="unknown"
fi
@@ -35,6 +35,7 @@
%start -p 400 -u @l_rusr@
rcService mysql enable yes || exit 0
+ rcService mysql active yes && exit 0
cd @l_prefix@
@l_prefix@/bin/mysqld_safe >/dev/null 2>&1 \
[EMAIL PROTECTED]@ \
@@ -43,30 +44,26 @@
%stop -p 400 -u @l_rusr@
rcService mysql enable yes || exit 0
+ rcService mysql active no && exit 0
@l_prefix@/bin/mysqladmin \
--defaults-extra-file=${mysql_pwd_file} \
shutdown
%restart -p 400 -u @l_rusr@
rcService mysql enable yes || exit 0
- cd @l_prefix@
- @l_prefix@/bin/mysqladmin \
- --defaults-extra-file=${mysql_pwd_file} \
- shutdown
- @l_prefix@/bin/mysqld_safe >/dev/null 2>&1 \
- [EMAIL PROTECTED]@ \
- --pid-file="$mysql_pid_file" \
- --err-log="$mysql_log_err" &
+ rcService mysql active no && exit 0
+ rc mysql stop start
%daily -u @l_rusr@
rcService mysql enable yes || exit 0
+
+ # rotate logfile
shtool rotate -f \
-n ${mysql_log_numfiles} -s ${mysql_log_minsize} -d \
- -z ${mysql_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
+ -z ${mysql_log_complevel} -m 660 -o @l_rusr@ -g @l_rgrp@ \
-P "${mysql_log_prolog}" \
- -E "@l_prefix@/bin/mysqladmin \
- --defaults-extra-file=${mysql_pwd_file} \
- flush-logs; ${mysql_log_epilog}" \
+ -E "$mysql_log_epilog && @l_prefix@/bin/mysqladmin \
+ --defaults-extra-file=${mysql_pwd_file} flush-logs" \
${mysql_log_common} \
${mysql_log_update} \
${mysql_log_err}
@@ .
patch -p0 <<'@@ .'
Index: openpkg-web/news.txt
============================================================================
$ cvs diff -u -r1.5771 -r1.5772 news.txt
--- openpkg-web/news.txt 23 Jul 2003 20:13:30 -0000 1.5771
+++ openpkg-web/news.txt 23 Jul 2003 20:27:08 -0000 1.5772
@@ -1,3 +1,4 @@
+23-Jul-2003: Upgraded package: P<mysql-4.0.14-20030723>
23-Jul-2003: Upgraded package: P<qt-3.2.0-20030723>
23-Jul-2003: Upgraded package: P<m4-1.4o-20030723>
23-Jul-2003: Upgraded package: P<libtool-1.5-20030723>
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]