feat: am and dm mount scripts
This commit is contained in:
parent
57fd4f9fab
commit
dbd7223f08
7 changed files with 52 additions and 9 deletions
18
bin/am
Executable file
18
bin/am
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# TODO
|
||||
# - mount all partitions by selecting disk
|
||||
# - hide already mounted partitions
|
||||
# - usage
|
||||
# - one device per line
|
||||
# - support for /mnt
|
||||
|
||||
readarray -t LSBLK <<< "$(lsblk -n --paths --list | grep part)"
|
||||
|
||||
select dev in "${LSBLK[@]}"; do
|
||||
name="$(cut -f1 -d' ' <<< "$dev")"
|
||||
|
||||
udisksctl mount -b "$name"
|
||||
echo "$name" >> /tmp/automount
|
||||
done
|
30
bin/dm
Executable file
30
bin/dm
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
function unmount() {
|
||||
local name
|
||||
|
||||
for dev in "$@"; do
|
||||
name="$(cut -f1 -d' ' <<< "$dev")"
|
||||
|
||||
umount "$name"
|
||||
sed -i "\\|$name|d" /tmp/automount
|
||||
done
|
||||
}
|
||||
|
||||
readarray -t LSBLK <<< "$(lsblk --paths --list | grep -f /tmp/automount)"
|
||||
|
||||
while getopts a o; do
|
||||
case "$o" in
|
||||
a)
|
||||
unmount "${LSBLK[@]}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
select dev in "${LSBLK[@]}"; do
|
||||
unmount "$dev"
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue