From owner-freebsd-bugs@FreeBSD.ORG Sat Apr 19 21:50:02 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4598FBB for ; Sat, 19 Apr 2014 21:50:02 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 911BB15F7 for ; Sat, 19 Apr 2014 21:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s3JLo2CQ093292 for ; Sat, 19 Apr 2014 21:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s3JLo2OZ093291; Sat, 19 Apr 2014 21:50:02 GMT (envelope-from gnats) Resent-Date: Sat, 19 Apr 2014 21:50:02 GMT Resent-Message-Id: <201404192150.s3JLo2OZ093291@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, devinteske 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 010B5FAD; Sat, 19 Apr 2014 21:49:08 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D5DCA15ED; Sat, 19 Apr 2014 21:49:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s3JLn74F093148; Sat, 19 Apr 2014 21:49:07 GMT (envelope-from alfred@freefall.freebsd.org) Received: (from alfred@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s3JLn7FY093147; Sat, 19 Apr 2014 21:49:07 GMT (envelope-from alfred) Message-Id: <201404192149.s3JLn7FY093147@freefall.freebsd.org> Date: Sat, 19 Apr 2014 21:49:07 GMT From: devinteske To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: misc/188806: TESTING Updates based on work performed today. Cc: alfred@freebsd.org X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: devinteske List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Apr 2014 21:50:02 -0000 >Number: 188806 >Category: misc >Synopsis: TESTING Updates based on work performed today. >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: Sat Apr 19 21:50:02 UTC 2014 >Closed-Date: >Last-Modified: >Originator: devinteske >Release: master >Organization: github >Environment: System: FreeBSD freefall.freebsd.org 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r264289: Wed Apr 9 02:48:19 UTC 2014 peter@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL amd64 X-pull-request: 1 >Description: This is what I came up with based on testing and refinement from a little bit of research I performed. Hope you like it. >How-To-Repeat: >Fix: diff --git a/sys/boot/forth/beastie.4th b/sys/boot/forth/beastie.4th index 4a107af..7a2cbb09 100644 --- a/sys/boot/forth/beastie.4th +++ b/sys/boot/forth/beastie.4th @@ -202,56 +202,26 @@ variable logoY drop then - s" loader_logo" getenv dup -1 = if - logoX @ logoY @ - loader_color? if - orb-logo - else - orbbw-logo - then - drop exit - then - - 2dup s" beastie" compare-insensitive 0= if - logoX @ logoY @ beastie-logo - 2drop exit - then - 2dup s" beastiebw" compare-insensitive 0= if - logoX @ logoY @ beastiebw-logo - 2drop exit - then - 2dup s" fbsdbw" compare-insensitive 0= if - logoX @ logoY @ fbsdbw-logo - 2drop exit - then - 2dup s" orb" compare-insensitive 0= if - logoX @ logoY @ orb-logo - 2drop exit - then - 2dup s" orbbw" compare-insensitive 0= if - logoX @ logoY @ orbbw-logo - 2drop exit - then - 2dup s" tribute" compare-insensitive 0= if - logoX @ logoY @ - s" tribute-logo" sfind if - execute - else - drop orb-logo - then - 2drop exit + s" loader_logo" getenv dup -1 <> if + dup 5 + allocate if ENOMEM throw then + 0 2swap strcat s" -logo" strcat + over -rot ( a-addr/u -- a-addr a-addr/u ) + sfind ( a-addr a-addr/u -- a-addr xt bool ) + rot ( a-addr xt bool -- xt bool a-addr ) + free ( xt bool a-addr -- xt bool ior ) + if EFREE throw then + else + 0 ( cruft -- cruft bool ) \ load the default below then - 2dup s" tributebw" compare-insensitive 0= if - logoX @ logoY @ - s" tributebw-logo" sfind if - execute + 0= if + drop ( cruft -- ) + loader_color? if + ['] orb-logo else - drop orbbw-logo + ['] orbbw-logo then - 2drop exit then - - 2drop + logoX @ logoY @ rot execute ; : clear-beastie ( -- ) \ clears beastie from the screen diff --git a/sys/boot/forth/loader.4th b/sys/boot/forth/loader.4th index 22d9125..55778ff 100644 --- a/sys/boot/forth/loader.4th +++ b/sys/boot/forth/loader.4th @@ -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 diff --git a/sys/boot/forth/loader.4th.8 b/sys/boot/forth/loader.4th.8 index 02f9641..b689077 100644 --- a/sys/boot/forth/loader.4th.8 +++ b/sys/boot/forth/loader.4th.8 @@ -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 module loading fails. 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 diff --git a/sys/boot/forth/loader.rc b/sys/boot/forth/loader.rc index a84753d..b4a6d51 100644 --- a/sys/boot/forth/loader.rc +++ b/sys/boot/forth/loader.rc @@ -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 diff --git a/sys/boot/forth/menu.rc b/sys/boot/forth/menu.rc index 3d8bff9..e49f567 100644 --- a/sys/boot/forth/menu.rc +++ b/sys/boot/forth/menu.rc @@ -120,6 +120,10 @@ set optionstoggled_ansi[6]="Verbose..... On" \ 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 diff --git a/sys/boot/i386/loader/loader.rc b/sys/boot/i386/loader/loader.rc index cb2f723..287c05e 100644 --- a/sys/boot/i386/loader/loader.rc +++ b/sys/boot/i386/loader/loader.rc @@ -3,6 +3,7 @@ \ \ Includes additional commands include /boot/loader.4th +try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize >Release-Note: >Audit-Trail: >Unformatted: