dotfiles/.local/bin/scripts/update-e2b

20 lines
650 B
Plaintext
Raw Normal View History

2022-11-23 01:28:30 +00:00
#!/bin/sh -ex
2022-01-08 20:47:30 +00:00
# Update an Easy2Boot USB Stick after adding ISOs
# Call with Linux ISOs to be copied as args
# Need to be around E2B mountpoint if it is not the default
2022-11-09 17:52:27 +00:00
if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)"
then echo "Please mount your multiboot stick first!"
exit 1
fi
2022-11-23 01:28:30 +00:00
cmd=mv
case $1 in
(-cp) cmd=cp; shift;;
esac
test $# -eq 0 || $cmd -vi "$@" "$dir/LINUX"
find "$dir" -type f -iname "*32-*.iso" -exec mv -vi {} {}def32 \;
find "$dir" -type f -iname "*.iso" -exec mv -vi {} {}def64 \;
drive=$(mount | grep "$(dirname "$dir")" | cut -d' ' -f1)
2022-01-08 20:47:30 +00:00
sudo umount $drive
sudo udefrag $drive