Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #1 from iwaim/master
Browse files Browse the repository at this point in the history
rpm: fix a bug that mroonga plugin is unregistered when upgrading

[groonga-dev,00810]

Reported by Takken Ishibashi. Thanks!!!
Patch by IWAI, Masaharu. Thanks!!!
  • Loading branch information
kou committed May 10, 2012
2 parents 99365bb + 289839a commit 28b996c
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 22 deletions.
36 changes: 25 additions & 11 deletions packages/rpm/centos/mysql-mroonga.spec.in
Expand Up @@ -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';
Expand All @@ -123,17 +135,19 @@ eval $command || \
(echo "run the following command to register mroonga:"; \
echo " $command")

%postun
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")
%preun
if [ "$1" = 0 ]; 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

%files
%defattr(-,root,root,-)
Expand Down
36 changes: 25 additions & 11 deletions packages/rpm/fedora/mysql-mroonga.spec.in
Expand Up @@ -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';
Expand All @@ -77,17 +89,19 @@ eval $command || \
(echo "run the following command to register mroonga:"; \
echo " $command")

%postun
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")
%preun
if [ "$1" = 0 ]; 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

%files
%defattr(-,root,root,-)
Expand Down

0 comments on commit 28b996c

Please sign in to comment.