From owner-svn-src-all@FreeBSD.ORG Mon Mar 3 07:31:56 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6F38CF76; Mon, 3 Mar 2014 07:31:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5B251391; Mon, 3 Mar 2014 07:31:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s237VuKt081185; Mon, 3 Mar 2014 07:31:56 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s237Vt9p081179; Mon, 3 Mar 2014 07:31:55 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201403030731.s237Vt9p081179@svn.freebsd.org> From: Devin Teske Date: Mon, 3 Mar 2014 07:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r262704 - in stable/10/sys/boot: forth i386/loader X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Mar 2014 07:31:56 -0000 Author: dteske Date: Mon Mar 3 07:31:55 2014 New Revision: 262704 URL: http://svnweb.freebsd.org/changeset/base/262704 Log: MFC r258270: Add a try-include word (which acts the same as "include") and use it to conditionally include (but ignore failures) /boot/loader.rc.local and /boot/menu.rc.local -- to make customizing the menu easier. Reviewed by: alfred Discussed on: -hackers Modified: stable/10/sys/boot/forth/loader.4th stable/10/sys/boot/forth/loader.4th.8 stable/10/sys/boot/forth/loader.rc stable/10/sys/boot/forth/menu.rc stable/10/sys/boot/i386/loader/loader.rc Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/forth/loader.4th ============================================================================== --- stable/10/sys/boot/forth/loader.4th Mon Mar 3 07:28:56 2014 (r262703) +++ stable/10/sys/boot/forth/loader.4th Mon Mar 3 07:31:55 2014 (r262704) @@ -233,7 +233,16 @@ include /boot/check-password.4th s" disable-module" s" disable loading of a module" .? s" toggle-module" s" toggle loading of a module" .? s" show-module" s" show module load data" .? + s" try-include" s" try to load/interpret files" .? ; +: try-include ( -- ) \ see loader.4th(8) + ['] include ( -- xt ) \ get the execution token of `include' + catch ( xt -- exception# | 0 ) if \ failed + LF parse ( c -- s-addr/u ) 2drop \ advance >in to EOL (drop data) + \ ... prevents words unused by `include' from being interpreted + then +; immediate \ interpret immediately for access to `source' (aka tib) + only forth also Modified: stable/10/sys/boot/forth/loader.4th.8 ============================================================================== --- stable/10/sys/boot/forth/loader.4th.8 Mon Mar 3 07:28:56 2014 (r262703) +++ stable/10/sys/boot/forth/loader.4th.8 Mon Mar 3 07:31:55 2014 (r262704) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2013 +.Dd November 13, 2013 .Dt LOADER.4TH 8 .Os .Sh NAME @@ -158,6 +158,13 @@ files to specify the action after a modu Used inside .Xr loader.conf 5 files to specify the action after a module loading fails. +.It Ic try-include Ar file Op Ar +Process script files if they exist. +Each file, in turn, is completely read into memory, +and then each of its lines is passed to the command line interpreter. +If any error is returned by the interpreter, the try-include +command aborts immediately, without reading any other files, and +silently returns without error. .El .Sh FILES .Bl -tag -width /boot/loader.4th -compact Modified: stable/10/sys/boot/forth/loader.rc ============================================================================== --- stable/10/sys/boot/forth/loader.rc Mon Mar 3 07:28:56 2014 (r262703) +++ stable/10/sys/boot/forth/loader.rc Mon Mar 3 07:31:55 2014 (r262704) @@ -3,6 +3,7 @@ \ \ Includes additional commands include /boot/loader.4th +try-include /boot/loader.rc.local \ Reads and processes loader.conf variables \ NOTE: Change to `initialize' if you enable the below boot menu Modified: stable/10/sys/boot/forth/menu.rc ============================================================================== --- stable/10/sys/boot/forth/menu.rc Mon Mar 3 07:28:56 2014 (r262703) +++ stable/10/sys/boot/forth/menu.rc Mon Mar 3 07:31:55 2014 (r262704) @@ -120,6 +120,10 @@ set optionstoggled_ansi[6]="Ver \ set menu_timeout_command="boot" +\ Include optional elements defined in a local file +\ +try-include /boot/menu.rc.local + \ Display the main menu (see `menu.4th') set menuset_initial=1 menuset-loadinitial Modified: stable/10/sys/boot/i386/loader/loader.rc ============================================================================== --- stable/10/sys/boot/i386/loader/loader.rc Mon Mar 3 07:28:56 2014 (r262703) +++ stable/10/sys/boot/i386/loader/loader.rc Mon Mar 3 07:31:55 2014 (r262704) @@ -3,6 +3,7 @@ \ \ Includes additional commands include /boot/loader.4th +try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize