[Pkg-mono-svn-commits] rev 528 - xsp-snapshot/trunk/debian/official
Pablo Fischer
pabl0-guest@haydn.debian.org
Fri, 09 Apr 2004 17:20:15 -0600
Author: pabl0-guest
Date: 2004-04-09 17:20:12 -0600 (Fri, 09 Apr 2004)
New Revision: 528
Modified:
xsp-snapshot/trunk/debian/official/mono-server.postinst
xsp-snapshot/trunk/debian/official/mono-server.prerm
xsp-snapshot/trunk/debian/official/mono-xsp.postinst
xsp-snapshot/trunk/debian/official/mono-xsp.postrm
Log:
The previous postinst is divided in preinst and postinst, the preinst
stops the daemon (if it's running) and postinst starts it. Sames for the
removal scripts
Modified: xsp-snapshot/trunk/debian/official/mono-server.postinst
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-server.postinst 2004-04-09 22:58:52 UTC (rev 527)
+++ xsp-snapshot/trunk/debian/official/mono-server.postinst 2004-04-09 23:20:12 UTC (rev 528)
@@ -7,19 +7,53 @@
tempfile=`/bin/tempfile`
modmono_default="/etc/default/mono-server"
+NAME=mono-server
+DESC="Mono Server, mono-server"
+CFGDIR=/etc/$NAME
+VIRTUALFILE=$CFGDIR/mono-server-hosts.conf
+
activate_monoserver() {
sed s/start_boot=false/start_boot=true/g $modmono_default > $tempfile
cp -f $tempfile $modmono_default
+ rm -Rf $tempfile
}
deactivate_monoserver() {
sed s/start_boot=true/start_boot=false/g $modmono_default > $tempfile
cp -f $tempfile $modmono_default
+ rm -Rf $tempfile
}
+should_start() {
+ if [ -e $DEFAULT ]; then
+ . $modmono_default
+ if [ "$start_boot" != "true" ]; then
+ return 1
+ fi
+ fi
+
+ if [ ! -f /usr/lib/apache/1.3/500mod_mono.info ]; then
+ return 1
+ fi
+
+ if [ ! -e $VIRTUALFILE ]; then
+ return 1
+ fi
+
+ if [[ $virtual_dirs = *Sorry* ]]; then
+ return 1
+ fi
+
+ if [[ -z $virtual_dirs ]]; then
+ return 1
+ fi
+ return 0
+
+}
+
case "$1" in
configure)
db_get monoserver/monoserver_autostart || true
@@ -31,7 +65,10 @@
mono-server-update.conf
if [ "$RET" = "true" ]; then
- /etc/init.d/mono-server start
+ if should_start ; then
+ echo -n "Starting $DESC: $NAME "
+ /etc/init.d/mono-server start > /dev/null 2>&1 || true
+ fi
fi
;;
Modified: xsp-snapshot/trunk/debian/official/mono-server.prerm
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-server.prerm 2004-04-09 22:58:52 UTC (rev 527)
+++ xsp-snapshot/trunk/debian/official/mono-server.prerm 2004-04-09 23:20:12 UTC (rev 528)
@@ -1,16 +1,35 @@
#!/bin/sh -e
+NAME=mono-server
+DESC="Mono Server, mono-server"
+
monoserverconfd="/etc/mono-server/conf.d/"
+should_stop() {
+ if [ -f /var/run/$NAME ]; then
+ # Are we really running monoserver?
+ monoserver_pid=`cat /var/run/$NAME`
+ monoserver_ps=`ps -p $monoserver_pid | wc -l`
+ # Are there any process running by that pid?
+ if [ "$monoserver_ps" = "2" ]; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+ return 0
+}
+
case "$1" in
remove)
- # We really need the virtual.conf?
- if [ -d $monoserverconfd ]; then
- rm -Rf "$monoserverconfd/*"
+ # should we stop the server?
+ if should_stop ; then
+ echo "Stopping $DESC: $NAME "
+ /etc/init.d/mono-server stop > /dev/null 2>&1 || true
fi
;;
*)
;;
- esac
+esac
exit 0
Modified: xsp-snapshot/trunk/debian/official/mono-xsp.postinst
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-xsp.postinst 2004-04-09 22:58:52 UTC (rev 527)
+++ xsp-snapshot/trunk/debian/official/mono-xsp.postinst 2004-04-09 23:20:12 UTC (rev 528)
@@ -7,6 +7,11 @@
tempfile=`/bin/tempfile`
xsp_default="/etc/default/mono-xsp"
+NAME=mono-xsp
+DESC="XSP WebServer"
+CFGDIR=/etc/xsp
+VIRTUALFILE=$CFGDIR/mono-xsp-hosts.conf
+virtual_dirs=`mono-xsp-reader.conf`
activate_xsp() {
sed s/start_boot=false/start_boot=true/g $xsp_default > $tempfile
@@ -33,7 +38,43 @@
rm -Rf $tempfile
}
+should_start() {
+ if [ -e $xsp_default ]; then
+ . $xsp_default
+ if [ "$start_boot" != "true" ]; then
+ return 1
+ fi
+ fi
+
+ if [ ! -e $VIRTUALFILE ]; then
+ return 1
+ fi
+
+ if [[ $virtual_dirs = *Sorry* ]]; then
+ return 1
+ fi
+
+ if [[ -z $virtual_dirs ]]; then
+ return 1
+ fi
+ if [ -f /var/run/$NAME ]; then
+ # Are we really running xsp?
+ xsp_pid=`cat /var/run/$NAME`
+ xsp_ps=`ps -p $xsp_pid | wc -l`
+ if [ "$xsp_ps" != "2" ]; then
+ return 0
+ else
+ return 1
+ fi
+ else
+ return 1
+ fi
+
+ return 1
+
+}
+
case "$1" in
configure)
db_get xsp/xsp_autostart || true
@@ -56,7 +97,10 @@
mono-xsp-update.conf
if [ "$RET" = "true" ]; then
- /etc/init.d/mono-xsp start
+ if should_start ; then
+ echo "Starting $DESC: $NAME "
+ /etc/init.d/mono-xsp start > /dev/null 2>&1 || true
+ fi
fi
;;
Modified: xsp-snapshot/trunk/debian/official/mono-xsp.postrm
===================================================================
--- xsp-snapshot/trunk/debian/official/mono-xsp.postrm 2004-04-09 22:58:52 UTC (rev 527)
+++ xsp-snapshot/trunk/debian/official/mono-xsp.postrm 2004-04-09 23:20:12 UTC (rev 528)
@@ -3,12 +3,8 @@
xspconfd="/etc/xsp/conf.d/"
case "$1" in
- remove)
- # We really need the virtual.conf?
- if [ -d $xspconfd ]; then
- rm -Rf "$xspconfd/*"
- /etc/init.d/mono-xsp stop
- fi
+ purge)
+ rm -Rf "$xspconfd/*"
;;
*)
;;