From cefc4b08a7c368c8fe6b42fd20b699b580e7d917 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Thu, 25 Apr 2019 22:08:38 +0530 Subject: Update nmount, troubleshooting --- plugins/nmount | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/nmount b/plugins/nmount index e08966a..ce9f99e 100755 --- a/plugins/nmount +++ b/plugins/nmount @@ -1,7 +1,8 @@ #!/usr/bin/env sh # Description: Toggle mount status of a device using pmount -# If the device is mounted, it will be unmounted and vice versa. +# If the device is not mounted, it will be mounted. +# If the device is mounted, it will be unmounted and powered down. # # Shell: POSIX compliant # Author: Arun Prakash Jana @@ -19,7 +20,10 @@ echo if grep -qs "$dev " /proc/mounts; then pumount "$dev" - echo $dev unmounted. + if [ "$?" -eq "0" ]; then + udisksctl power-off -b /dev/"$dev" + echo $dev ejected. + fi else pmount "$dev" echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)". -- cgit v1.2.3-70-g09d2