diff --git a/.config/shell/functions b/.config/shell/functions index b284ae4..95e030b 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -359,7 +359,6 @@ mvx() { yadm add "$1" ".config/$1" 2>/dev/null } - # Create directory and move into it mkcd() { mkdir -p "$1" && cd "$1" @@ -370,9 +369,10 @@ mkcd() { umoul() { if test "$1" then arg="$1" - mountpoint="$(test -d "$arg" && realpath "$arg" || echo "${XDG_RUNTIME_DIR}/mnt/$arg")" + mountpoint="$(test -d "$arg" && realpath "$arg" || echo "${MNT:-${XDG_RUNTIME_DIR}/mnt}/$arg")" mountpoint "$mountpoint" 2>/dev/null || test -b "$mountpoint" || mountpoint="$(mount --show-labels | grep "$arg" | cut -d' ' -f3)" + test "$mountpoint" || return 1 else mountpoint="$PWD" while test "$mountpoint" != "/"; do mountpoint "$mountpoint" >/dev/null && break diff --git a/.local/bin/scripts/moul b/.local/bin/scripts/moul index fdfaa0b..d89a727 100755 --- a/.local/bin/scripts/moul +++ b/.local/bin/scripts/moul @@ -11,7 +11,7 @@ then exit $code fi -if grep -e "LABEL=$arg[^\w/]" /etc/fstab +if grep -e "^LABEL=$arg[^\w/]" /etc/fstab then mount -L "$@"; exit $? fi if grep -e "[^\w=/]$arg[^\w/]" /etc/fstab diff --git a/.local/bin/scripts/update-e2b b/.local/bin/scripts/update-e2b new file mode 100755 index 0000000..35b9b7b --- /dev/null +++ b/.local/bin/scripts/update-e2b @@ -0,0 +1,9 @@ +#!/bin/sh +# Update an Easy2Boot USB Stick after adding ISOs +# To be called with target as arg +dir="${1:-${MNT:-${XDG_RUNTIME_DIR}/mnt}/E2B}" +find "$dir" -name "*32-*.iso" -exec mv -v {} {}def32 \; +find "$dir" -name "*.iso" -exec mv -v {} {}def64 \; +drive=$(mount | grep "$dir" | cut -d' ' -f1) +sudo umount $drive +sudo udefrag $drive