Revision: 2965
          http://gar.svn.sourceforge.net/gar/?rev=2965&view=rev
Author:   aigoshin
Date:     2009-02-02 18:27:05 +0000 (Mon, 02 Feb 2009)

Log Message:
-----------
nginx: milestone 2

Modified Paths:
--------------
    csw/mgar/pkg/nginx/trunk/Makefile
    csw/mgar/pkg/nginx/trunk/checksums
    csw/mgar/pkg/nginx/trunk/files/CSWnginx.gspec
    csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall
    csw/mgar/pkg/nginx/trunk/files/svc-cswnginx

Added Paths:
-----------
    csw/mgar/pkg/nginx/trunk/files/CSWnginx.checkinstall
    csw/mgar/pkg/nginx/trunk/files/CSWnginx.preremove

Modified: csw/mgar/pkg/nginx/trunk/Makefile
===================================================================
--- csw/mgar/pkg/nginx/trunk/Makefile   2009-02-02 18:17:49 UTC (rev 2964)
+++ csw/mgar/pkg/nginx/trunk/Makefile   2009-02-02 18:27:05 UTC (rev 2965)
@@ -10,13 +10,13 @@
 
 MASTER_SITES = http://sysoev.ru/nginx/
 DISTFILES  = $(GARNAME)-$(GARVERSION).tar.gz
-DISTFILES += $(call admfiles,CSWnginx,postinstall)
+DISTFILES += $(call admfiles,CSWnginx,checkinstall postinstall preremove)
 DISTFILES += cswnginx.xml svc-cswnginx
 
 # We define upstream file regex so we can be notifed of new upstream software 
release
 UFILES_REGEX = -(\d+(?:\.\d+)*).tar.gz
 
-REQUIRED_PKGS = CSWosslrt CSWpcre  CSWzlib
+REQUIRED_PKGS = CSWosslrt CSWpcrert  CSWzlib
 
 CFLAGS =
 

Modified: csw/mgar/pkg/nginx/trunk/checksums
===================================================================
--- csw/mgar/pkg/nginx/trunk/checksums  2009-02-02 18:17:49 UTC (rev 2964)
+++ csw/mgar/pkg/nginx/trunk/checksums  2009-02-02 18:27:05 UTC (rev 2965)
@@ -1,5 +1,7 @@
 31d26f66824fd2d3f33ac0b3b9db1532  download/nginx-0.7.30.tar.gz
-9103d1634917ce758fe6bf49706b6229  download/CSWnginx.gspec
-87439f67e79eeb22db439ecbb27761a7  download/CSWnginx.postinstall
+12b5333e18e985b17f8a5465646e9a8a  download/CSWnginx.gspec
+521cd4c0248aebfdb25df48a11a8cc49  download/CSWnginx.checkinstall
+9b563db1078bad23e49f8db06809aac0  download/CSWnginx.postinstall
+e9178dc33f2d38aab8f118a8f0550ac7  download/CSWnginx.preremove
 5c832758a62ee319ea9dfd1829d736eb  download/cswnginx.xml
-64aa7f1749c33228be337119bc3f7b5f  download/svc-cswnginx
+19bb7c5d6246343f54b13afb327f7bcb  download/svc-cswnginx

Added: csw/mgar/pkg/nginx/trunk/files/CSWnginx.checkinstall
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/CSWnginx.checkinstall                        
        (rev 0)
+++ csw/mgar/pkg/nginx/trunk/files/CSWnginx.checkinstall        2009-02-02 
18:27:05 UTC (rev 2965)
@@ -0,0 +1,47 @@
+#!/sbin/sh
+#################################################################################
+# CUSTOM SECTION
+#################################################################################
+
+UPGRADE_NGINX="0"
+
+SMF="no"
+test -f $BASEDIR/usr/sbin/svccfg -a -f $BASEDIR/usr/sbin/svcadm && SMF="yes"
+
+if [ "$SMF" = "yes" ]; then
+       STATE=`$BASEDIR/usr/bin/svcs -Ho STATE nginx 2>/dev/null`
+       if [ $? -eq 0 ]; then
+               echo "nginx service is in '$STATE' state"
+               if [ "$STATE" = "online" ]; then
+                       if [ -x "$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx" 
]; then
+                               
NXSTATE=`$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx state`
+                               echo "nginx is $NXSTATE"
+                               if [ "$NXSTATE" = "running" ]; then
+                                       echo "nginx online upgrade is requested"
+                                       UPGRADE_NGINX="1"
+                               fi
+                       fi
+               fi
+       fi
+else
+       if [ -x $BASEDIR/etc/init.d/cswnginx ]; then
+               NXSTATE=`$BASEDIR/etc/init.d/cswnginx state`
+               echo "nginx is $NXSTATE"
+               if [ "$NXSTATE" = "running" ]; then
+                       echo "nginx online upgrade is requested"
+                       UPGRADE_NGINX="1"
+               fi
+       fi
+fi
+
+
+# Make env variables available to other packaging scripts
+
+cat >$1 <<!
+UPGRADE_NGINX='$UPGRADE_NGINX'
+!
+
+#################################################################################
+# END CUSTOM SECTION
+#################################################################################
+


Property changes on: csw/mgar/pkg/nginx/trunk/files/CSWnginx.checkinstall
___________________________________________________________________
Added: svn:executable
   + *

Modified: csw/mgar/pkg/nginx/trunk/files/CSWnginx.gspec
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/CSWnginx.gspec       2009-02-02 18:17:49 UTC 
(rev 2964)
+++ csw/mgar/pkg/nginx/trunk/files/CSWnginx.gspec       2009-02-02 18:27:05 UTC 
(rev 2965)
@@ -2,7 +2,7 @@
 %var            pkgname CSWnginx
 %include        url file://%{PKGLIB}/csw_dyndepend.gspec
 %include        url file://%{PKGLIB}/smf_enabled.gspec
-%var            SERVICE_CONF_FILES /opt/csw/etc/nginx/nginx.conf
+%var            SERVICE_CONF_FILES /opt/csw/etc/nginx/nginx.conf 
/opt/csw/etc/nginx/fastcgi_params /opt/csw/etc/nginx/mime.types
 %var            RC_INIT_SCRIPT     cswnginx
 %var            INIT_KILL_PRIO     16
 %var            INIT_START_PRIO    90

Modified: csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall 2009-02-02 18:17:49 UTC 
(rev 2964)
+++ csw/mgar/pkg/nginx/trunk/files/CSWnginx.postinstall 2009-02-02 18:27:05 UTC 
(rev 2965)
@@ -1,11 +1,48 @@
 #!/sbin/sh
+#################################################################################
+# CUSTOM SECTION
+#################################################################################
 
-if [ "$NEEDUPGRADE" = "1" ] ; then
+if [ $UPGRADE_NGINX -eq 1 ]; then
+       UPGRADE_NGINX_ERR=0
        if [ -x "$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx" ]; then
-               $BASEDIR/opt/csw/lib/svc/method/svc-cswnginx upgrade
+               MSG=`$BASEDIR/opt/csw/lib/svc/method/svc-cswnginx upgrade`
+               if [ $? -eq 0 ]; then
+                       echo " "
+                       echo "nginx was upgraded"
+               else
+                       UPGRADE_NGINX_ERR=1
+               fi
        else
-               test -x $BASEDIR/etc/init.d/cswnginx && 
$BASEDIR/etc/init.d/cswnginx upgrade
+               if [ -x $BASEDIR/etc/init.d/cswnginx ]; then
+                       MSG=`$BASEDIR/etc/init.d/cswnginx upgrade`
+                       if [ $? -eq 0 ]; then
+                               echo " "
+                               echo "nginx was upgraded"
+                       else
+                               UPGRADE_NGINX_ERR=1
+                       fi
+               else
+                       echo " "
+                       echo "nginx was NOT upgraded"
+               fi
        fi
+
+       if [ $UPGRADE_NGINX_ERR -eq 1 ]; then
+               echo " "
+               echo "nginx was NOT upgraded"
+               echo "$MSG"
+       fi
+else
+       echo " "
+       echo "This package may use online upgrade feature of nginx which"
+       echo "allows not to interrupt the processing of clients requests"
+       echo "during the nginx version upgrade."
+       echo "To use it you should install the package over the existing"
+       echo "version (without removing)."
 fi
 
-exit 0
+#################################################################################
+# END CUSTOM SECTION
+#################################################################################
+

Added: csw/mgar/pkg/nginx/trunk/files/CSWnginx.preremove
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/CSWnginx.preremove                           
(rev 0)
+++ csw/mgar/pkg/nginx/trunk/files/CSWnginx.preremove   2009-02-02 18:27:05 UTC 
(rev 2965)
@@ -0,0 +1,37 @@
+#!/sbin/sh
+#################################################################################
+# CUSTOM SECTION
+#################################################################################
+
+case "$PKG_ROOT_DIR" in
+       ""|"/")
+       if [ "$SMF" = "yes" ]; then
+               echo "stopping nginx service..."
+               $BASEDIR/usr/sbin/svcadm disable -s nginx
+       else
+               echo "stopping nginx..."
+               test -x $BASEDIR/etc/init.d/cswnginx && 
$BASEDIR/etc/init.d/cswnginx stop
+       fi
+       ;;
+esac
+
+for CONF_FILE in $SERVICE_CONF_FILES; do
+       test -r ${CONF_FILE}.CSW || continue
+       /bin/diff $CONF_FILE ${CONF_FILE}.CSW >/dev/null 2>&1
+       case "$?" in
+       0)
+               echo "removing unmodified $CONF_FILE"
+               rm -f $CONF_FILE
+               ;;
+       1)
+               echo "not touching modified $CONF_FILE"
+               ;;
+       *)
+               ;;
+       esac
+done
+
+#################################################################################
+# END CUSTOM SECTION
+#################################################################################
+


Property changes on: csw/mgar/pkg/nginx/trunk/files/CSWnginx.preremove
___________________________________________________________________
Added: svn:executable
   + *

Modified: csw/mgar/pkg/nginx/trunk/files/svc-cswnginx
===================================================================
--- csw/mgar/pkg/nginx/trunk/files/svc-cswnginx 2009-02-02 18:17:49 UTC (rev 
2964)
+++ csw/mgar/pkg/nginx/trunk/files/svc-cswnginx 2009-02-02 18:27:05 UTC (rev 
2965)
@@ -65,6 +65,26 @@
        return $RETVAL
 }
 
+state() {
+       if [ -s "$PIDFILE" ]; then
+               FPID=`/bin/cat $PIDFILE`
+       else
+               echo "not running"
+               return 1
+       fi
+       PIDP=`/bin/ps -o pid= -p $FPID`
+       if [ "$PIDP" = "" ]; then
+               echo "not running"
+               return 1
+       fi
+       COMM=`/bin/ps -o comm= -p $FPID`
+       if [ "$NGINX" = "$COMM" ]; then
+               echo "running"
+       else
+               echo "running, but it is not a CSW package"
+       fi
+}
+
 upgrade()
 {
        killpidf -USR2
@@ -97,13 +117,17 @@
        rotate
        RETVAL=$?
        ;;
+state)
+       state
+       RETVAL=$?
+       ;;
 upgrade)
        check
        RETVAL=$?
        [ $RETVAL -eq 0 ] && upgrade ||:
        ;;
 *)
-       echo "Usage: $0 {start|stop|refresh|reload|restart|rotate|upgrade}"
+       echo "Usage: $0 
{start|stop|refresh|reload|restart|rotate|state|upgrade}"
        exit 1
        ;;
 esac


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
devel mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/devel

Reply via email to