misc/131438: Add csup to Periodic

Steven Kreuzer skreuzer at exit2shell.com
Thu Feb 5 15:10:02 PST 2009


>Number:         131438
>Category:       misc
>Synopsis:       Add csup to Periodic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 05 23:10:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Steven Kreuzer
>Release:        7.1-PRERELEASE
>Organization:
>Environment:
FreeBSD slurry.exit2shell.com 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #3: Mon Nov 24 14:01:09 EST 2008     root at simon.sddi.net:/usr/obj/usr/src/sys/KERNEL  amd64
>Description:
Rather then run csup each night to update src or ports via an entry in roots crontab I figured it would be cleaner to write a script and add it to periodic so that you can specify a csup file and have its output sent to you via email with the rest of the daily periodic scripts

The attached patch adds support for that but sets it to off by default.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: etc/defaults/periodic.conf
===================================================================
RCS file: /usr/share/cvs/freebsd/src/etc/defaults/periodic.conf,v
retrieving revision 1.47
diff -u -r1.47 periodic.conf
--- etc/defaults/periodic.conf	8 Jan 2008 07:22:43 -0000	1.47
+++ etc/defaults/periodic.conf	5 Feb 2009 22:54:41 -0000
@@ -140,6 +140,9 @@
 daily_queuerun_enable="YES"				# Run mail queue
 daily_submit_queuerun="YES"				# Also submit queue
 
+# 600.csup
+daily_csup_enable="NO"
+
 # 999.local
 daily_local="/etc/daily.local"				# Local scripts
 
Index: etc/periodic/daily/600.csup
===================================================================
RCS file: etc/periodic/daily/600.csup
diff -N etc/periodic/daily/600.csup
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ etc/periodic/daily/600.csup	5 Feb 2009 22:56:35 -0000
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# If there is a global system configuration file, suck it in.
+#
+
+if [ -r /etc/defaults/periodic.conf ]
+then
+    . /etc/defaults/periodic.conf
+    source_periodic_confs
+fi
+
+case "$daily_csup_enable" in
+    [Yy][Ee][Ss])
+	if [ -z "$daily_csup_supfile" ]
+	then
+		echo '$daily_csup_enable is set but' \
+			'$daily_csup_supfile is not'
+		rc=2
+	else
+		if [ -z "$daily_csup_binary" ]
+		then
+			daily_csup_binary=/usr/bin/csup
+		fi
+
+		if [ ! -x "$daily_csup_binary" ]
+		then
+			echo '$daily_csup_binary is set but ' \
+			$daily_csup_binary 'is not executable'
+			rc=2
+		else
+			out=`$daily_csup_binary $daily_csup_supfile`
+			rc=$?
+			echo "$out"
+		fi
+
+	fi;;
+
+    *)  rc=0;;
+esac
+
+exit $rc
Index: etc/periodic/daily/Makefile
===================================================================
RCS file: /usr/share/cvs/freebsd/src/etc/periodic/daily/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- etc/periodic/daily/Makefile	21 Sep 2008 22:02:26 -0000	1.17
+++ etc/periodic/daily/Makefile	5 Feb 2009 22:55:44 -0000
@@ -16,6 +16,7 @@
 	409.status-gconcat \
 	420.status-network \
 	450.status-security \
+	600.csup			\
 	999.local
 
 # NB: keep these sorted by MK_* knobs


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list