Return-path: <voyage-linux-bounces+punkytse=punknix.com@list.voyage.hk>
Envelope-to: punkytse@punknix.com
Delivery-date: Sun, 23 Sep 2012 01:24:38 +0800
Received: from localhost ([127.0.0.1] helo=punknix.punknix.com)
	by punknix.punknix.com with esmtp (Exim 4.72)
	(envelope-from <voyage-linux-bounces+punkytse=punknix.com@list.voyage.hk>)
	id 1TFTRW-0004EG-2J
	for punkytse@punknix.com; Sun, 23 Sep 2012 01:24:38 +0800
Received: from [212.70.193.242] (helo=orion.ozo.com)
	by punknix.punknix.com with esmtp (Exim 4.72)
	(envelope-from <jim.cromie@gmail.com>) id 1TFTMp-0003PB-V1
	for voyage-linux@voyage.hk; Sun, 23 Sep 2012 01:19:48 +0800
Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com
	[209.85.223.171])
	by orion.ozo.com (8.14.5/8.14.5) with ESMTP id q8MHJYEX010305
	for <voyage-linux@list.voyage.hk>; Sat, 22 Sep 2012 20:19:43 +0300
Received: by iecs9 with SMTP id s9so4846442iec.30
	for <voyage-linux@list.voyage.hk>; Sat, 22 Sep 2012 10:19:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
	bh=SFLh4QXgtv9uupy2WJT1ahsh28/B4/QRRUVzqkZLN7U=;
	b=y4PZfLxM0oinL6gMNZYtxM/Eb74F5RWGInvbF+6C0PaPV/YVGtK98RT54Hrn47sE8I
	GiaUE5evAHrxSbCEr8MGPB3Af1TjqmsItZZq6yMLwWq5HgDpF3kb8mVORvavvydwX08H
	lRBvJHhzs1bz8OtA/+lBfzllcqFkWLCmcI5qtm9CYNG6UhFkYSwyGEbKxiBI+VQJt88P
	c/Q1AsZ88dw2xbfZwNXWDLHv19mvkk1KswiSfsrGUliOYuiQhRa273/SD8TfcbzMQSsd
	4Lo/aGNYe/qItMwiWmRWLIHr5WbmYM2LZChyGAqDNyq16SPQdtABWfWw6Xcj9eLIkG1e
	yq/Q==
Received: by 10.50.179.8 with SMTP id dc8mr1057979igc.20.1348334374331;
	Sat, 22 Sep 2012 10:19:34 -0700 (PDT)
Received: from groucho.jimc.earth.net (c-75-70-77-50.hsd1.co.comcast.net.
	[75.70.77.50])
	by mx.google.com with ESMTPS id a1sm1799795igc.7.2012.09.22.10.19.32
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sat, 22 Sep 2012 10:19:33 -0700 (PDT)
From: Jim Cromie <jim.cromie@gmail.com>
To: voyage-linux@voyage.hk, voyage-linux@voyage.hk
Date: Sat, 22 Sep 2012 11:19:15 -0600
Message-Id: <1348334358-23093-2-git-send-email-jim.cromie@gmail.com>
X-Mailer: git-send-email 1.7.11.4
In-Reply-To: <1348334358-23093-1-git-send-email-jim.cromie@gmail.com>
References: <1348334358-23093-1-git-send-email-jim.cromie@gmail.com>
X-Scanned-By: MIMEDefang 2.73
Subject: [Voyage-linux] [PATCH 1/4] voyage-installer: prep to change ROOT_FS
	label to VOYAGE_FS
X-BeenThere: voyage-linux@list.voyage.hk
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Discussion about voyage linux <voyage-linux.list.voyage.hk>
List-Unsubscribe: <http://list.voyage.hk/mailman/options/voyage-linux>,
	<mailto:voyage-linux-request@list.voyage.hk?subject=unsubscribe>
List-Archive: <http://list.voyage.hk/pipermail/voyage-linux/>
List-Post: <mailto:voyage-linux@list.voyage.hk>
List-Help: <mailto:voyage-linux-request@list.voyage.hk?subject=help>
List-Subscribe: <http://list.voyage.hk/mailman/listinfo/voyage-linux>,
	<mailto:voyage-linux-request@list.voyage.hk?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: voyage-linux-bounces+punkytse=punknix.com@list.voyage.hk
Sender: "Voyage-linux"
	<voyage-linux-bounces+punkytse=punknix.com@list.voyage.hk>

Change hardcoded ROOT_FS to $ROOT_LBL where its used.  This preps to
change the root-label to VOYAGE_FS, which provides some certainty that
the correct right device and partition are identified.  This certainty
allows safer automation of partition formatting, unmounting before
formatting etc, possibly with less "Are you SURE ?" questions.

This patch requires that $ROOT_LBL is set, but doesnt set it (yet),
testing it gives some assurance that errors are detected and problems
are avoided:

Ready to go ....
Fatal Error: ROOT_LBL not set, in /home/jimc/projects/voyage/voyage-current/usr/local/sbin/format-cf.sh, quitting
Fatal Error: ROOT_LBL not set, in /home/jimc/projects/voyage/voyage-current/usr/local/sbin/copyfiles.sh, quitting

The 3rd patchsite (setboot.sh) is not testable ATM, since the above 2
terminate the installer before its reached.  The next patch adds
ROOT_LBL=VOYAGE_FS in a single place.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 usr/local/sbin/copyfiles.sh |  8 ++++++--
 usr/local/sbin/format-cf.sh |  6 +++++-
 usr/local/sbin/setboot.sh   | 10 +++++++---
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/usr/local/sbin/copyfiles.sh b/usr/local/sbin/copyfiles.sh
index 1eab990..b8e73b7 100755
--- a/usr/local/sbin/copyfiles.sh
+++ b/usr/local/sbin/copyfiles.sh
@@ -32,6 +32,10 @@ fi
 
 source $EXECDIR/update-config.sh
 
+if [ -z $ROOT_LBL ] ; then
+    err_quit "ROOT_LBL not set, in $0, quitting"
+fi
+
 # We assume that none of the target files are currently mounted.  Just to
 # make sure, we check and force the user to restart if this isn't true.
 exitflag=0
@@ -57,8 +61,8 @@ fi
 mount $TARGET_DISK$TARGET_PART $TARGET_MOUNT || \
   err_quit "Failed to mount $TARGET_DISK$TARGET_PART on $TARGET_MOUNT. "
 
-# Mount Ok - Parition correct now set label to ROOT_FS
-e2label $TARGET_DISK$TARGET_PART ROOT_FS
+# Mount Ok - Partition correct, now set ext2 label to VOYAGE_FS
+e2label $TARGET_DISK$TARGET_PART $ROOT_LBL
 
 # We are going to use rsync to copy files from the distribution to the
 # target.  In order to minimise any flash writing, we first figure out
diff --git a/usr/local/sbin/format-cf.sh b/usr/local/sbin/format-cf.sh
index f94812c..2fa9f0c 100755
--- a/usr/local/sbin/format-cf.sh
+++ b/usr/local/sbin/format-cf.sh
@@ -5,6 +5,10 @@ TARGET_PART=""
 SYSTEM_BOOT="1"
 DONT_ASK="0"
 
+if [ -z $ROOT_LBL ] ; then
+    err_quit "ROOT_LBL not set, in $0, quitting"
+fi
+
 # no here-document here. 
 # this may be called from a read-only (live) file system
 # where the mandatory tmp file for here-douments can't be 
@@ -90,5 +94,5 @@ esac
 sleep 1
 [ -b "$TARGET_PART" ] && { 
 	mkfs.ext2 $TARGET_PART
-	tune2fs -i 0 -c 0 $TARGET_PART -L ROOT_FS
+	tune2fs -i 0 -c 0 $TARGET_PART -L $ROOT_LBL
 }
diff --git a/usr/local/sbin/setboot.sh b/usr/local/sbin/setboot.sh
index 328e999..a3ca0f0 100755
--- a/usr/local/sbin/setboot.sh
+++ b/usr/local/sbin/setboot.sh
@@ -1,5 +1,9 @@
 #!/bin/bash
 
+if [ -z $ROOT_LBL ] ; then
+    err_quit "ROOT_LBL not set, in $0, quitting"
+fi
+
 if [ ! "${HAVESCRIPTUTILS:+present}" ]; then
 	echo "This script must be run under voyage.update" >&2
 	exit
@@ -50,13 +54,13 @@ image=/vmlinuz
 	label=Linux
 	initrd=/initrd.img
 	read-only
-	append="root=LABEL=ROOT_FS ${serapp}reboot=bios ${BOOTARGS}"
+	append="root=LABEL=$ROOT_LBL ${serapp}reboot=bios ${BOOTARGS}"
 
 image=/vmlinuz.old
 	label=LinuxOLD
 	initrd=/initrd.img.old
 	read-only
-	append="root=LABEL=ROOT_FS ${serapp}reboot=bios ${BOOTARGS}"
+	append="root=LABEL=$ROOT_LBL ${serapp}reboot=bios ${BOOTARGS}"
 	optional
 EOM
 	sed -e "/disk =/d;/bios =/d" -e "s#${TARGET_DISK}#/dev/hda#" \
@@ -197,7 +201,7 @@ EOM
 
 title Voyage Linux $version
 root (hd0,$(($TARGET_PART-1)))
-kernel /vmlinuz root=LABEL=ROOT_FS ${console} ${BOOTARGS}
+kernel /vmlinuz root=LABEL=$ROOT_LBL ${console} ${BOOTARGS}
 ${VOYAGE_INITRD}
 
 EOM
-- 
1.7.11.4


_______________________________________________
Voyage-linux mailing list
Voyage-linux@list.voyage.hk
http://list.voyage.hk/mailman/listinfo/voyage-linux
