[pkg-fso-maint] install.sh: filesystem for first partition (was Re: some issues in install.sh)

Luca Capello luca at pca.it
Mon Jun 15 15:57:02 UTC 2009


Hi Brian!

On Sun, 14 Jun 2009 22:09:36 +0200, Brian DeRocher wrote:
> I just ran (by hand) the debian install.sh script for OpenMoko and thought i 
> share some findings.  I used version 3.0.

For the future, please separate the issues in smaller posts, since it is
easier to follow them (and even later to search for them).  I will do it
starting with this mail.

Another useful thing is to provide changes in diff format, since they
are easier to review instead than looking for the relevant part in the
code.

> You can give the part1_fs option, but line 724 will do ext2 even if ext3 was 
> specified.
> 	mkfs.ext2 ${SD_DEVICE}p1
>
>
> This code:
>
> 	if [ "$SINGLE_PART" = "true" ]; then
> 		mkfs.ext2 ${SD_DEVICE}p1
[...]
> should be re-factored to something like this to help avoid those bugs.

Actually, from a bugfixing POV you just need:

--8<---------------cut here---------------start------------->8---
diff --git a/install.sh b/install.sh
index a3be9e3..e1c1c3f 100755
--- a/install.sh
+++ b/install.sh
@@ -721,7 +721,7 @@ action_format () {
 
 	echo " * Formatting the microSD card partitions"
 	if [ "$SINGLE_PART" = "true" ]; then
-		mkfs.ext2 ${SD_DEVICE}p1
+		mkfs.$SD_PART2_FS ${SD_DEVICE}p1
 		if [ 0 -lt "$SD_SWAP_SIZE" ]; then
 			echo " * Formatting swap on ${SD_DEVICE}p2"
 			mkswap ${SD_DEVICE}p2
--8<---------------cut here---------------end--------------->8---

Your refactoring in diff format:

--8<---------------cut here---------------start------------->8---
diff --git a/install.sh b/install.sh
index a3be9e3..4048c82 100755
--- a/install.sh
+++ b/install.sh
@@ -720,19 +720,15 @@ action_format () {
 	if [ -z "$SD_SWAP_SIZE" ]; then SD_SWAP_SIZE=0; fi
 
 	echo " * Formatting the microSD card partitions"
-	if [ "$SINGLE_PART" = "true" ]; then
-		mkfs.ext2 ${SD_DEVICE}p1
-		if [ 0 -lt "$SD_SWAP_SIZE" ]; then
-			echo " * Formatting swap on ${SD_DEVICE}p2"
-			mkswap ${SD_DEVICE}p2
-		fi
-	else
-		mkfs.$SD_PART1_FS ${SD_DEVICE}p1
+	mkfs.$SD_PART1_FS ${SD_DEVICE}p1
+	nextpart=2
+	if [ "$SINGLE_PART" != "true" ]; then
 		mkfs.$SD_PART2_FS ${SD_DEVICE}p2
-		if [ 0 -lt "$SD_SWAP_SIZE" ]; then
-			echo " * Formatting swap on ${SD_DEVICE}p3"
-			mkswap ${SD_DEVICE}p3
-		fi
+		nextpart=3
+	fi
+	if [ 0 -lt "$SD_SWAP_SIZE" ]; then
+		echo " * Formatting swap on ${SD_DEVICE}p${nextpart}"
+		mkswap ${SD_DEVICE}p${nextpart}
 	fi
 
 	echo "I: microSD card ready"
--8<---------------cut here---------------end--------------->8---

To be clear, I prefer your refactoring and from a quick view it seems
correct.  However, I would like to perform some test installations
before applying it, just to be sure everything is OK.

I will comment on the other points later and on separate mails, as I
wrote at the beginning.

Thx, bye,
Gismo / Luca
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 314 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-fso-maint/attachments/20090615/f54fb01c/attachment.pgp>


More information about the pkg-fso-maint mailing list