[Groonga-mysql-commit] mroonga/mroonga [master] rpm: fix post/postun scripts

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 5月 9日 (水) 22:02:45 JST


IWAI, Masaharu	2012-05-09 22:02:45 +0900 (Wed, 09 May 2012)

  New Revision: aeec00cb08392a0113aed1371d928739434c25c7

  Merged 28b996c: Merge pull request #1 from iwaim/master

  Log:
    rpm: fix post/postun scripts
    
    mroonga plugin was always droped from MySQL plugins by postun script.
    Only when RPM package is uninstalled, its script should run.
    
    And mroonga plugin is uninstalled by post script with upgrading RPM
    package. After that it is always isntalled.
    
    [groonga-dev,00810]
    
    Reported by Takken Ishibashi. Thanks!!!

  Modified files:
    packages/rpm/centos/mysql-mroonga.spec.in
    packages/rpm/fedora/mysql-mroonga.spec.in

  Modified: packages/rpm/centos/mysql-mroonga.spec.in (+14 -0)
===================================================================
--- packages/rpm/centos/mysql-mroonga.spec.in    2012-05-09 17:23:12 +0900 (968f3e5)
+++ packages/rpm/centos/mysql-mroonga.spec.in    2012-05-09 22:02:45 +0900 (a23a0c0)
@@ -113,6 +113,18 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
 rm -rf $RPM_BUILD_ROOT
 
 %post
+if [ "$1" = 2 ] ; then
+sql="
+DROP FUNCTION last_insert_grn_id;
+UNINSTALL PLUGIN mroonga;
+FLUSH TABLES;
+"
+command="/usr/bin/mysql -u root -e \"$sql\""
+echo $command
+eval $command || \
+      (echo "run the following command to unregister mroonga:"; \
+       echo "  $command")
+fi
 sql="
 INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';
 CREATE FUNCTION last_insert_grn_id RETURNS INTEGER soname 'ha_mroonga.so';
@@ -124,6 +136,7 @@ eval $command || \
 	 echo "  $command")
 
 %postun
+if [ "$1" = 0 ]; then
 sql="
 DROP FUNCTION last_insert_grn_id;
 UNINSTALL PLUGIN mroonga;
@@ -134,6 +147,7 @@ echo $command
 eval $command || \
       (echo "run the following command to unregister mroonga:"; \
        echo "  $command")
+fi
 
 %files
 %defattr(-,root,root,-)

  Modified: packages/rpm/fedora/mysql-mroonga.spec.in (+14 -0)
===================================================================
--- packages/rpm/fedora/mysql-mroonga.spec.in    2012-05-09 17:23:12 +0900 (98abb42)
+++ packages/rpm/fedora/mysql-mroonga.spec.in    2012-05-09 22:02:45 +0900 (cacd997)
@@ -66,6 +66,18 @@ mv $RPM_BUILD_ROOT%{_datadir}/doc/mroonga/ mysql-mroonga-doc/
 rm -rf $RPM_BUILD_ROOT
 
 %post
+if [ "$1" = 2 ] ; then
+sql="
+DROP FUNCTION last_insert_grn_id;
+UNINSTALL PLUGIN mroonga;
+FLUSH TABLES;
+"
+command="/usr/bin/mysql -u root -e \"$sql\""
+echo $command
+eval $command || \
+      (echo "run the following command to unregister mroonga:"; \
+       echo "  $command")
+fi
 sql="
 INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';
 CREATE FUNCTION last_insert_grn_id RETURNS INTEGER soname 'ha_mroonga.so';
@@ -78,6 +90,7 @@ eval $command || \
 	 echo "  $command")
 
 %postun
+if [ "$1" = 0 ]; then
 sql="
 DROP FUNCTION last_insert_grn_id;
 UNINSTALL PLUGIN mroonga;
@@ -88,6 +101,7 @@ echo $command
 eval $command || \
       (echo "run the following command to unregister mroonga:"; \
        echo "  $command")
+fi
 
 %files
 %defattr(-,root,root,-)




Groonga-mysql-commit メーリングリストの案内
Zurück zum Archiv-Index