aboutsummaryrefslogtreecommitdiff
path: root/www/cocoon/files/pkg-deinstall
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2004-07-01 22:30:19 +0000
committerGreg Lewis <glewis@FreeBSD.org>2004-07-01 22:30:19 +0000
commit68dfdf88f44e0fbec77c6c79ac408618017ef5fb (patch)
tree8211e536371e14ade904c913faee301ba41c02d7 /www/cocoon/files/pkg-deinstall
parentd1e5e7d115b278e9e87fcf75d3de14495d49780b (diff)
Notes
Diffstat (limited to 'www/cocoon/files/pkg-deinstall')
-rw-r--r--www/cocoon/files/pkg-deinstall61
1 files changed, 61 insertions, 0 deletions
diff --git a/www/cocoon/files/pkg-deinstall b/www/cocoon/files/pkg-deinstall
new file mode 100644
index 000000000000..55134b973319
--- /dev/null
+++ b/www/cocoon/files/pkg-deinstall
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# This script does the following.
+#
+# * Checks if the PID file exists. If it does, it kills the
+# process and removes the PID file.
+#
+# * Checks if the 'www' user exists. If it does, then it displays
+# a message.
+#
+# $FreeBSD$
+#
+# Borrowed from the jakarta-tomcat port
+#
+
+set -e
+
+PID_FILE=%%PID_FILE%%
+RUNASUSER=%%RUNASUSER%%
+APP_NAME=%%APP_NAME%%
+LOGFILE=%%LOGFILE%%
+
+# Make sure we're in the right stage of the process
+if [ "$2" = "DEINSTALL" ]; then
+
+ # Kill the process if it is still running
+ if [ -s ${PID_FILE} ]; then
+ PID=`cat ${PID_FILE}`
+ echo -n ">> Killing ${APP_NAME} process (${PID})..."
+
+ if /bin/kill ${PID} > /dev/null 2> /dev/null ; then
+ echo " [ DONE ]"
+ else
+ echo " [ FAILED ]"
+ fi
+
+ echo -n ">> Removing PID file (${PID_FILE})..."
+
+ if rm ${PID_FILE} > /dev/null 2> /dev/null ; then
+ echo " [ DONE ]"
+ else
+ echo " [ FAILED ]"
+ fi
+ fi
+
+ echo -n ">> Removing log file (${LOGFILE})..."
+ if rm ${LOGFILE} > /dev/null 2> /dev/null ; then
+ echo " [ DONE ]"
+ else
+ echo " [ FAILED ]"
+ fi
+fi
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+ # If the user exists, then display a message
+ if pw usershow "$RUNASUSER" 2>/dev/null 1>&2; then
+ echo "To delete the $RUNASUSER user permanently, use 'pw userdel $RUNASUSER'"
+ fi
+fi
+
+exit 0