bin: improve stick handling
This commit is contained in:
parent
87a38aaccd
commit
3e0e10a41a
|
@ -3,12 +3,14 @@
|
|||
set -eo pipefail
|
||||
_help="$0 <device> [mountpoint] [options...]"
|
||||
case $1 in
|
||||
(-v) shift
|
||||
bash -x "$0" "$@";;
|
||||
("") # TODO include size
|
||||
arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint |
|
||||
grep -v '/' | grep ".\+ [^ ]\+" | fzf --select-1 --exit-0 |
|
||||
sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");;
|
||||
("--help") echo "$_help" && exit 0;;
|
||||
("-u") shift
|
||||
(--help) echo "$_help" && exit 0;;
|
||||
(-u) shift
|
||||
for last; do true; done
|
||||
sudo umount --verbose "$@"
|
||||
code=$?
|
||||
|
@ -46,7 +48,8 @@ shift $(expr 2 \& $# \> 2 \| $#)
|
|||
#uid=$(id --user),gid=$(id --group), \
|
||||
if ! mountpoint "$mountpoint" 2>/dev/null
|
||||
then mp="/run/media/$USER/$arg" && test -e "$mp" && mountpoint="$mp"
|
||||
sudo mount -vo users,X-mount.mkdir,noatime,umask=003,gid=users,uid=$USER $partition $mountpoint "$@"
|
||||
sudo mount -vo users,X-mount.mkdir,noatime,umask=003,gid=users,uid=$USER $partition $mountpoint "$@" ||
|
||||
sudo mount -vo users,X-mount.mkdir,noatime $partition $mountpoint "$@"
|
||||
fi
|
||||
cd $mountpoint
|
||||
exec $SHELL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
#!/bin/sh -ex
|
||||
# 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
|
||||
|
@ -6,9 +6,14 @@ if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type
|
|||
then echo "Please mount your multiboot stick first!"
|
||||
exit 1
|
||||
fi
|
||||
test $# -eq 0 || mv -vi "$@" "$dir/LINUX"
|
||||
find "$dir" -iname "*32-*.iso" -exec mv -vi {} {}def32 \;
|
||||
find "$dir" -iname "*.iso" -exec mv -vi {} {}def64 \;
|
||||
drive=$(mount | grep "$(basename "$dir")" | cut -d' ' -f1)
|
||||
|
||||
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)
|
||||
sudo umount $drive
|
||||
sudo udefrag $drive
|
||||
|
|
Loading…
Reference in New Issue