- #!/bin/sh
- set -e
- . ./config-DEFAULTS || exit 1
- . ./config-HOST || exit 1
- . ./config-TARGET || exit 1
- . ./config-MANDATED || exit 1
- . ./functions || exit 1
- #sfdisk -l "$usbdev_host"
- #TODO: Ask if you really want to erase shown partitions
- # FIXME: Loop and generate partition table dynamically
- # (current code assumes alot of stuff about chosen bootloaders)
- # Partition, initialize and mount flash disk
- # (Some BIOSes rumored to boot only sticks with specific drive geometry)
- # (Some BIOSes, including oldest VIA EPIA mobos, require the -D option)
- # (Add "1" in front of first comma if you want room for GRUB stage 1.5)
- if [ "$MULTIPLE_BOOTLOADERS" = "yes" ] || [ "$INCOMPATIBLE_FS" = "yes" ]; then
- # echo -e ',5,06,*\n,,L' | sfdisk -uM -D -C 125 -H 64 "$usbdev_host"
- echo -e ',7,06,*\n,,L' | sfdisk -uM -D "$usbdev_host"
- mkdosfs "$bootdev_host"
- mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host"
- # FIXME: untested if GRUB properly supports vfat...
- # mkdir "$mountpoint/boot"
- # mount "$bootdev_host" "$mountpoint/boot"
- else
- # echo ',,L' | sfdisk -D -C 125 -H 64 -D "$usbdev_host"
- echo ',,L,*' | sfdisk -D "$usbdev_host"
- mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host"
- fi
- echo 'Done formatting target device!'
|