[pkg-fso-commits] [SCM] Various non-packaged files branch, master, updated. d18821f6378eac9a00723a180eda5145a3ccdc8c

Steffen Moeller moeller at debian.org
Sat Feb 28 12:06:44 UTC 2009


The following commit has been merged in the master branch:
commit 0da102c3e98f09ac6b85e445fdcd2c03bbd6d2f3
Author: Steffen Moeller <moeller at debian.org>
Date:   Tue Feb 24 01:35:32 2009 +0100

    Fixes proposed by x.

diff --git a/install.sh b/install.sh
index f04292f..85b038f 100755
--- a/install.sh
+++ b/install.sh
@@ -236,10 +236,10 @@ ENVIRONMENT
                      microSD card unless the partioning is the same as
                      used before; this can be used to recover a broken
                      partiton table due to the suspend/resume problem)
-	format       Formats the microSD card found in $SD_DEVICE
+	format       Formats the microSD card found in '$SD_DEVICE'
                      (WARNING, this will destroy all the data on the
                      microSD card)
-	mount        Mounts microSD card partitions under $INST_DIR
+	mount        Mounts microSD card partitions under '$INST_DIR'
 	debian       Installs a basic Debian system, including an SSH server
 	apt          Configure APT
 	fso          Installs packages required to use the Zhone GUI
@@ -250,7 +250,7 @@ ENVIRONMENT
                      the X server
 	kernel       Downloads and installs the Debian kernel package
                      (only when $SD_PART1_FS is set to ext2)
-	unmount      Unmounts the Debian filesystem mounted at $INST_DIR
+	unmount      Unmounts the Debian filesystem mounted at '$INST_DIR'
 
     Unsupported or buggy stages, use at your own risk:
 
@@ -340,7 +340,7 @@ I: Running all stages with these settings:
 I: hostname set to $HOSTNAME
 I: microSD card device at $SD_DEVICE
 I: $SD_PART1_FS as filesystem for the first microSD card partition
-I: installing into $INST_DIR
+I: installing into '$INST_DIR'
 I: using Debian mirror at $INST_MIRROR
 I: APT recommends set to $APT_RECOMMENDS
 I: dash as default /bin/sh se to $DASH_BINSH
@@ -451,7 +451,7 @@ action_testing () {
 
 action_time () {
 	echo "Fetching time from $RDATEHOST with rdate"
-	rdate -s "$RDATEHOST"
+	rdate -s "$RDATEHOST" >/dev/null 2>&1
 	echo "I: Time is now `date`"
 }
 
@@ -464,16 +464,29 @@ action_partition () {
 	umount_all
 
 	# put the partition table in a "known state"
-	dd if=/dev/zero of=$SD_DEVICE bs=512 count=1
+	echo " * Clearing MBR of SD."
+	if ! dd if=/dev/zero of=$SD_DEVICE bs=512 count=1 >/dev/null 2>&1; then
+		echo "Clearing MBR of SD with dd failed ($?)."
+		exit 1
+	fi
 
 	# run partitioner
 	rootpartno=2
 	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\ )
+	mb=$(echo pq | fdisk ${SD_DEVICE} | grep Disk| cut -f 3 -d \ )
+	cylinders=$(echo pq | fdisk ${SD_DEVICE} | grep cylinders|grep heads|cut -f 5 -d\ )
 	lastcylinder=$(($cylinders-($cylinders*$SD_SWAP_SIZE/$mb)))
 
+##### TODO: Evaluate the suggestion by x
+#+#	mb=$(echo pq | fdisk /dev/mmcblk0 | grep Disk | cut -f 3 -d \ )
+#+	mb=$(sfdisk -s ${SD_DEVICE} 2>/dev/null)
+#+#	cylinders=$(echo pq | fdisk /dev/mmcblk0 | grep cylinders | grep heads | cut -f 5 -d\ )
+#+	cylinders=$(sfdisk -G ${SD_DEVICE} 2>/dev/null | grep "^${SD_DEVICE}" | awk "{ print \$2 }")
+#+	lastcylinder=$(($cylinders-($cylinders*$SD_SWAP_SIZE/($mb/1024))))
+#
+
+
 	if [ "vfat" = "$SD_PART1_FS" ]; then
 		bootfstypeno=4
 	fi
@@ -541,7 +554,7 @@ EOSWAPCONF
 	else
 		echo "Partitioning failed, could not execute with fdisk:"
 		cat /tmp/argsToFdisk$$
-		exit -1
+		exit 1
 	fi
 
 
@@ -589,22 +602,22 @@ action_format () {
 action_mount () {
 	echo "Mounting the newly created system"
 	if [ -d "$INST_DIR" ]; then
-		 mkdir -p $INST_DIR; 
+		 mkdir -p "$INST_DIR"; 
 	elif [ -n "$verbose" ]; then
 		echo "Not creating directory '$INST_DIR', it is already existing."
 	fi
 	if [ "$SINGLE_PART" = "true" ]; then
 		if [ -n "$verbose" ]; then echo "Preparing single ext2 device."; fi
-		mount -t auto ${SD_DEVICE}p1 $INST_DIR
-		mkdir -p $INST_DIR/boot
+		mount -t auto ${SD_DEVICE}p1 "$INST_DIR"
+		mkdir -p "$INST_DIR/boot"
 	else
 		if [ -n "$verbose" ]; then echo "Mounting root partition to '$INST_DIR'."; fi
-		mount -t auto ${SD_DEVICE}p2 $INST_DIR
+		mount -t auto ${SD_DEVICE}p2 "$INST_DIR"
 		if [ "vfat" = "$SD_PART1_FS" ]; then
 			echo "You have a vfat boot filesystem. This is not mounted to /boot."
 		else
-			if [ ! -d "$INST_DIR/boot" ]; then mkdir $INST_DIR/boot; fi
-			mount -t auto ${SD_DEVICE}p1 $INST_DIR/boot
+			if [ ! -d "$INST_DIR/boot" ]; then mkdir "$INST_DIR/boot"; fi
+			mount -t auto ${SD_DEVICE}p1 "$INST_DIR/boot"
 		fi
 	fi
 	echo "I: microSD card partitions mounted"
@@ -657,7 +670,7 @@ action_debian () {
 	fi
 	cdebootstrap-static --allow-unauthenticated --flavour minimal \
 		--include=$CDEBOOTSTRAP_EXTRA_PACKAGES \
-		--exclude=$CDEBOOTSTRAP_EXCLUDE_PACKAGES sid $INST_DIR $INST_MIRROR
+		--exclude=$CDEBOOTSTRAP_EXCLUDE_PACKAGES sid "$INST_DIR" $INST_MIRROR
 
 	echo "I: basic Debian system installed"
 }
@@ -670,23 +683,23 @@ action_apt () {
 	echo "Configuring APT"
 
 	echo " * Creating /etc/apt/sources.list"
-	cat > $INST_DIR/etc/apt/sources.list <<__END__
+	cat > "$INST_DIR/etc/apt/sources.list" <<__END__
 deb $INST_MIRROR unstable main
 deb $INST_MIRROR experimental main
 deb $FSO_MIRROR unstable main
 __END__
 
 	echo " * Install APT recommends by default: $APT_RECOMMENDS"
-	echo "APT::Install-Recommends \"$APT_RECOMMENDS\";" > $INST_DIR/etc/apt/apt.conf.d/99recommends
+	echo "APT::Install-Recommends \"$APT_RECOMMENDS\";" > "$INST_DIR/etc/apt/apt.conf.d/99recommends"
 
 	echo " * Updating APT database"
-	chroot $INST_DIR apt-get update
+	chroot "$INST_DIR" apt-get update
 
 	echo " * Installing pkg-fso keyring"
-	chroot $INST_DIR apt-get $APT_OPTIONS install pkg-fso-keyring
+	chroot "$INST_DIR" apt-get $APT_OPTIONS install pkg-fso-keyring
 
 	echo " * Removing additional packages"
-	chroot $INST_DIR /bin/sh -e <<__END_CHROOT__
+	chroot "$INST_DIR" /bin/sh -e <<__END_CHROOT__
 apt-get update
 apt-get --yes --purge remove cdebootstrap-helper-rc.d
 apt-get clean
@@ -702,7 +715,7 @@ __END_CHROOT__
 action_fso () {
 	# TODO
 	echo "Installing FSO-specific packages"
-	chroot $INST_DIR /bin/sh -e <<__END_CHROOT__
+	chroot "$INST_DIR" /bin/sh -e <<__END_CHROOT__
 apt-get $APT_OPTIONS install $FSO_PACKAGES
 apt-get clean
 __END_CHROOT__
@@ -715,7 +728,7 @@ __END_CHROOT__
 #
 action_games () {
 	echo "Installing a selection of games"
-	chroot $INST_DIR /bin/sh -e <<__END_CHROOT__
+	chroot "$INST_DIR" /bin/sh -e <<__END_CHROOT__
 apt-get $APT_OPTIONS install $GAMES_PACKAGES
 apt-get clean
 __END_CHROOT__
@@ -730,10 +743,10 @@ action_configuration () {
 	echo "Configuring system files for ${FSO_DEVICE}"
 
 	echo " * Installing the fso-config-${FSO_DEVICE} package"
-	chroot $INST_DIR apt-get $APT_OPTIONS install fso-config-${FSO_DEVICE}
+	chroot "$INST_DIR" apt-get $APT_OPTIONS install fso-config-${FSO_DEVICE}
 
 	echo " * Creating /etc/X11/xorg.conf"
-	cat > $INST_DIR/etc/X11/xorg.conf <<__END__
+	cat > "$INST_DIR/etc/X11/xorg.conf" <<__END__
 # Xorg confiugration for an Openmoko FreeRunner
 Section "InputDevice"
 	Identifier	"Configured Touchscreen"
@@ -753,7 +766,7 @@ EndSection
 __END__
 
 	echo " * Creating /etc/inittab (all but tty1 disabled to save memory)"
-	cat > $INST_DIR/etc/inittab <<__END__
+	cat > "$INST_DIR/etc/inittab" <<__END__
 id:2:initdefault:
 si::sysinit:/etc/init.d/rcS
 ~~:S:wait:/sbin/sulogin
@@ -778,7 +791,7 @@ po::powerokwait:/etc/init.d/powerfail stop
 __END__
 
 	echo " * Creating /etc/modules"
-	cat > $INST_DIR/etc/modules <<__END__
+	cat > "$INST_DIR/etc/modules" <<__END__
 # USB RNDIS/Ethernet Gadget
 g_ether
 
@@ -791,29 +804,29 @@ hci_usb
 __END__
 
 	echo " * Setting FSCKFIX=yes in /etc/default/rcS"
-	sed -i 's/FSCKFIX=.*/FSCKFIX=yes'/ $INST_DIR/etc/default/rcS
+	sed -i 's/FSCKFIX=.*/FSCKFIX=yes'/ "$INST_DIR/etc/default/rcS"
 
 	echo " * Creating /etc/fstab"
-	mkdir -p $INST_DIR/mnt/flash
-	cat > $INST_DIR/etc/fstab <<__END__
+	mkdir -p "$INST_DIR/mnt/flash"
+	cat > "$INST_DIR/etc/fstab" <<__END__
 rootfs	/		auto	defaults,errors=remount-ro,noatime	0 1
 __END__
 
 	if [ "$SINGLE_PART" != "true" ]; then
 		if [ "ext2" = "$SD_PART1_FS" -o "ext3" = "$SD_PART1_FS" ]; then
-			cat >> $INST_DIR/etc/fstab <<__END__
+			cat >> "$INST_DIR/etc/fstab" <<__END__
 /dev/mmcblk0p1	/boot	auto	defaults,noatime			0 2
 __END__
 
 		else
-			cat >> $INST_DIR/etc/fstab <<__END__
+			cat >> "$INST_DIR/etc/fstab" <<__END__
 /dev/mmcblk0p1	/boot	auto	defaults,noatime,noauto			0 2
 __END__
 
 		fi
 
 		if [ 0 -lt "$SD_SWAP_SIZE" ]; then
-			cat >> $INST_DIR/etc/fstab <<__END__
+			cat >> "$INST_DIR/etc/fstab" <<__END__
 /dev/mmcblk0p3  none    swap     sw                                     0 0
 __END__
 
@@ -821,14 +834,14 @@ __END__
 	else
 		# $SINGLE_PART = "true"
 		if [ 0 -lt "$SD_SWAP_SIZE" ]; then
-			cat >> $INST_DIR/etc/fstab <<__END__
+			cat >> "$INST_DIR/etc/fstab" <<__END__
 /dev/mmcblk0p2  none   swap     sw                                     0 0
 __END__
 		fi
 	fi
 
 
-	cat >> $INST_DIR/etc/fstab <<__END__
+	cat >> "$INST_DIR/etc/fstab" <<__END__
 /dev/mtdblock6	/mnt/flash	jffs2	defaults,noatime,noauto		0 2
 proc	/proc		proc	defaults				0 0
 tmpfs	/tmp		tmpfs	defaults,noatime			0 0
@@ -837,27 +850,27 @@ tmpfs	/var/run	tmpfs	defaults,noatime			0 0
 __END__
 
 	echo " * Setting /etc/hostname to $HOSTNAME"
-	echo "$HOSTNAME" >$INST_DIR/etc/hostname
+	echo "$HOSTNAME" > "$INST_DIR/etc/hostname"
 
 	for FILE in /etc/network/interfaces /etc/resolv.conf; do
 		echo " * $FILE copied from this machine"
-		cat > $INST_DIR$FILE <$FILE
+		cat > "$INST_DIR$FILE" <$FILE
 	done
 
 	echo " * Setting empty root password"
-	echo 'root:' | chroot $INST_DIR chpasswd
+	echo 'root:' | chroot "$INST_DIR" chpasswd
 
 	for HOST_KEY in $DROPBEAR_KEYS; do
 		if [ -f "$HOST_KEY" ]; then
 			echo " * copying ssh host key $HOST_KEY"
-			cat >$INST_DIR$HOST_KEY <$HOST_KEY
+			cat >"$INST_DIR$HOST_KEY" <$HOST_KEY
 		fi
 	done
 
 
 	echo " * Installing dash as /bin/sh: $DASH_BINSH"
-	echo 'dash dash/sh string $DASH_BINSH' | chroot $INST_DIR debconf-set-selections
-	chroot $INST_DIR apt-get $APT_OPTIONS install dash
+	echo 'dash dash/sh string $DASH_BINSH' | chroot "$INST_DIR" debconf-set-selections
+	chroot "$INST_DIR" apt-get $APT_OPTIONS install dash
 
 	case "$WITH_WIFI" in
 	  "wicd")
@@ -867,9 +880,9 @@ __END__
 			grep -v ^wired_interface "$INST_DIR/etc/wicd/manager-settings.conf" > \
 				"$INST_DIR/etc/wicd/manager-settings.conf"
 		else
-			mkdir $INST_DIR/etc/wicd
+			mkdir "$INST_DIR/etc/wicd"
 		fi
-		echo "wired_interface =" >> $INST_DIR/etc/wicd/manager-settings.conf
+		echo "wired_interface =" >> "$INST_DIR/etc/wicd/manager-settings.conf"
 		;;
 
 	  "none")
@@ -881,13 +894,13 @@ __END__
 
 	if [ -f "$WPA_SUPPLICANT_CONF" ]; then
 		echo " * Installing wpasupplicant, wireless-tools and udhcpc"
-		chroot $INST_DIR apt-get $APT_OPTIONS install wpasupplicant wireless-tools udhcpc
+		chroot "$INST_DIR" apt-get $APT_OPTIONS install wpasupplicant wireless-tools udhcpc
 		echo " * $WPA_SUPPLICANT_CONF copied from this machine"
-		cat >$INST_DIR$WPA_SUPPLICANT_CONF <$WPA_SUPPLICANT_CONF
+		cat > "$INST_DIR$WPA_SUPPLICANT_CONF" <$WPA_SUPPLICANT_CONF
 	fi
 
 	echo " * Installing /root/.xsession"
-	cat > $INST_DIR/root/.xsession <<EOMATCHBOX
+	cat > "$INST_DIR/root/.xsession" <<EOMATCHBOX
 #!/bin/sh
 trayer --edge top &
 openmoko-panel-plugin &
@@ -897,8 +910,8 @@ EOMATCHBOX
 
 	case "$WITH_WIFI" in
 	  "wicd")
-		#sed -i '/^exec/iif [ -x /usr/bin/wicd-client ]; then wicd-client --no-animate &; fi' $INST_DIR/root/.xsession
-		sed -i '/^exec/i#wicd-client --no-animate &' $INST_DIR/root/.xsession
+		#sed -i '/^exec/iif [ -x /usr/bin/wicd-client ]; then wicd-client --no-animate &; fi' "$INST_DIR/root/.xsession"
+		sed -i '/^exec/i#wicd-client --no-animate &' "$INST_DIR/root/.xsession"
 		;;
 	  *)
 		;;
@@ -919,9 +932,9 @@ action_kernel () {
 		intern_bootmountpoint=$(mount | grep "^${SD_DEVICE}p1"| cut -f3 -d\ )
 		if [ -z "$intern_bootmountpoint" -o "boot" != "$(basename "$intern_bootmountpoint")" ]; then
 			echo " * installing to /boot"
-			chroot $INST_DIR $intern_cmd
+			chroot "$INST_DIR" $intern_cmd
 			echo " * cleaning apt cache"
-			chroot $INST_DIR apt-get clean
+			chroot "$INST_DIR" apt-get clean
 			echo " * copying /boot/uImage.bin to first partition"
 			if [ -z "$intern_bootmountpoint" ]; then
 				if [ -n "$VERBOSE" ]; then
@@ -931,7 +944,7 @@ action_kernel () {
 				mount ${SD_DEVICE}p1 /mnt/tmp_first_part_$$
 
 				if [ -n "$VERBOSE" ]; then
-					echo "    Copying $INST_DIR/boot/uImage.bin to /mnt/tmp_first_part_$$/"
+					echo "    Copying '$INST_DIR/boot/uImage.bin' to '/mnt/tmp_first_part_$$/'"
 				fi
 				cp "$INST_DIR/boot/uImage.bin" "/mnt/tmp_first_part_$$/"
 
@@ -945,7 +958,7 @@ action_kernel () {
 					echo "    Found first partitional already mounted to '$intern_bootmountpoint'."
 				fi
 				if [ -n "$VERBOSE" ]; then
-					echo "    Copying $INST_DIR/boot/uImage.bin to '$intern_bootmountpoint/'."
+					echo "    Copying '$INST_DIR/boot/uImage.bin' to '$intern_bootmountpoint/'."
 				fi
 				cp "$INST_DIR/boot/uImage.bin" "$intern_bootmountpoint/"
 			fi
@@ -964,7 +977,7 @@ action_kernel () {
 			return 0
 		fi
 	else
-		chroot $INST_DIR /bin/sh -e <<__END_CHROOT__
+		chroot "$INST_DIR" /bin/sh -e <<__END_CHROOT__
 $intern_cmd
 apt-get clean
 __END_CHROOT__
@@ -974,13 +987,13 @@ __END_CHROOT__
 
 	if [ "$QI" = "true" ]; then
 		echo "Prepare system for booting with Qi"
-		BOOT_DIR=$INST_DIR/boot/boot
+		BOOT_DIR="$INST_DIR/boot/boot"
 		if [ "$SINGLE_PART" = "true" ]; then
-			BOOT_DIR=$INST_DIR/boot
-			ln -s uImage.bin $BOOT_DIR/uImage-GTA02.bin
+			BOOT_DIR="$INST_DIR/boot"
+			ln -fs uImage.bin $BOOT_DIR/uImage-GTA02.bin
 		else
 			mkdir $BOOT_DIR
-			ln -s ../uImage.bin $BOOT_DIR/uImage-GTA02.bin
+			ln -fs ../uImage.bin $BOOT_DIR/uImage-GTA02.bin
 		fi
 	
 		if [ "$SINGLE_PART" = "true" ]; then
@@ -1010,7 +1023,7 @@ action_uboot () {
 		exit 1
 	fi
 
-	cat > $INST_DIR/root/uboot_menu.in <<'__END__'
+	cat > "$INST_DIR/root/uboot_menu.in" <<'__END__'
 bootcmd=
   setenv bootargs
     ${bootargs_base} ${mtdparts}
@@ -1059,9 +1072,9 @@ __END__
 		exit 1
 	fi
 
-	echo " * Mounting /dev inside the chroot at $INST_DIR"
-	mount -o bind /dev $INST_DIR/dev
-	chroot $INST_DIR /bin/sh -e <<__END_CHROOT__
+	echo " * Mounting /dev inside the chroot at '$INST_DIR'"
+	mount -o bind /dev "$INST_DIR/dev"
+	chroot "$INST_DIR" /bin/sh -e <<__END_CHROOT__
 echo " * Dumping current U-Boot environment"
 #dd if=/dev/mtdblock2 of=\$INST_DIR/root/env.orig
 nanddump /dev/mtd2 -o -b -f /root/env.orig
@@ -1081,7 +1094,7 @@ nandwrite /dev/mtd2 /root/env.new
 __END_CHROOT__
 
 	echo " * Unmounting /dev"
-	umount $INST_DIR/dev
+	umount "$INST_DIR/dev"
 
 	echo "I: U-Boot environment modified"
 }
@@ -1092,9 +1105,9 @@ __END_CHROOT__
 action_unmount () {
 	echo "Unmounting microSD card partitions"
 	if [ "$SINGLE_PART" != "true" ]; then
-		umount $INST_DIR/boot
+		umount "$INST_DIR/boot"
 	fi
-	umount $INST_DIR
+	umount "$INST_DIR"
 	echo "I: microSD card partitions unmounted"
 }
 

-- 
Various non-packaged files



More information about the pkg-fso-commits mailing list