mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
69 lines
1.1 KiB
Bash
Executable File
69 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# This script will make a bootable
|
|
# USB/drive/SD, etc.. from given ISO.
|
|
|
|
[ -z "$1" ] && echo "Usage: $0 <path to iso/img>" && exit
|
|
|
|
if [ ! -f "$1" ]
|
|
then
|
|
echo "File $1 doesn't exist."
|
|
exit
|
|
fi
|
|
|
|
echo "$1" > /tmp/image
|
|
image=$(cat /tmp/image)
|
|
prepare() {
|
|
for dev in $(ls /sys/block|grep -E '^([sv]|xv)d|mmcblk|nvme'); do
|
|
echo $dev
|
|
done
|
|
|
|
|
|
clear
|
|
lsblk |grep sd*|egrep -v "sr|├─|└" >/tmp/drives
|
|
awk '{print "/dev/" $0}' /tmp/drives >/tmp/newdrives
|
|
|
|
drives=$(cat /tmp/newdrives)
|
|
}
|
|
|
|
selection() {
|
|
echo -e "DRIVES\n======"
|
|
echo "$drives"
|
|
|
|
echo -e "\n\nWhich one do you want to use? (/dev/sdb)"
|
|
read chosen
|
|
[ "$chosen" = "" ] && chosen="/dev/sdb" && check2 || check2
|
|
}
|
|
|
|
check2() {
|
|
if ls $chosen ; then
|
|
pressy
|
|
else
|
|
clear
|
|
echo "Drive $chosen doesn't exist."
|
|
selection
|
|
fi
|
|
}
|
|
|
|
pressy() {
|
|
read -n1 -p "WARNING!! By pressing [y] your selected drive will be wiped (Press [n] to abort.)" sure
|
|
if [[ "$sure" = "y" ]] ; then
|
|
burn
|
|
elif [[ "$sure" = "n" ]] ; then
|
|
clear
|
|
echo "Aborting."
|
|
exit
|
|
else
|
|
pressy
|
|
fi
|
|
}
|
|
|
|
burn() {
|
|
clear
|
|
echo "$image is $(du -bsh $image | awk '{print $1}')s"
|
|
sudo dd bs=4M if=$image of=$chosen status=progress oflag=sync
|
|
}
|
|
|
|
check
|
|
prepare
|
|
selection
|