The Mostly Harmless USB Disk https://mostlyharmless.io/usb/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
2.4 KiB

  1. #!/bin/bash
  2. usb=$1
  3. size=$2
  4. part=`echo $usb`1
  5. rsync="rsync --delete -rvtDW --progress --modify-window=1"
  6. ventoy="./ventoy/Ventoy2Disk.sh"
  7. if [ -z $usb -o -z $size ]
  8. then
  9. echo "Usage: sudo ./prepare-usb.sh <device> <size>"
  10. exit 1
  11. fi
  12. if [ $size -eq 16 -o $size -eq 32 ]
  13. then
  14. echo "Working with $size GB disk..."
  15. else
  16. echo "Usage: sudo ./prepare-usb.sh <device> <size>"
  17. echo " <size> should be 16 or 32"
  18. exit 1
  19. fi
  20. if [ $UID -gt 0 ]
  21. then
  22. echo "Please run as root."
  23. echo "Usage: sudo ./prepare-usb.sh <device>"
  24. exit 1
  25. fi
  26. OS_FOR_16GB="
  27. alpine-standard-3.16.2-x86_64.iso*
  28. debian-11.5.0-amd64-netinst.iso*
  29. Fedora-Workstation-Live-x86_64-36-1.5.iso*
  30. guix-system-install-1.3.0.x86_64-linux.iso*
  31. manjaro-kde-21.3.7-220816-linux515.iso*
  32. netboot.xyz.iso*
  33. openwrt-22.03.2-x86-64-generic-ext4-combined.img*
  34. proxmox-ve_7.2-1.iso*
  35. systemrescue-9.05-amd64.iso*
  36. tails-amd64-5.6.img*
  37. trisquel-mini_10.0.1_amd64.iso*
  38. ubuntu-22.04.1-desktop-amd64.iso*
  39. zdebian-firmware-11.5.0-amd64-netinst.iso*
  40. "
  41. OS_FOR_32GB="
  42. alpine-standard-3.16.2-x86_64.iso*
  43. debian-11.5.0-amd64-DVD-1.iso*
  44. debian-11.5.0-amd64-netinst.iso*
  45. devuan_chimaera_4.0.0_amd64_netinstall.iso*
  46. Fedora-Workstation-Live-x86_64-36-1.5.iso*
  47. guix-system-install-1.3.0.x86_64-linux.iso*
  48. manjaro-kde-21.3.7-220816-linux515.iso*
  49. netboot.xyz.img*
  50. netboot.xyz.iso*
  51. openwrt-22.03.2-x86-64-generic-ext4-combined.img*
  52. pop-os_22.04_amd64_intel_16.iso*
  53. proxmox-ve_7.2-1.iso*
  54. Qubes-R4.1.1-x86_64.iso*
  55. systemrescue-9.05-amd64.iso*
  56. tails-amd64-5.6.img*
  57. trisquel_10.0.1_amd64.iso*
  58. ubuntu-22.04.1-desktop-amd64.iso*
  59. LibreELEC-Generic.x86_64-10.0.3.img*
  60. zdebian-firmware-11.5.0-amd64-netinst.iso*
  61. "
  62. RPi="
  63. 2022-09-22-raspios-bullseye-arm64-lite.img.xz
  64. 2022-09-22-raspios-bullseye-armhf-lite.img.xz
  65. "
  66. TOOLS="
  67. balenaEtcher-1.7.9-x64.AppImage
  68. balenaEtcher-Setup-1.7.9.exe
  69. ungoogled-chromium_107.0.5304.68-1.1.AppImage
  70. "
  71. ## Install Ventoy
  72. if [ $size -eq 16 ]
  73. then
  74. $ventoy -i /dev/$usb -L MH-USB -I -g
  75. sleep 20
  76. OS=$OS_FOR_16GB
  77. else
  78. $ventoy -i /dev/$usb -L MH-USB -I -g
  79. sleep 20
  80. OS=$OS_FOR_32GB
  81. fi
  82. ## Copy ISOs
  83. mkdir -p /mnt/mhusb/
  84. mount /dev/$part /mnt/mhusb
  85. mkdir -p /mnt/mhusb/{OS,Tools}
  86. cd MH-USB/OS/
  87. time $rsync $OS /mnt/mhusb/OS/
  88. cd ../Tools/
  89. time $rsync $TOOLS /mnt/mhusb/Tools/
  90. cd ../
  91. time $rsync ventoy /mnt/mhusb
  92. #if [ $size -eq 32 ]
  93. #then
  94. # cd RPi/
  95. # mkdir -p /mnt/mhusb/RPi/
  96. # $rsync $RPi /mnt/mhusb/RPi/
  97. #fi
  98. echo "Done."