RPM: fix removal of pazpar2-js.conf
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Sep 2010 12:19:55 +0000 (14:19 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 2 Sep 2010 12:19:55 +0000 (14:19 +0200)
Removal of pazpar2-js.conf symlink happens only during uninstall
of pkg. The link is re-installed always. httpd/apache2 is no longer
reloaded/restarted.. It fails too often.

pazpar2.spec.in

index b064130..fa11129 100644 (file)
@@ -25,9 +25,12 @@ Group: Data
 Requires: pazpar2
 
 %post
 Requires: pazpar2
 
 %post
-/sbin/chkconfig --add pazpar2
-/sbin/service pazpar2 start > /dev/null 2>&1
-
+if [ $1 = 1 ]; then
+       /sbin/chkconfig --add pazpar2
+       /sbin/service pazpar2 start > /dev/null 2>&1
+else
+       /sbin/service pazpar2 restart > /dev/null 2>&1
+fi
 %preun
 if [ $1 = 0 ]; then
        /sbin/service pazpar2 stop > /dev/null 2>&1
 %preun
 if [ $1 = 0 ]; then
        /sbin/service pazpar2 stop > /dev/null 2>&1
@@ -39,15 +42,15 @@ This package includes the Java Script library pz2.js. It also adds an
 Alias for Apache2 so that this library and other demo portals are
 available.
 
 Alias for Apache2 so that this library and other demo portals are
 available.
 
-%post -n pazpar2-js
+%posttrans -n pazpar2-js
 if [ -d /etc/httpd/conf.d ]; then
        ln -sf /etc/pazpar2/ap2pazpar2-js.cfg /etc/httpd/conf.d/pazpar2-js.conf
 if [ -d /etc/httpd/conf.d ]; then
        ln -sf /etc/pazpar2/ap2pazpar2-js.cfg /etc/httpd/conf.d/pazpar2-js.conf
-       /sbin/service httpd condrestart
 fi
 %preun -n pazpar2-js
 fi
 %preun -n pazpar2-js
-if [ -L /etc/httpd/conf.d/pazpar2-js.conf ]; then
-       rm /etc/httpd/conf.d/pazpar2-js.conf
-       /sbin/service httpd condrestart
+if [ $1 = 0 ]; then
+       if [ -L /etc/httpd/conf.d/pazpar2-js.conf ]; then
+               rm /etc/httpd/conf.d/pazpar2-js.conf
+       fi
 fi
 %package -n pazpar2-doc
 Summary: pazpar2 documentation
 fi
 %package -n pazpar2-doc
 Summary: pazpar2 documentation