[csw-devel] SF.net SVN: gar:[13516] csw/mgar/pkg/lighttpd/trunk/files

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Mar 1 23:31:34 CET 2011


Revision: 13516
          http://gar.svn.sourceforge.net/gar/?rev=13516&view=rev
Author:   wahwah
Date:     2011-03-01 22:31:34 +0000 (Tue, 01 Mar 2011)

Log Message:
-----------
lighttpd: Checking in scripts from the non-gar package

Added Paths:
-----------
    csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.postinstall
    csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.preremove
    csw/mgar/pkg/lighttpd/trunk/files/cswlighttpd

Added: csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.postinstall
===================================================================
--- csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.postinstall	                        (rev 0)
+++ csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.postinstall	2011-03-01 22:31:34 UTC (rev 13516)
@@ -0,0 +1,71 @@
+# lighttpd - postinstall script
+# 
+if [ "$PKG_INSTALL_ROOT" = "" ]
+then 
+  PKG_INSTALL_ROOT=/
+  CONFDIR="/opt/csw/etc"
+else
+  CONFDIR="$PKG_INSTALL_ROOT/opt/csw/etc"
+fi
+
+# daemons are started by default
+enable_daemon=yes
+
+# Source csw.conf, if it exists
+if [ -f $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/opt/csw/etc/csw.conf
+fi
+if [ -f $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf ] ; then
+  . $PKG_INSTALL_ROOT/etc/opt/csw/csw.conf
+fi
+
+# If defined, autoenable for the specific daemon name takes precedence
+if [ "$autoenable_lighttpd" = "no" ] ; then
+  enable_daemon=no
+elif [ "$autoenable_daemons" = "no" -a ! -n "$autoenable_lighttpd" ] ; then
+  enable_daemon=no
+fi
+
+# We don't want to overwrite the lighttpd.conf the user may have already installed
+case "$autoenable_demons" in
+  ""|"yes")
+    if [ ! -f $CONFDIR/lighttpd.conf ]; then
+      echo copying default template lighttpd.conf.CSW to lighttpd.conf
+      cp -p $CONFDIR/lighttpd.conf.CSW $CONFDIR/lighttpd.conf
+    else
+      echo lighttpd.conf already exists. Not copying lighttpd.conf.CSW
+    fi
+    ;;
+esac
+
+# Set variable smf depending on the availability of SMF binaries
+smf=no
+if [ -f $PKG_INSTALL_ROOT/usr/sbin/svccfg -a -f $PKG_INSTALL_ROOT/usr/sbin/svcadm ]; then
+  smf=yes
+fi
+
+# let's add lighttpd to the smf framework if necessary (we won't enable it yet)
+if [ $smf = yes ]; then
+  echo "Configuring service in SMF"
+  /usr/sbin/svccfg import /opt/csw/var/svc/manifest/network/lighttpd.xml >/dev/null 2>&1
+  /usr/sbin/svcadm disable svc:network/lighttpd >/dev/null 2>&1
+  echo "Lighttpd is using Service Management Facility."
+  echo "  The FMRI is: svc:network/lighttpd"
+fi
+
+if [ "$PKG_INSTALL_ROOT" = "" ] ; then PKG_INSTALL_ROOT=/ ; fi
+
+# Let's enable the daemon (if necessary)
+if [ "$enable_daemon" = "yes" -a "$PKG_INSTALL_ROOT" = "/" ]; then
+  echo "Starting lighttpd"
+  if [ $smf = no ]; then
+    /etc/init.d/cswlighttpd start >/dev/null 2>&1
+  else
+    /usr/sbin/svcadm enable svc:network/lighttpd >/dev/null 2>&1
+  fi
+fi
+
+# FIXES: https://www.opencsw.org/mantis/view.php?id=4574
+crle -l /usr/lib:/lib:/opt/csw/gcc4/lib
+
+exit 0

Added: csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.preremove
===================================================================
--- csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.preremove	                        (rev 0)
+++ csw/mgar/pkg/lighttpd/trunk/files/CSWlighttpd.preremove	2011-03-01 22:31:34 UTC (rev 13516)
@@ -0,0 +1,29 @@
+# lighttpd  - preremove script
+# Stop lighttpd if it is running.
+CONFFILE=$CONFDIR/lighttpd.conf
+if [ "$PKG_ROOT_DIR" = "" ] ; then PKG_ROOT_DIR=/ ; fi
+ 
+smf=no
+if [ -f $PKG_ROOT_DIR/usr/sbin/svccfg -a -f $PKG_ROOT_DIR/usr/sbin/svcadm ] ; then smf=yes ; fi
+
+if [ $smf = yes ]
+then
+  /usr/sbin/svcadm disable -s svc:network/lighttpd >/dev/null 2>&1
+  /usr/sbin/svccfg delete svc:network/lighttpd >/dev/null 2>&1
+else
+  case "$PKG_ROOT_DIR" in
+    "/")
+        test -x /etc/init.d/cswlighttpd && /etc/init.d/cswlighttpd stop
+      ;;
+  esac
+fi
+
+# Remove lighttpd.conf if necessary
+if cmp $CONFFILE $CONFFILE.CSW >/dev/null ; then
+  echo "$CONFFILE unchanged from default. Removing it."
+  rm $CONFFILE
+else
+  echo "$CONFFILE has been modified. Leaving it as-is."
+fi
+
+exit 0

Added: csw/mgar/pkg/lighttpd/trunk/files/cswlighttpd
===================================================================
--- csw/mgar/pkg/lighttpd/trunk/files/cswlighttpd	                        (rev 0)
+++ csw/mgar/pkg/lighttpd/trunk/files/cswlighttpd	2011-03-01 22:31:34 UTC (rev 13516)
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Copyright 2005 Sergiusz Pawlowicz  All rights reserved.
+# Use is subject to license terms.
+# Modified for lighttpd
+#
+#
+
+LIGHTTPD_HOME=/opt/csw
+CONF_FILE=/opt/csw/etc/lighttpd.conf
+PIDFILE=/var/run/lighttpd.pid
+HTTPD="${LIGHTTPD_HOME}/sbin/lighttpd"
+
+[ ! -f ${CONF_FILE} ] &&  exit $CONF_FILE
+
+case "$1" in
+start)
+        /bin/rm -f ${PIDFILE}
+# Enable NCA:
+        NCAKMODCONF=/etc/nca/ncakmod.conf
+        if [ -f $NCAKMODCONF ]; then
+            . $NCAKMODCONF
+            if [ "x$status" = "xenabled" ]; then
+                 HTTPD="env LD_PRELOAD=/usr/lib/ncad_addr.so $HTTPD"
+            fi
+        fi
+        exec $HTTPD -f ${CONF_FILE} 2>&1
+        ;;
+refresh)
+        if [ -f "$PIDFILE" ]; then
+                /usr/bin/kill -HUP `/usr/bin/cat $PIDFILE`
+        fi
+        ;;
+stop)
+        if [ -f "$PIDFILE" ]; then
+                /usr/bin/kill -QUIT `/usr/bin/cat $PIDFILE`
+        fi
+        ;;
+*)
+        echo "Usage: $0 {start|stop|refresh}"
+        exit 1
+        ;;
+esac


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