feat: simplify vol, light and am

This commit is contained in:
ange 2024-04-25 15:43:28 +02:00
parent 57243c81fa
commit 47c176f3bc
Signed by: ange
GPG key ID: 9E0C4157BB7BEB1D
3 changed files with 46 additions and 66 deletions

View file

@ -1,10 +1,5 @@
#!/bin/bash -e
# TODO
# mount all partitions by selecting disk
# usage
# support for /mnt
function get_row() {
local row _col
@ -22,27 +17,23 @@ function clear_output() {
done
}
function main() {
while true; do
mapfile -t LSBLK <<< "$(lsblk -n --paths --list | grep part)"
COLUMNS=1
select dev in "${LSBLK[@]}"; do
if [ -z "$dev" ]; then
clear_output
break
fi
name="$(awk '{print $1}' <<< "$dev")"
while true; do
mapfile -t LSBLK <<< "$(lsblk -n --paths --list | grep part)"
COLUMNS=1
select dev in "${LSBLK[@]}"; do
if [ -z "$dev" ]; then
clear_output
if mount | grep -q "$name"; then
umount "$name"
else
udisksctl mount -b "$name" > /dev/null
fi
break
done || exit
done
}
fi
name="$(awk '{print $1}' <<< "$dev")"
main "$@"
clear_output
if mount | grep -q "$name"; then
umount "$name"
else
udisksctl mount -b "$name" > /dev/null
fi
break
done || exit
done