From owner-svn-src-head@FreeBSD.ORG Tue Jun 15 18:18:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B639E106566B; Tue, 15 Jun 2010 18:18:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5A538FC15; Tue, 15 Jun 2010 18:18:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5FIIVPh056575; Tue, 15 Jun 2010 18:18:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5FIIVTU056573; Tue, 15 Jun 2010 18:18:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201006151818.o5FIIVTU056573@svn.freebsd.org> From: Warner Losh Date: Tue, 15 Jun 2010 18:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209210 - head/tools/tools/nanobsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 18:18:31 -0000 Author: imp Date: Tue Jun 15 18:18:31 2010 New Revision: 209210 URL: http://svn.freebsd.org/changeset/base/209210 Log: Allow population of /cfg and /data. Begin the move to making all slice creation overrideable too, but there's a few problems doing that for the duplicated partitions (s1 and s2), so just comment that it needs work. MFC after: 3 days Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Tue Jun 15 18:16:45 2010 (r209209) +++ head/tools/tools/nanobsd/nanobsd.sh Tue Jun 15 18:18:31 2010 (r209210) @@ -357,6 +357,30 @@ prune_usr() ( done ) +populate_slice ( ) ( + local dev dir mnt + dev=$1 + dir=$2 + mnt=$3 + test -z $2 && dir=/var/empty + test -d $d || dir=/var/empty + echo "Creating ${dev} with ${dir} (mounting on ${mnt})" + newfs ${NANO_NEWFS} ${dev} + mount ${dev} ${mnt} + cd ${dir} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} + df -i ${mnt} + umount ${mnt} +) + +populate_cfg_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + +populate_data_slice ( ) ( + populate_slice "$1" "$2" "$3" +) + create_i386_diskimage ( ) ( pprint 2 "build diskimage" pprint 3 "log: ${NANO_OBJ}/_.di" @@ -456,6 +480,7 @@ create_i386_diskimage ( ) ( bsdlabel ${MD}s1 # Create first image + # XXX: should use populate_slice for easier override newfs ${NANO_NEWFS} /dev/${MD}s1a mount /dev/${MD}s1a ${MNT} df -i ${MNT} @@ -480,13 +505,11 @@ create_i386_diskimage ( ) ( fi # Create Config slice - newfs ${NANO_NEWFS} /dev/${MD}s3 - # XXX: fill from where ? + populate_cfg_slice /dev/${MD}s3 "${NANO_CFGDIR}" ${MNT} # Create Data slice, if any. if [ $NANO_DATASIZE -ne 0 ] ; then - newfs ${NANO_NEWFS} /dev/${MD}s4 - # XXX: fill from where ? + populate_data_slice /dev/${MD}s4 "${NANO_DATADIR}" ${MNT} fi if [ "${NANO_MD_BACKING}" = "swap" ] ; then