[csw-devel] SF.net SVN: gar:[4667] csw/mgar/pkg/squid/trunk

valholla at users.sourceforge.net valholla at users.sourceforge.net
Mon May 4 22:20:15 CEST 2009


Revision: 4667
          http://gar.svn.sourceforge.net/gar/?rev=4667&view=rev
Author:   valholla
Date:     2009-05-04 20:20:15 +0000 (Mon, 04 May 2009)

Log Message:
-----------
checkin

Modified Paths:
--------------
    csw/mgar/pkg/squid/trunk/Makefile
    csw/mgar/pkg/squid/trunk/files/CSWsquid.postinstall
    csw/mgar/pkg/squid/trunk/files/CSWsquid.preremove

Added Paths:
-----------
    csw/mgar/pkg/squid/trunk/files/cswsquid

Removed Paths:
-------------
    csw/mgar/pkg/squid/trunk/files/CSWsquid.s8-init

Modified: csw/mgar/pkg/squid/trunk/Makefile
===================================================================
--- csw/mgar/pkg/squid/trunk/Makefile	2009-05-04 18:39:16 UTC (rev 4666)
+++ csw/mgar/pkg/squid/trunk/Makefile	2009-05-04 20:20:15 UTC (rev 4667)
@@ -16,7 +16,10 @@
 PACKAGES = CSWsquid
 CATALOGNAME_CSWsquid = squid
 SPKG_DESC_CSWsquid = $(DESCRIPTION)
+SPKG_CLASSES_CSWsquid = none cswinitsmf
 
+PROTOTYPE_FILTER = awk '$$$$3 ~/\/init.d\/cswsquid$$$$/ { $$$$2 = "cswinitsmf" }'
+
 LD = /opt/csw/bin/gld
 export LD
 MASTER_SITES = http://www.squid-cache.org/Versions/v$(RELVER)/$(GARVERSION)/
@@ -43,10 +46,15 @@
 
 include gar/category.mk
 
-
 SPKG_REVSTAMP := $(SPKG_REVSTAMP)_$(RELEASE)
 
 pre-configure-modulated:
 	cd $(WORKSRC) && $(BUILD_ENV) ./bootstrap.sh
 	@$(MAKECOOKIE)
 
+post-install-modulated:
+	ginstall -d $(DESTDIR)/etc/init.d
+	gcp $(DOWNLOADDIR)/cswsquid $(DESTDIR)/etc/init.d
+	chmod 0755 $(DESTDIR)/etc/init.d/cswsquid
+	gmv $(DESTDIR)$(sysconfdir)/squid.conf \
+		$(DESTDIR)$(sysconfdir)/squid.conf.CSW

Modified: csw/mgar/pkg/squid/trunk/files/CSWsquid.postinstall
===================================================================
--- csw/mgar/pkg/squid/trunk/files/CSWsquid.postinstall	2009-05-04 18:39:16 UTC (rev 4666)
+++ csw/mgar/pkg/squid/trunk/files/CSWsquid.postinstall	2009-05-04 20:20:15 UTC (rev 4667)
@@ -1,12 +1,17 @@
 #!/bin/sh
 #
-# Squid-cache postinstall script
+# Squid-cache preremove script
 
 PATH=/usr/bin:/usr/sbin
 export PATH
+CSW_PREFIX=${PKG_INSTALL_ROOT}/opt/csw
+SQUID_CONFDIR=${CSW_PREFIX}/etc
 
-if [ -f /opt/csw/etc/squid.conf ]; then
-	/etc/init.d/cswsquid start
+if [ -f ${SQUID_CONFDIR}/squid.conf ]; then
+    echo 'squid.conf found, Preserving Existing Config!'
+else
+    cp ${SQUID_CONFDIR}/squid.conf.CSW ${SQUID_CONFDIR}/squid.conf
+    chmod 0644 ${SQUID_CONFDIR}/squid.conf
 fi
 
 exit 0

Modified: csw/mgar/pkg/squid/trunk/files/CSWsquid.preremove
===================================================================
--- csw/mgar/pkg/squid/trunk/files/CSWsquid.preremove	2009-05-04 18:39:16 UTC (rev 4666)
+++ csw/mgar/pkg/squid/trunk/files/CSWsquid.preremove	2009-05-04 20:20:15 UTC (rev 4667)
@@ -4,7 +4,20 @@
 
 PATH=/usr/bin:/usr/sbin
 export PATH
+CSW_PREFIX=${PKG_INSTALL_ROOT}/opt/csw
+SQUID_CONFDIR=${CSW_PREFIX}/etc
 
-/etc/init.d/cswsquid stop
+if [ -x /usr/sbin/svccfg -a -x /usr/sbin/svcadm ]; then
+    echo 'Stopping squid server and unregistering from smf'
+    svcadm disable -s svc:application/server/cswsquid:default
+    svccfg delete svc:application/server/cswsquid:default
+else
+    echo 'Stopping squid server'
+    if [ -x ${PKG_INSTALL_ROOT}/etc/init.d/cswsquid ]; then
+        ${PKG_INSTALL_ROOT}/etc/init.d/cswsquid stop
+    else
+        pkill -9 squid
+    fi
+fi
 
 exit 0

Deleted: csw/mgar/pkg/squid/trunk/files/CSWsquid.s8-init
===================================================================
--- csw/mgar/pkg/squid/trunk/files/CSWsquid.s8-init	2009-05-04 18:39:16 UTC (rev 4666)
+++ csw/mgar/pkg/squid/trunk/files/CSWsquid.s8-init	2009-05-04 20:20:15 UTC (rev 4667)
@@ -1,23 +0,0 @@
-#!/sbin/sh
-
-case "$1" in
-'start')
-        if [ -f /opt/csw/sbin/squid -a -f /opt/csw/etc/squid.conf ]; then
-        echo 'starting squid server.'
-        /opt/csw/sbin/squid -D &
-        fi
-	exit 0
-        ;;
-'stop')
-	if [ -f /opt/csw/sbin/squid -a -f /opt/csw/etc/squid.conf ]; then
-	echo 'stopping squid server... please wait for squid to cleanup...'
-        /opt/csw/sbin/squid -k shutdown && sleep 30
-	fi
-	exit 0
-        ;;
-
-*)
-        echo "Usage: $0 { start | stop }"
-        exit 1
-        ;;
-esac

Copied: csw/mgar/pkg/squid/trunk/files/cswsquid (from rev 4666, csw/mgar/pkg/squid/trunk/files/CSWsquid.s8-init)
===================================================================
--- csw/mgar/pkg/squid/trunk/files/cswsquid	                        (rev 0)
+++ csw/mgar/pkg/squid/trunk/files/cswsquid	2009-05-04 20:20:15 UTC (rev 4667)
@@ -0,0 +1,60 @@
+#!/sbin/sh
+
+PATH=/usr/bin
+CSWPREFIX=/opt/csw
+CSWETC=${CSWPREFIX}/etc
+CSWSBIN=${CSWPREFIX}/sbin
+SQUID_DAEMON=${CSWSBIN}/squid
+SQUID_CONF=${CSWETC}/squid.conf
+
+case "$1" in
+    'start')
+        if [ -x ${SQUID_DAEMON} -a -f ${SQUID_CONF} ]; then
+            if [ -n "`pgrep squid`" ]; then
+                echo 'squid server is already running'
+	            exit 0
+            else
+                echo 'starting squid server.'
+                ${SQUID_DAEMON} -D &
+	            exit 0
+            fi
+        else
+            echo '****  NOTICE  ****'
+            echo 'Problem starting squid server,'
+            echo 'Please make sure it is properly installed'
+            echo 'and properly configured.'
+            exit 1
+        fi
+        ;;
+    'stop')
+        if [ -x ${SQUID_DAEMON} -a -f ${SQUID_CONF} ]; then
+            if [ -n "`pgrep squid`" ]; then
+                ## stop gracefully
+	            echo 'stopping squid server... please wait for cleanup...'
+                ${SQUID_DAEMON} -k shutdown && sleep 30
+                if [ -n "`pgrep squid`" ]; then
+                    echo 'squid server still running, killing...'
+                    pkill -9 squid
+                fi
+	            exit 0
+            else
+                ## Not running
+                echo 'squid server is already down'
+	            exit 0
+            fi
+        else
+            echo '****  NOTICE  ****'
+            echo 'Squid server not properly installed'
+            echo 'Forcing Down!'
+            pkill -9 squid
+            exit 1
+	    fi
+        ;;
+
+    *)
+        echo "Usage: $0 { start | stop }"
+        exit 1
+        ;;
+esac
+
+exit 0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list