[PATCH 9/9] Verified single part to work.

Steffen Moeller steffen_moeller at gmx.de
Tue Feb 17 17:41:07 UTC 2009


---
 install.sh |   61 +++++++++++++++++++++++++++++------------------------------
 1 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/install.sh b/install.sh
index d28b56b..9e109af 100755
--- a/install.sh
+++ b/install.sh
@@ -452,80 +452,79 @@ bootfstypeno=83
 
 mb=$(echo pq | fdisk /dev/mmcblk0 | grep Disk| cut -f 3 -d \ )
 cylinders=$(echo pq | fdisk /dev/mmcblk0 | grep cylinders|grep heads|cut -f 5 -d\ )
+lastcylinder=$(($cylinders-($cylinders*$SD_SWAP_SIZE/$mb)))
 
 if [ "vfat" = "$SD_PART1_FS" ]; then
 	bootfstypeno=4
 fi
 
+partitionno=0
 if [ "$SINGLE_PART" = "true" ]; then
 	echo "Preparing SD as a single Linux device."
-	fdisk $SD_DEVICE <<__END__
+	partitionno=$(($partitionno+1))
+	cat <<EOSINGLECONF > /tmp/argsToFdisk$$
 n
 p
-1
+$partitionno
 
-
-w
-__END__
-
-	if [ -n "$SD_SWAP_SIZE" ]; then
-		echo "Preparation of swap partition is not supported for single part setups."
-	fi
+$lastcylinder
+EOSINGLECONF
 
 else
+	partitionno=$(($partitionno+1))
 	cat <<EOBOOTCONF > /tmp/argsToFdisk$$
 n
 p
-1
+$partitionno
 
 +${SD_PART1_SIZE}M
 t
 $bootfstypeno
 EOBOOTCONF
 
-	lastcylinder=$(($cylinders-($cylinders*$SD_SWAP_SIZE/$mb)))
+	partitionno=$(($partitionno+1))
 	cat <<EOROOTCONF >> /tmp/argsToFdisk$$
 n
 p
-2
+$partitionno
 
 $lastcylinder
 t
-2
+$partitionno
 83
 EOROOTCONF
+fi
 
-	if [ 0 -lt "$SD_SWAP_SIZE" ]; then
-		cat <<EOSWAPCONF >> /tmp/argsToFdisk$$
+if [ 0 -lt "$SD_SWAP_SIZE" ]; then
+	partitionno=$(($partitionno+1))
+	cat <<EOSWAPCONF >> /tmp/argsToFdisk$$
 n
 p
-3
+$partitionno
 
 
 t
-3
+$partitionno
 82
 p
 EOSWAPCONF
+fi
 echo "w" >> /tmp/argsToFdisk$$
 
+if fdisk $SD_DEVICE < /tmp/argsToFdisk$$; then
+	echo "Partitioning was successful."
+	if [ -n "$verbose" ]; then
+		echo "The following partitions have been created:"
+		echo "pq" | fdisk $SD_DEVICE
 	fi
-
-	if fdisk $SD_DEVICE < /tmp/argsToFdisk$$; then
-		echo "Partitioning was successful."
-		if [ -n "$verbose" ]; then
-			echo "The following partitions have been created:"
-			echo "pq" | fdisk $SD_DEVICE
-		fi
-		#rm /tmp/argsToFdisk$$
-	else
-		echo "Partitioning failed, could not execute with fdisk:"
-		cat /tmp/argsToFdisk$$
-		exit -1
-	fi
-
+	#rm /tmp/argsToFdisk$$
+else
+	echo "Partitioning failed, could not execute with fdisk:"
+	cat /tmp/argsToFdisk$$
+	exit -1
 fi
 
+
 echo " * Waiting for partitions to appear"
 SLEEP_SECONDS=3
 if [ "$SINGLE_PART" = "true" ]; then
-- 
1.6.1.3


--------------010206000308080503060707--



More information about the pkg-fso-maint mailing list