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

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Wed Nov 4 21:23:48 CET 2009


Revision: 7109
          http://gar.svn.sourceforge.net/gar/?rev=7109&view=rev
Author:   dmichelsen
Date:     2009-11-04 20:23:48 +0000 (Wed, 04 Nov 2009)

Log Message:
-----------
cswclassutils: Add classes for texinfo and crontab

Modified Paths:
--------------
    csw/mgar/pkg/cswclassutils/trunk/checksums
    csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW

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

Modified: csw/mgar/pkg/cswclassutils/trunk/checksums
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/checksums	2009-11-04 15:45:55 UTC (rev 7108)
+++ csw/mgar/pkg/cswclassutils/trunk/checksums	2009-11-04 20:23:48 UTC (rev 7109)
@@ -1,17 +1,21 @@
 48a97af56d55bc90ce90303228ed8cc3  COPYING
 fe030911decab669145b3017ed4fdf10  CSWcswclassutils.i.cswcpsampleconf
+9a6f5ad4919b78e4083491edcd86db0c  CSWcswclassutils.i.cswcrontab
 56900bb1fc9f40f7c227877eca32b1f8  CSWcswclassutils.i.cswetcservices
-0dec9b16f322a26b4fa5cc6c89dfd418  CSWcswclassutils.i.cswinetd
+b363134a7c70a342195badc942a23b9d  CSWcswclassutils.i.cswinetd
 fa318ca696e80a9a9f2efbf35cb69080  CSWcswclassutils.i.cswinitsmf
 42668b41c7c886091a8ca44992b90806  CSWcswclassutils.i.cswmigrateconf
 c875d62c8ddaad0de2e18fff7946e1e8  CSWcswclassutils.i.cswpreserveconf
 927297d22360707afd804c4ce58ed0a9  CSWcswclassutils.i.cswpycompile
+1282bef941c49d98a061b3701a1fda7c  CSWcswclassutils.i.cswtexinfo
 7f04b24b421f3afbf3c61845941ef5dd  CSWcswclassutils.i.cswusergroup
 d278a28a6f901c4ff5f07c583b4cff3d  CSWcswclassutils.r.cswcpsampleconf
+a204ca80139dd1d79e1a3af3e8bad7cb  CSWcswclassutils.r.cswcrontab
 d60261ddc46e2cc83ecbbfc586a7e686  CSWcswclassutils.r.cswetcservices
 9039ea60ad4c3f8994205fb242a49a72  CSWcswclassutils.r.cswinetd
 791db9c2f6685aca67043820d260fc60  CSWcswclassutils.r.cswinitsmf
 f7a2a10bbf0f88c1909a31141e6d83ce  CSWcswclassutils.r.cswmigrateconf
 96453922952c92c6c5a024e54ed8525f  CSWcswclassutils.r.cswpreserveconf
 02326250b63d3c75c45a8ff81768e923  CSWcswclassutils.r.cswpycompile
+ed76f47b045b000ab78154a90cf90ed4  CSWcswclassutils.r.cswtexinfo
 752c74048ee18ae3a3c2c7b1d15e40f2  CSWcswclassutils.r.cswusergroup

Modified: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW	2009-11-04 15:45:55 UTC (rev 7108)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.README.CSW	2009-11-04 20:23:48 UTC (rev 7109)
@@ -53,6 +53,19 @@
   /etc/services file.  It is a one way manipulation.  At package
   removal, the service entries are left behind.
 
+- cswtexinfo
+
+  This class takes care of keeping the info/dir page of CSWtexinfo
+  in sync with all texinfo pages installed. It adds entries on
+  package installation and removes them on package removal.
+
+- cswcrontab
+
+  This class allows adding entries to the crontab for arbitrary users.
+  The entries will be tagged with the package name and removed on
+  package removal. If the entries have been changed manually they will
+  not be preserved.
+
 Read more on the wiki: http://wiki.opencsw.org/cswclassutils-package.
 
 -- 

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswcrontab
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswcrontab	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswcrontab	2009-11-04 20:23:48 UTC (rev 7109)
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# i.cswcrontab - Class action script
+#                for registration of crontab entries
+#
+# Written and maintained by Dagobert Michelsen
+#
+
+# set DEBUG to any value to enable trace output
+DEBUG=
+
+echo "Installing class <cswcrontab> ..."
+
+while read src dest; do
+
+  echo $dest
+  /usr/bin/cp $src $dest || exit 2
+
+  USERNAME=`/usr/bin/basename $dest`
+  echo "The following lines will be added to the crontab of the user '${USERNAME}':"
+  cat $dest
+
+  TMPFILE=/tmp/cswcrontab.${PKGINST}.$$
+
+  umask 600
+  /usr/bin/crontab -l ${USERNAME} | /usr/bin/grep -v "# Added by ${PKGINST}\$" > ${TMPFILE}
+
+  if [ -n "$DEBUG" ]; then
+    echo "DEBUG: Contents of ${TMPFILE} after removing old lines from this package:" >&2
+    cat ${TMPFILE} >&2
+  fi
+
+  cat $dest | while read LINE; do
+    echo "${LINE} % Added by ${PKGINST}" >> ${TMPFILE}
+    if [ -n "$DEBUG" ]; then
+      echo "DEBUG: Adding '${LINE} % Added by ${PKGINST}' to the end of the crontab" >&2
+    fi
+  done
+
+  if [ -n "$DEBUG" ]; then
+    echo "DEBUG: Installing crontab for user '${USERNAME}'" >&2
+    cat ${TMPFILE} >&2
+  fi
+
+  su ${USERNAME} /usr/bin/crontab ${TMPFILE}
+  rm -f ${TMPFILE}
+  
+done
+
+exit 0

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswtexinfo
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswtexinfo	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.i.cswtexinfo	2009-11-04 20:23:48 UTC (rev 7109)
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# i.cswtexinfo - Class action script
+# 		 for registration of info pages to CSWtexinfo
+#
+# Written and maintained by Dagobert Michelsen
+#
+# 2009-11-04 Initial release
+
+echo "Installing class <cswtexinfo> ..."
+
+while read src dest; do
+
+  echo $dest
+  /usr/bin/cp $src $dest || exit 2
+
+  if [ -x ${PKG_INSTALL_ROOT}/opt/csw/bin/install-info ]; then
+    ${PKG_INSTALL_ROOT}/opt/csw/bin/install-info $dest ${PKG_INSTALL_ROOT}/opt/csw/info/dir
+  else
+    echo "CSWtexinfo couldn't be found."
+  fi
+done
+
+exit 0

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswcrontab
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswcrontab	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswcrontab	2009-11-04 20:23:48 UTC (rev 7109)
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# r.cswcrontab - Class action script
+#                for registration of crontab entries
+#
+# Written and maintained by Dagobert Michelsen
+#
+
+echo "Removing class <cswcrontab> ..."
+
+while read dest; do
+  echo $dest
+  rm -f $dest
+
+  USERNAME=`/usr/bin/basename $dest`
+  TMPFILE=/tmp/cswcrontab.${PKGINST}.$$
+
+  umask 600
+
+  echo "The following lines will be removed from the crontab of the user '${USERNAME}':"
+  /usr/bin/crontab -l ${USERNAME} | /usr/bin/grep "# Added by ${PKGINST}\$"
+
+  /usr/bin/crontab -l ${USERNAME} | /usr/bin/grep -v "# Added by ${PKGINST}\$" > ${TMPFILE}
+
+  if [ -n "$DEBUG" ]; then
+    echo "DEBUG: Installing crontab for user '${USERNAME}'" >&2
+    cat ${TMPFILE} >&2
+  fi
+
+  su ${USERNAME} /usr/bin/crontab ${TMPFILE}
+  rm -f ${TMPFILE}
+ 
+done

Added: csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswtexinfo
===================================================================
--- csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswtexinfo	                        (rev 0)
+++ csw/mgar/pkg/cswclassutils/trunk/files/CSWcswclassutils.r.cswtexinfo	2009-11-04 20:23:48 UTC (rev 7109)
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# r.cswetcservices - Class action script
+#                for registration of info pages to CSWtexinfo
+#
+# Written and maintained by Dagobert Michelsen
+#
+# 2009-11-04 Initial release
+
+echo "Removing class <cswtexinfo> ..."
+
+while read dest; do
+
+  echo $dest
+
+  if [ -x ${PKG_INSTALL_ROOT}/opt/csw/bin/install-info ]; then
+    ${PKG_INSTALL_ROOT}/opt/csw/bin/install-info --delete $dest ${PKG_INSTALL_ROOT}/opt/csw/info/dir
+  else
+    echo "CSWtexinfo couldn't be found."
+  fi
+
+  rm -f $dest
+
+done
+
+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