about summary refs log tree commit diff stats
path: root/sys/nixpkgs/pkgs/scripts/source/apps/aumo.sh
blob: 84d39debe3983c71ddea08e834df5d490ad889fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env dash

# shellcheck source=/dev/null
SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH

unmounting() {
    disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")"

    udisksctl unmount --block-device "/dev/disk/by-label/$disk_name"
}

mounting() {
    disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")"

    udisksctl mount --block-device "/dev/disk/by-label/$disk_name"
}

case "$1" in
"mount")
    mounting
    ;;
"unmount" | "umount")
    unmounting
    ;;
*)
    die "Usage: $NAME mount|unmount"
    ;;
esac