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