|
|
- #!/bin/bash
-
- usb=$1
- size=$2
- part=`echo $usb`1
- rsync="rsync --delete -rvtDW --progress --modify-window=1"
-
- if [ -z $usb -o -z $size ]
- then
- echo "Usage: sudo ./prepare-usb.sh <device> <size>"
- exit 1
- fi
-
- if [ $size -eq 16 -o $size -eq 32 ]
- then
- echo "Working with $size GB disk..."
- else
- echo "Usage: sudo ./prepare-usb.sh <device> <size>"
- echo " <size> should be 16 or 32"
- exit 1
- fi
-
- if [ $UID -gt 0 ]
- then
- echo "Please run as root."
- echo "Usage: sudo ./prepare-usb.sh <device>"
- exit 1
- fi
-
- OS_FOR_16GB="
- alpine-standard-3.15.0-x86_64.iso*
- debian-11.2.0-amd64-netinst.iso*
- zdebian-firmware-11.2.0-amd64-netinst.iso*
- Fedora-Workstation-Live-x86_64-35-1.2.iso*
- guix-system-install-1.3.0.x86_64-linux.iso*
- LibreELEC-Generic.x86_64-10.0.1.img*
- manjaro-kde-21.2.1-minimal-220103-linux515.iso*
- netboot.xyz.iso*
- openwrt-21.02.0-x86-64-generic-ext4-combined.img*
- proxmox-ve_7.1-2.iso*
- systemrescue-9.00-amd64.iso*
- tails-amd64-4.26.img*
- trisquel-mini_10.0_amd64.iso*
- ubuntu-20.04.3-desktop-amd64.iso*"
-
- OS_FOR_32GB="
- alpine-standard-3.15.0-x86_64.iso*
- debian-11.2.0-amd64-netinst.iso*
- devuan_chimaera_4.0.0_amd64_desktop-live.iso*
- zdebian-firmware-11.2.0-amd64-netinst.iso*
- Fedora-Workstation-Live-x86_64-35-1.2.iso*
- guix-system-install-1.3.0.x86_64-linux.iso*
- haiku-r1beta3-x86_64-anyboot.iso*
- LibreELEC-Generic.x86_64-10.0.1.img*
- manjaro-kde-21.2.2-220123-linux515.iso*
- netboot.xyz.iso*
- openwrt-21.02.0-x86-64-generic-ext4-combined.img*
- proxmox-ve_7.1-2.iso*
- Qubes-R4.0.4-x86_64.iso*
- systemrescue-9.00-amd64.iso*
- tails-amd64-4.26.img*
- trisquel-mini_10.0_amd64.iso*
- ubuntu-20.04.3-desktop-amd64.iso*"
-
- RPi="
- 2021-10-30-raspios-bullseye-armhf-lite.zip
- LibreELEC-RPi4.arm-10.0.1.img.gz"
-
- TOOLS="
- balenaEtcher-1.7.3-x64.AppImage*
- balenaEtcher-Portable-1.7.3.exe*
- ungoogled-chromium_91.0.4472.164-1.1.AppImage*"
-
- ## Install Ventoy
- if [ $size -eq 16 ]
- then
- ventoy -i /dev/$usb -L MH-USB -I -g
- sleep 20
- OS=$OS_FOR_16GB
- else
- ventoy -i /dev/$usb -L MH-USB -I -g -r 1500
- sleep 20
- OS=$OS_FOR_32GB
- fi
-
- ## Copy ISOs
- mkdir -p /mnt/mhusb/
- mount /dev/$part /mnt/mhusb
- mkdir -p /mnt/mhusb/{OS,Tools}
-
- cd MH-USB/OS/
- time $rsync $OS /mnt/mhusb/OS/
-
- cd ../Tools/
- time $rsync $TOOLS /mnt/mhusb/Tools/
-
- cd ../
- time $rsync ventoy /mnt/mhusb
-
- if [ $size -eq 32 ]
- then
- cd RPi/
- mkdir -p /mnt/mhusb/RPi/
- $rsync $RPi /mnt/mhusb/RPi/
- fi
-
- echo "Done."
|