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.

107 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. if [ -z $usb -o -z $size ]
  7. then
  8. echo "Usage: sudo ./prepare-usb.sh <device> <size>"
  9. exit 1
  10. fi
  11. if [ $size -eq 16 -o $size -eq 32 ]
  12. then
  13. echo "Working with $size GB disk..."
  14. else
  15. echo "Usage: sudo ./prepare-usb.sh <device> <size>"
  16. echo " <size> should be 16 or 32"
  17. exit 1
  18. fi
  19. if [ $UID -gt 0 ]
  20. then
  21. echo "Please run as root."
  22. echo "Usage: sudo ./prepare-usb.sh <device>"
  23. exit 1
  24. fi
  25. OS_FOR_16GB="
  26. alpine-standard-3.15.0-x86_64.iso*
  27. debian-11.2.0-amd64-netinst.iso*
  28. zdebian-firmware-11.2.0-amd64-netinst.iso*
  29. Fedora-Workstation-Live-x86_64-35-1.2.iso*
  30. guix-system-install-1.3.0.x86_64-linux.iso*
  31. LibreELEC-Generic.x86_64-10.0.1.img*
  32. manjaro-kde-21.2.1-minimal-220103-linux515.iso*
  33. netboot.xyz.iso*
  34. openwrt-21.02.0-x86-64-generic-ext4-combined.img*
  35. proxmox-ve_7.1-2.iso*
  36. systemrescue-9.00-amd64.iso*
  37. tails-amd64-4.26.img*
  38. trisquel-mini_10.0_amd64.iso*
  39. ubuntu-20.04.3-desktop-amd64.iso*"
  40. OS_FOR_32GB="
  41. alpine-standard-3.15.0-x86_64.iso*
  42. debian-11.2.0-amd64-netinst.iso*
  43. devuan_chimaera_4.0.0_amd64_desktop-live.iso*
  44. zdebian-firmware-11.2.0-amd64-netinst.iso*
  45. Fedora-Workstation-Live-x86_64-35-1.2.iso*
  46. guix-system-install-1.3.0.x86_64-linux.iso*
  47. haiku-r1beta3-x86_64-anyboot.iso*
  48. LibreELEC-Generic.x86_64-10.0.1.img*
  49. manjaro-kde-21.2.2-220123-linux515.iso*
  50. netboot.xyz.iso*
  51. openwrt-21.02.0-x86-64-generic-ext4-combined.img*
  52. proxmox-ve_7.1-2.iso*
  53. Qubes-R4.0.4-x86_64.iso*
  54. systemrescue-9.00-amd64.iso*
  55. tails-amd64-4.26.img*
  56. trisquel-mini_10.0_amd64.iso*
  57. ubuntu-20.04.3-desktop-amd64.iso*"
  58. RPi="
  59. 2021-10-30-raspios-bullseye-armhf-lite.zip
  60. LibreELEC-RPi4.arm-10.0.1.img.gz"
  61. TOOLS="
  62. balenaEtcher-1.7.3-x64.AppImage*
  63. balenaEtcher-Portable-1.7.3.exe*
  64. ungoogled-chromium_91.0.4472.164-1.1.AppImage*"
  65. ## Install Ventoy
  66. if [ $size -eq 16 ]
  67. then
  68. ventoy -i /dev/$usb -L MH-USB -I -g
  69. sleep 20
  70. OS=$OS_FOR_16GB
  71. else
  72. ventoy -i /dev/$usb -L MH-USB -I -g -r 1500
  73. sleep 20
  74. OS=$OS_FOR_32GB
  75. fi
  76. ## Copy ISOs
  77. mkdir -p /mnt/mhusb/
  78. mount /dev/$part /mnt/mhusb
  79. mkdir -p /mnt/mhusb/{OS,Tools}
  80. cd MH-USB/OS/
  81. time $rsync $OS /mnt/mhusb/OS/
  82. cd ../Tools/
  83. time $rsync $TOOLS /mnt/mhusb/Tools/
  84. cd ../
  85. time $rsync ventoy /mnt/mhusb
  86. if [ $size -eq 32 ]
  87. then
  88. cd RPi/
  89. mkdir -p /mnt/mhusb/RPi/
  90. $rsync $RPi /mnt/mhusb/RPi/
  91. fi
  92. echo "Done."