[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Problem with %post and upgrade



I build mod_php rpm's and am having a problem with %post and %postun script.

Since I use various packages such as mod_php-imap and mod_php-mysql which require the php.ini script be modified in order to load the module, I have a %post script which uses sed to uncomment the loadable module from php.ini and %postun to recomment the loadable module.

This is important as otherwise apache won't properly start. But it seems that when using the -Uh flag to upgrade from one version to a newer, the %postun from the older version runs after the %post from the newer, thus the modules don't load.

if i do rpm -e oldversion followed by rpm -i newversion it works flawlessly.

here is my %post and %postun script for mod_php-ldap (all modules are done in this fashion):

-=-=-=-=-=-=-=-=-=-=-=-

%post -n mod_php-ldap

sed -e "s/^;extension=ldap.so/extension=ldap.so/g" < /etc/httpd/conf/php.ini > /etc/httpd/conf/php.ini- \
&& mv -f /etc/httpd/conf/php.ini- /etc/httpd/conf/php.ini

if [ -f /var/run/httpd.pid ]; then
/etc/rc.d/init.d/httpd restart
fi

%preun -n mod_php-ldap
if [ -f /etc/httpd/conf/php.ini ]; then

sed -e "s/^extension=ldap.so/;extension=ldap.so/g" < /etc/httpd/conf/php.ini > /etc/httpd/conf/php.ini- \
&& mv -f /etc/httpd/conf/php.ini- /etc/httpd/conf/php.ini

fi

%postun -n mod_php-ldap
if [ -f /var/run/httpd.pid ]; then
/etc/rc.d/init.d/httpd restart
fi

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Does anyone know why these scripts don't properly work when using the -Uh flag but work just dandy when first uninstalling the package and then installing the newer?

My logic would think when upgrading, the %preun would run before the older was removed, %postun would run after the older was removed, the new rpm would be installed, and %post would run making everything just dandy.

-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters (510) 623-9726 Ext. 219
Sr. Developer (510) 249-9125 (fax)
Abriasoft
http://www.abriasoft.com/
[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []