[csw-devel] SF.net SVN: gar:[6737] csw/mgar/pkg/cswclassutils/trunk

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Wed Oct 7 04:58:35 CEST 2009


Revision: 6737
          http://gar.svn.sourceforge.net/gar/?rev=6737&view=rev
Author:   bdwalton
Date:     2009-10-07 02:58:35 +0000 (Wed, 07 Oct 2009)

Log Message:
-----------
cswclassutils: make prototype dynamic; add {i,r}.cswinetd

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/Makefile
    csw/mgar/pkg/cswclassutils/trunk/checksums

Added Paths:
-----------
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinetd
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinetd

Removed Paths:
-------------
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.gspec
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype

Modified: csw/mgar/pkg/cswclassutils/trunk/Makefile
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-10-06 20:52:14 UTC (rev 6736)
+++ csw/mgar/pkg/cswclassutils/trunk/Makefile	2009-10-07 02:58:35 UTC (rev 6737)
@@ -1,11 +1,10 @@
 GARNAME = cswclassutils
-GARVERSION = 1.18
+GARVERSION = 1.19
 CATEGORIES = utils
 
 DESCRIPTION = CSW class action utilities
 
 MASTER_SITES = 
-DISTFILES += $(call admfiles,CSWcswclassutils,prototype)
 
 ARCHALL = 1
 
@@ -14,23 +13,24 @@
 TEST_SCRIPTS =
 INSTALL_SCRIPTS = custom
 
-include gar/category.mk
-
-WORKSRC = $(WORKDIR)
 SPKG_SOURCEURL = http://www.opencsw.org
 
-CASLIST = cswcpsampleconf cswpreserveconf cswinitsmf cswusergroup cswpycompile
+CASLIST = $(foreach F,$(wildcard $(FILEDIR)/CSW$(GARNAME).[ir].*), $(subst $(FILEDIR)/CSW$(GARNAME).,,$(F)))
 
+PROTOTYPE_FILTER = sed -e '/^d.*\/usr/d; /scripts/{ s/bin/sys/; }'
+
+include gar/category.mk
+
 install-custom:
 	@echo " ==> Installing $(GARNAME) (custom)"
 	@rm -rf $(DESTDIR)
-	@ginstall -d $(DESTDIR)/etc/opt/csw/init.d
-	@ginstall -d $(DESTDIR)$(docdir)/$(GARNAME)
-	@ginstall -d $(DESTDIR)/usr/sadm/install/scripts
-	@ginstall -d $(DESTDIR)/var/opt/csw/svc/manifest
-	@ginstall -d $(DESTDIR)/var/opt/csw/svc/method
-	@cp $(FILEDIR)/CSW$(GARNAME).csw.smf.sample $(DESTDIR)/etc/opt/csw/init.d/csw.smf.sample
-	@cp $(FILEDIR)/CSW$(GARNAME).README.CSW $(DESTDIR)$(docdir)/$(GARNAME)/README.CSW
-	@cp $(FILEDIR)/CSW$(GARNAME).copyright $(DESTDIR)$(docdir)/$(GARNAME)/license
-	@$(foreach CAS,$(CASLIST),cp $(FILEDIR)/CSW$(GARNAME).i.$(CAS) $(DESTDIR)/usr/sadm/install/scripts/i.$(CAS);cp $(FILEDIR)/CSW$(GARNAME).r.$(CAS) $(DESTDIR)/usr/sadm/install/scripts/r.$(CAS);)
+	@ginstall -m 0755 -d $(DESTDIR)/etc/opt/csw/init.d
+	@ginstall -m 0755 -d $(DESTDIR)$(docdir)/$(GARNAME)
+	@ginstall -m 0755 -d $(DESTDIR)/usr/sadm/install/scripts
+	@ginstall -m 0755 -d $(DESTDIR)/var/opt/csw/svc/manifest
+	@ginstall -m 0755 -d $(DESTDIR)/var/opt/csw/svc/method
+	@ginstall -m 0755 $(FILEDIR)/CSW$(GARNAME).csw.smf.sample $(DESTDIR)/etc/opt/csw/init.d/csw.smf.sample
+	@ginstall -m 0444 $(FILEDIR)/CSW$(GARNAME).README.CSW $(DESTDIR)$(docdir)/$(GARNAME)/README.CSW
+	@ginstall -m 0444 $(FILEDIR)/CSW$(GARNAME).copyright $(DESTDIR)$(docdir)/$(GARNAME)/license
+	@$(foreach CAS,$(CASLIST),ginstall -m 0555 $(FILEDIR)/CSW$(GARNAME).$(CAS) $(DESTDIR)/usr/sadm/install/scripts/$(CAS);)
 	@$(MAKECOOKIE)

Modified: csw/mgar/pkg/cswclassutils/trunk/checksums
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/checksums	2009-10-06 20:52:14 UTC (rev 6736)
+++ csw/mgar/pkg/cswclassutils/trunk/checksums	2009-10-07 02:58:35 UTC (rev 6737)
@@ -1,2 +0,0 @@
-38e0bf6e204e003254ed246df2b4e1f9  download/CSWcswclassutils.gspec
-854d77b21b177b15fd2aac39339a0c8c  download/CSWcswclassutils.prototype

Deleted: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.gspec
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.gspec	2009-10-06 20:52:14 UTC (rev 6736)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.gspec	2009-10-07 02:58:35 UTC (rev 6737)
@@ -1,11 +0,0 @@
-%var            bitname cswclassutils
-%var            pkgname CSWcswclassutils
-%var		arch all
-%include        url file://%{PKGLIB}/csw_vars.gspec
-%pkginfo        url file://%{PKGLIB}/csw/pkginfo
-%include        url file://%{PKGLIB}/csw_prototype.gspec
-%depend
-%copyright
-
-Please see /opt/csw/share/doc/cswclassutils/license for license information.
-

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinetd
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinetd	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswinetd	2009-10-07 02:58:35 UTC (rev 6737)
@@ -0,0 +1,119 @@
+#!/bin/sh
+#
+# i.cswinetd - Class action script for CSW inetd support
+#
+# Written and maintained by Ben Walton
+#
+# 2009-10-02 Initial release
+
+# set DEBUG to any value to enable trace outpu.
+DEBUG=
+
+# 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
+
+# Determine if we should import the file with inetconv
+case "`uname -r`" in
+    5.8|5.9) useinetconv=no;;
+    *) useinetconv=yes;;
+esac
+
+echo "Installing class <cswinetd> ..."
+
+while read src dest; do
+
+  echo $dest
+  /usr/bin/cp $src $dest || exit 2
+
+  inetdsvc=`cat $dest`
+  set -- $inetdsvc
+  svcname=$1
+  proto=$3
+
+  if [ -n "$DEBUG" ]; then
+      echo "svcname: $svcname; proto: $proto"
+  fi
+
+  case "$svcname" in
+      */*) isrpc=yes;;
+      *) isrpc=no;;
+  esac
+
+  # Determine if service should be started or not
+  daemon=yes
+  if [ "$autoenable_daemons" = "no" ]; then
+      daemon=no
+  fi
+  eval autoenable_service="\$autoenable_$svcname"
+  if [ "$autoenable_service" = "no" ]; then
+      daemon=no
+  elif [ "$autoenable_service" = "yes" ]; then
+      daemon=yes
+  fi
+
+  # we won't register with inetd if the service name isn't registered
+  # in the global services file.
+  /usr/xpg4/bin/grep -q "^$svcname[[:space:]]" /etc/inet/services
+  if [ $? -eq 0 ]; then
+      if [ -n "$DEBUG" ]; then
+	  echo "Installing inetd service:"
+	  echo "$inetdsvc"
+      fi
+
+      if [ "$useinetconv" = "yes" ]; then
+	  [ -n "$DEBUG" ] && echo "For solaris 10 (or newer)"
+
+	  outdir=/var/opt/csw/svc/manifest/network
+	  if [ "$isrpc" = "yes" ]; then
+	      outdir=$outdir/rpc
+	  fi
+	  manifest=$outdir/$svcname-$proto.xml
+
+	  echo "$inetdsvc" > /tmp/$svcname.$$
+
+	  # we use -f to force any in the specified inetd to take precedence
+	  /usr/sbin/inetconv -f -i /tmp/$svcname.$$ -o $outdir || exit 2
+	  if [ "$daemon" = "yes" ]; then
+	      /usr/sbin/inetadm -e svc:/network/$svcname/$proto:default
+	  else
+	      /usr/sbin/inetadm -d svc:/network/$svcname/$proto:default
+	  fi
+
+	  /usr/sbin/installf -c cswinetd $PKGINST $manifest f 644 root bin
+	  /usr/bin/chmod 644 $manifest
+	  /usr/bin/chown root:bin $manifest
+
+	  rm /tmp/$svcname.$$
+      else
+	  [ -n "$DEBUG" ] && echo "For solaris 8 or 9"
+
+	  inetdconf=$PKG_INSTALL_ROOT/etc/inet/inetd.conf
+
+	  echo "Installing '$svcname' into inetd.conf."
+	  echo "# $PKGINST: added by i.cswinetd" >> $inetdconf
+	  if [ "$daemon" = "yes" ]; then
+
+	      echo "$inetdsvc" >> $inetdconf
+	      /usr/bin/pkill -HUP inetd
+	  else
+	      echo "#$inetdsvc" >> $inetdconf
+	  fi
+      fi
+
+      if [ "$daemon" = "yes" ]; then
+	  echo "Inetd service '$svcname' should be enabled by default."
+      else
+	  echo "Inetd service '$svcname' should be disabled by default."
+      fi
+  else
+      echo "Service '$svcname' not found in /etc/inet/services.  Won't setup inetd for it."
+      exit 2
+  fi
+done
+
+exit 0

Deleted: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype	2009-10-06 20:52:14 UTC (rev 6736)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.prototype	2009-10-07 02:58:35 UTC (rev 6737)
@@ -1,24 +0,0 @@
-i pkginfo=CSWcswclassutils.pkginfo
-i copyright=CSWcswclassutils.copyright
-d none /etc/opt/csw 0755 root bin
-d none /etc/opt/csw/init.d 0755 root bin
-f none /etc/opt/csw/init.d/csw.smf.sample 0755 root bin
-d none /var/opt/csw 0755 root bin
-d none /var/opt/csw/svc 0755 root bin
-d none /var/opt/csw/svc/manifest 0755 root bin
-d none /var/opt/csw/svc/method 0755 root bin
-f none /usr/sadm/install/scripts/i.cswusergroup 0555 root sys
-f none /usr/sadm/install/scripts/r.cswusergroup 0555 root sys
-f none /usr/sadm/install/scripts/i.cswinitsmf 0555 root sys
-f none /usr/sadm/install/scripts/r.cswinitsmf 0555 root sys
-f none /usr/sadm/install/scripts/i.cswcpsampleconf 0555 root sys
-f none /usr/sadm/install/scripts/r.cswcpsampleconf 0555 root sys
-f none /usr/sadm/install/scripts/i.cswpreserveconf 0555 root sys
-f none /usr/sadm/install/scripts/r.cswpreserveconf 0555 root sys
-f none /usr/sadm/install/scripts/i.cswpycompile 0555 root sys
-f none /usr/sadm/install/scripts/r.cswpycompile 0555 root sys
-d none /opt/csw/share 0755 root bin
-d none /opt/csw/share/doc 0755 root bin
-d none /opt/csw/share/doc/cswclassutils 0755 root bin
-f none /opt/csw/share/doc/cswclassutils/README.CSW 0444 root bin
-f none /opt/csw/share/doc/cswclassutils/license 0444 root bin

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinetd
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinetd	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswinetd	2009-10-07 02:58:35 UTC (rev 6737)
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# r.cswinetd - Class action script for CSW inetd support
+#
+# Written and maintained by Ben Walton
+#
+# 2009-10-02 Initial release
+
+case "`uname -r`" in
+    5.8|5.9) useinetconv=no;;
+    *) useinetconv=yes;
+esac
+
+while read dest; do
+    case "$dest" in
+	*xml)
+	    # we know that this won't happen for sol8/9
+	    fmri=`/usr/sbin/svccfg inventory $dest | grep -v default`
+	    echo "Disabling and removing $fmri"
+	    inetadm -d $fmri
+	    svccfg delete $fmri
+	    ;;
+	*)
+	    if [ "$useinetconv" = "no" ]; then
+		# sol 8 or 9
+
+		inetdconf=/etc/inet/inetd.conf
+		inetdsvc=`cat $dest`
+		set -- $inetdsvc
+		svcname=$1
+		echo "Removing $svcname service from inetd.conf"
+		/usr/xpg4/bin/sed -e '/# CSWgitosis/{
+$!N
+/^# CSWgitosis.*\n#git.*$/d
+}' $inetdconf > $inetdconf.$$ && \
+		mv $inetdconf.$$ $inetdconf && \
+
+		chown root:sys $inetdconf && \
+		chmod 444 $inetdconf 
+
+		# even if the service was disabled, this shouldn't hurt
+		/usr/bin/pkill -HUP inetd
+	    fi
+	    ;;
+    esac
+
+    echo $dest
+    rm -f $dest
+done


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