Package: zoneminder
Version: 1.24.2-4
Followup-For: Bug #583648

here's a slightly more comprehensive patch to avoid operations that rely on
mysql running if mysql doesn't get started, and issuing a message to the user
to run dpkg-reconfigure zoneminder once mysql is running.

it might not handle upgrades quite right when mysql is not running, and should
probably additionally inform the user via debconf, rather than just standard
output, but this should be sufficient to close this bug.

--- postinst    2010-06-25 12:27:55.000000000 -0700
+++ postinst.orig       2010-06-21 20:41:55.000000000 -0700
@@ -10,29 +10,21 @@
                # Get mysql started if it isn't
                #
                if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
-                       invoke-rc.d mysql start
-               fi
-               if $(/etc/init.d/mysql status >/dev/null 2>&1); then
-                       mysqladmin --defaults-file=/etc/mysql/debian.cnf -f 
reload
-                       cat /usr/share/zoneminder/db/zm_create.sql | mysql 
--defaults-file=/etc/mysql/debian.cnf
-                       echo 'grant lock tables, 
alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by 
"zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
-               else
-                       echo 'NOTE: mysql not running, please start mysql and 
run dpkg-reconfigure zoneminder when it is running.'
+                       /etc/init.d/mysql start
                fi
+               mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
+               cat /usr/share/zoneminder/db/zm_create.sql | mysql 
--defaults-file=/etc/mysql/debian.cnf
+               echo 'grant lock tables, alter,select,insert,update,delete on 
zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql 
--defaults-file=/etc/mysql/debian.cnf mysql
                chown www-data:www-data /var/log/zm
                chown www-data:www-data /var/lib/zm/
                chown www-data:www-data -R /var/cache/zoneminder
     else
+        echo 'grant lock tables, alter on zm.* to 'zmuser'@localhost 
identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
                chown www-data:www-data /var/log/zm
-               if $(/etc/init.d/mysql status >/dev/null 2>&1); then
-               echo 'grant lock tables, alter on zm.* to 'zmuser'@localhost 
identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
-            OLD_ZM_VERSION=${2%-*}
-            if [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
-                zmupdate.pl --version $OLD_ZM_VERSION 
-            fi
-               else
-                       echo 'NOTE: mysql not running, please start mysql and 
run dpkg-reconfigure zoneminder when it is running.'
-               fi
+        OLD_ZM_VERSION=${2%-*}
+        if [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
+            zmupdate.pl --version $OLD_ZM_VERSION 
+        fi
        fi
 fi
 #DEBHELPER#



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to