diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | add-webapp | 15 | ||||
-rwxr-xr-x | del-webapp | 19 | ||||
-rw-r--r-- | rpm-helper.macros.in | 10 |
4 files changed, 45 insertions, 1 deletions
@@ -17,7 +17,7 @@ FILES = AUTHORS README README.CVS COPYING ChangeLog Makefile \ $(PACKAGE).spec $(SCRIPTS) $(MACROFILEIN) SCRIPTS = add-user del-user add-service del-service create-file \ add-group del-group add-shell del-shell verify-shell \ - add-syslog del-syslog + add-syslog del-syslog add-webapp del-webapp LIBDIR=/usr/share/$(PACKAGE) RPMACROSDIR=/etc/rpm/macros.d diff --git a/add-webapp b/add-webapp new file mode 100755 index 0000000..6468280 --- /dev/null +++ b/add-webapp @@ -0,0 +1,15 @@ +#!/bin/sh + +if [ $# != 2 ]; then + echo "usage: $0 <pkg name> <number installed>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed + +if [ $num = 1 ]; then + # installation: restart web server if running, + # as there is a new configuration file + /sbin/service httpd condrestart +fi diff --git a/del-webapp b/del-webapp new file mode 100755 index 0000000..95a4eef --- /dev/null +++ b/del-webapp @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ $# != 2 ]; then + echo "usage: $0 <pkg name> <number installed>" 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed + +if [ $num = 0 ]; then + # uninstallation: restart web server if running, + # a there is one less configuration file + /sbin/service httpd condrestart +else + # update: just reload web server if running, + # as the number of configuration files didn't change + /sbin/service httpd condreload +fi diff --git a/rpm-helper.macros.in b/rpm-helper.macros.in index bcfcf37..5907c12 100644 --- a/rpm-helper.macros.in +++ b/rpm-helper.macros.in @@ -45,3 +45,13 @@ %_preun_syslogdel() %_del_syslog_helper %{name} $1 %{1} %{?2:%2} %{?3:%3} %{?4:%4} %{?5:%5} \ %{nil} +# Web App dir + +%_add_webapp_helper @LIBDIR@/add-webapp +%_post_webapp() %_add_webapp_helper %{name} $1 %{1} \ +%{nil} + +%_del_webapp_helper @LIBDIR@/del-webapp +%_postun_webapp() %_del_webapp_helper %{name} $1 %{1} \ +%{nil} + |