From owner-freebsd-mips@freebsd.org Mon Nov 2 09:32:16 2015 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D87DA24CAE for ; Mon, 2 Nov 2015 09:32:16 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B7A4B1A71 for ; Mon, 2 Nov 2015 09:32:15 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221]) by hz.grosbein.net (8.14.9/8.14.9) with ESMTP id tA29W92D058687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 2 Nov 2015 10:32:10 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id tA29W13f003636 for ; Mon, 2 Nov 2015 16:32:01 +0700 (KRAT) (envelope-from eugen@grosbein.net) To: "freebsd-mips@freebsd.org" From: Eugene Grosbein Subject: /etc/rc.initdiskless support for small systems X-Enigmail-Draft-Status: N1110 Message-ID: <56372D91.8040902@grosbein.net> Date: Mon, 2 Nov 2015 16:32:01 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,LOCAL_FROM, T_DATE_IN_FUTURE_96_Q autolearn=no version=3.3.2 X-Spam-Report: * 0.0 T_DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: * date * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on hz.grosbein.net X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2015 09:32:16 -0000 Hi! Sometimes it is suitable to use stock /etc/rc.initdiskless to manage boot-time configuration of embedded systems. Sadly, rc.initdislkess assumes there is distinct file system keeping persitent local configuration (startup config). Small systems like MIPS routers may have no enough flash space for full-blown fs. I've patched rc.initdiskless to run auxiliary command at boot time to extract startup configuration from such small local storage, f.e. from /dev/map/cfg I've just submited the patch with PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204215 This way, one can use /conf/default/etc/extract command doing something like: cd "$1" && bsdcpio --quiet -idu < /dev/map/cfg /etc/rc.initdiskless runs such command passing /etc as $1 at boot time then.