Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2013 19:24:13 +0000 (UTC)
From:      Nikolai Lifanov <lifanov@mail.lifanov.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   conf/181625: [patch] add rc.d/ script for freebsd-update
Message-ID:  <20130828192413.246F31A48CA@mail.lifanov.com>
Resent-Message-ID: <201308281930.r7SJU090095465@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         181625
>Category:       conf
>Synopsis:       [patch] add rc.d/ script for freebsd-update
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 28 19:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Nikolai Lifanov
>Release:        FreeBSD 9.1-RELEASE-p5 amd64
>Organization:
>Environment:
System: FreeBSD mail.lifanov.com 9.1-RELEASE-p5 FreeBSD 9.1-RELEASE-p5 #0: Sat Jul 27 01:14:23 UTC 2013 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

>Description:
Add /etc/rc.d/freebsd_update script:

If 'freebsd_update_enable="YES"' is set, the script installs already-fetched updates on boot, but before securelevel is raised. This makes updating trivial:
  # freebsd-update fetch (or freebsd-update upgrade ...)
  # reboot               (and if it's an upgrade, another reboot)
This is trivial, but it makes raising securelevel in rc.conf much more attractive. Updates can be fetched by cron and a simple reboot installs them without the administrator having to drop into single-user mode or lower securelevel temporarily.

freebsd_update_enable defaults to "NO"

>How-To-Repeat:
Apply the attached patch and set 'freebsd_update_enable="YES"' in rc.conf.
If there are updates available to install during boot, they will be installed.

>Fix:

--- freebsd_update.diff begins here ---
Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf	(revision 254996)
+++ etc/defaults/rc.conf	(working copy)
@@ -84,6 +84,7 @@
 #geli_mirror_home_flags="-k /etc/geli/home.keys"
 
 root_rw_mount="YES"	# Set to NO to inhibit remounting root read-write.
+freebsd_update_enable="NO" # Set to YES to run 'freebsd-update install' on boot
 fsck_y_enable="NO"	# Set to YES to do fsck -y if the initial preen fails.
 fsck_y_flags=""		# Additional flags for fsck -y
 background_fsck="YES"	# Attempt to run fsck in the background where possible.
Index: etc/rc.d/Makefile
===================================================================
--- etc/rc.d/Makefile	(revision 254999)
+++ etc/rc.d/Makefile	(working copy)
@@ -38,6 +38,7 @@
 	dmesg \
 	dumpon \
 	faith \
+	freebsd_update \
 	fsck \
 	ftp-proxy \
 	ftpd \
Index: etc/rc.d/freebsd_update
===================================================================
--- etc/rc.d/freebsd_update	(revision 0)
+++ etc/rc.d/freebsd_update	(working copy)
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: freebsd_update
+# REQUIRE: FILESYSTEMS
+# BEFORE:  securelevel
+
+. /etc/rc.subr
+
+name="freebsd_update"
+rcvar="freebsd_update_enable"
+start_cmd="freebsd_update_install"
+stop_cmd=":"
+
+freebsd_update_install()
+{
+	/usr/sbin/freebsd-update install || :
+}
+
+run_rc_command "$1"

Property changes on: etc/rc.d/freebsd_update
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- freebsd_update.diff ends here ---


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130828192413.246F31A48CA>