config/shell: improve mount handling
This commit is contained in:
parent
675304b919
commit
899b023b81
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue