[PATCH] Added formatting of vfat systems, prepared swap partition.

Steffen Moeller steffen_moeller at gmx.de
Fri Feb 13 01:38:37 UTC 2009


---
 install.sh |   84 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/install.sh b/install.sh
index d6fceb5..9a8431e 100755
--- a/install.sh
+++ b/install.sh
@@ -38,6 +38,8 @@ set -e
 HOSTNAME=${HOSTNAME:-debian-gta02}
 SD_DEVICE=${SD_DEVICE:-/dev/mmcblk0}
 SD_PART1_FS=${SD_PART1_FS:-ext2}
+SD_PART1_SIZE=${SD_PART1_SIZE:-8}
+SD_SWAP_SIZE=${SD_SWAP_SIZE:-0}
 INST_DIR=${INST_DIR:-/mnt/debian}
 INST_MIRROR=${INST_MIRROR:-http://ftp2.de.debian.org/debian}
 APT_RECOMMENDS=${APT_RECOMMENDS:-false}
@@ -155,6 +157,8 @@ Variables:
   SD_PART1_FS      the filesystem for the first microSD card partition,
                    i.e. the one containing the uImage.bin (default to
                    ext2, possible values are ext2/vfat)
+  SD_PART1_SIZE    number of megapytes for first partition (default $SD_PART1_SIZE)
+  SD_SWAP_SIZE     number of megabytes of swap partition (default $SD_SWAP_SIZE)
   INST_DIR         the directory where the microSD card partitions
                    will be mounted to (default to /mnt/debian)
   INST_MIRROR      the Debian mirror used during installation, it
@@ -390,46 +394,68 @@ umount_all
 
 # put the partition table in a "known state"
 dd if=/dev/zero of=$SD_DEVICE bs=512 count=1
+
 # run partitioner
-if [ "$SD_PART1_FS" = "vfat" ]; then
+rootpartno=2
+bootfstypeno=83
+if [ "vfat" = "$SD_PART1_FS" ]; then
+	bootfstypeno=4
+fi
+
+if [ "$SINGLE_PART" = "true" ]; then
 	fdisk $SD_DEVICE <<__END__
 n
 p
 1
 
-+8M
-t
-4
-n
-p
-2
 
-
-w
 __END__
-elif [ "$SINGLE_PART" = "true" ]; then
-	fdisk $SD_DEVICE <<__END__
-n
-p
-1
 
+	if [ -n "$SD_SWAP_SIZE" ]; then
+		echo "Preparation of swap partition is not supported for single part setups."
+	fi
 
-w
-__END__
 else
-	fdisk $SD_DEVICE <<__END__
+	cat <<EOBOOTCONF > /tmp/argsToFdisk$$
 n
 p
 1
 
-+8M
++${SD_PART1_SIZE}M
+t
+$bootfstypeno
+EOBOOTCONF
+
+	if [ 0 -lt "$SD_SWAP_SIZE" ]; then
+		rootpartno=3
+		cat <<EOSWAPCONF >> /tmp/argsToFdisk$$
 n
 p
 2
 
++${SD_SWAP_SIZE}M
+t
+82
+EOSWAPCONF
+	fi
+
+	cat <<EOROOTCONF >> /tmp/argsToFdisk$$
+n
+p
+$rootpartno
+
 
 w
-__END__
+EOROOTCONF
+
+	if fdisk $SD_DEVICE < /tmp/argsToFdisk$$; then
+		echo "Partitioning was successful."
+		#rm /tmp/argsToFdisk$$
+	else
+		echo "Partitioning failed, could not execute with fdisk:"
+		cat /tmp/argsToFdisk$$
+		exit -1
+	fi
 fi
 
 echo " * Waiting for partitions to appear"
@@ -676,11 +702,10 @@ if [ -f "$WPA_SUPPLICANT_CONF" ]; then
 fi
 
 echo " * Installing /root/.xsession"
-case $WINDOW_MANAGER in
-fbpanel) 
+if [ "fbpanel" = "$WINDOW_MANAGER" ]; then
 	# from http://wiki.openmoko.org/wiki/Debian#Matchbox_with_fbpanel
 	apt-get -yes install fbpanel
-	cat > $INST_DIR/root/.xsession <<__END__
+	cat > $INST_DIR/root/.xsession <<EOFBPANEL
 #!/bin/sh
 export GTK_MODULES=libgtkstylus.so
 zhone &
@@ -695,18 +720,19 @@ do
 fbpanel;
 sleep 1;
 done;
-__END__
-	
-*)
-	cat > $INST_DIR/root/.xsession <<__END__
+EOFBPANEL
+
+else
+
+	cat > $INST_DIR/root/.xsession <<EOZHONE
 #!/bin/sh
 trayer --edge top &
 openmoko-panel-plugin &
 zhone &
 exec matchbox-window-manager -use_titlebar no -use_cursor no
-__END__
-	;;
-esac
+EOZHONE
+
+fi
 
 echo "I: System configured"
 ;;
-- 
1.5.6.5


--------------030702030608070701010707--



More information about the pkg-fso-maint mailing list