diff options
author | Dirk von Suchodoletz | 2011-04-30 20:50:40 +0200 |
---|---|---|
committer | Dirk von Suchodoletz | 2011-04-30 20:50:40 +0200 |
commit | 14bf7f7eac1e40d8a2ca1ac8dad12de0f1ddf391 (patch) | |
tree | c766ee6147f776dd9b7320153ae9d8c485482911 | |
parent | Version of usb-stick creator which puts the bootable partition to the end. (diff) | |
download | usb-boot-stick-14bf7f7eac1e40d8a2ca1ac8dad12de0f1ddf391.tar.gz usb-boot-stick-14bf7f7eac1e40d8a2ca1ac8dad12de0f1ddf391.tar.xz usb-boot-stick-14bf7f7eac1e40d8a2ca1ac8dad12de0f1ddf391.zip |
Make the calculation right (normalize to MByte) ...
-rwxr-xr-x | install-usb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/install-usb b/install-usb index 01c57cd..ccac69e 100755 --- a/install-usb +++ b/install-usb @@ -28,6 +28,11 @@ if [ -z $OUT_DEV ]; then exit 1 fi +echo "device ${OUT_DEV} will be repartitioned and formatted" +echo -n "type 'cont' to proceed: " +read cont +[ "x${cont}" != "xcont" ] && exit 1 + for i in 1 2 3 4 5 6 7 8 9; do umount /dev/${OUT_DEV}$i &> /dev/null done @@ -44,19 +49,26 @@ build.initramfs.sh # get the total size of the device DISKSIZE=$(sfdisk -s /dev/${OUT_DEV} 2>/dev/null || echo 0) +DISKSIZE=$((${DISKSIZE}/1024)) # get the size of boot stuff and calculate the left over free space on device KSIZE=$(ls -l ${ROOT_DIR}/build/kernel-preboot-latest|awk '{print $5}') ISIZE=$(ls -l ${ROOT_DIR}/build/initramfs-default|awk '{print $5}') -IMAGESIZE=$((${KSIZE}+${ISIZE}+6000000)) +IMAGESIZE=$(((${KSIZE}+${ISIZE}+6000000)/1048576)) FREE=$((${DISKSIZE}-${IMAGESIZE})) -FREE=$((${FREE}/1048576)) -# create bootable vfat at the end of the device -sfdisk /dev/${OUT_DEV} -uM << EOF +# create bootable vfat at the end of the device if big enough, otherwise use +# the entire device +if [ ${FREE} -ge 50 ] ; then + sfdisk /dev/${OUT_DEV} -uM << EOF ,${FREE},L, ,,6,* EOF +else + sfdisk /dev/${OUT_DEV} << EOF +,,6,* +EOF +fi # create bootable vfat partition with 96cylinders and a ext3 partition for the # rest of the stick @@ -98,5 +110,7 @@ sync umount /media/openslx-stick umount /media/openslx-stick-usrhome +rm -rf /media/openslx-stick* + ${SYSLINUX}/linux/syslinux --install -d /boot -f /dev/${OUT_DEV}2 |