summaryrefslogtreecommitdiff
path: root/0_format.sh
blob: 9438b3e046791ac29a435e1fbf2537809b621f44 (plain)
  1. #!/bin/sh
  2. set -e
  3. . ./common-setting || exit 1
  4. . ./common-functions || exit 1
  5. #sfdisk -l "$usbdev_host"
  6. #TODO: Ask if you really want to erase shown partitions
  7. # FIXME: Loop and generate partition table dynamically
  8. # (current code assumes alot of stuff about chosen bootloaders)
  9. # Partition, initialize and mount flash disk
  10. # (Some BIOSes rumored to boot only sticks with specific drive geometry)
  11. # (Some BIOSes, including oldest VIA EPIA mobos, require the -D option)
  12. # (Add "1" in front of first comma if you want room for GRUB stage 1.5)
  13. if [ "$MULTIPLE_BOOTLOADERS" = "yes" ] || [ "$INCOMPATIBLE_FS" = "yes" ]; then
  14. # echo -e ',5,06,*\n,,L' | sfdisk -uM -D -C 125 -H 64 "$usbdev_host"
  15. echo -e ',7,06,*\n,,L' | sfdisk -uM -D "$usbdev_host"
  16. mkdosfs "$bootdev_host"
  17. mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host"
  18. # FIXME: untested if GRUB properly supports vfat...
  19. # mkdir "$mountpoint/boot"
  20. # mount "$bootdev_host" "$mountpoint/boot"
  21. else
  22. # echo ',,L' | sfdisk -D -C 125 -H 64 -D "$usbdev_host"
  23. echo ',,L,*' | sfdisk -D "$usbdev_host"
  24. mke2fs "$rootdev_host" && tune2fs -m0 "$rootdev_host"
  25. fi
  26. echo 'Done formatting target device!'