diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-04-25 22:08:38 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-04-25 22:10:10 +0530 |
commit | cefc4b08a7c368c8fe6b42fd20b699b580e7d917 (patch) | |
tree | 6ee4772314046cf09cc2b42cd60987fb5253f46c /plugins/nmount | |
parent | 9ac9c1bf4fa453920a4fa8eb2516e9725eb0ce12 (diff) | |
download | nnn-cefc4b08a7c368c8fe6b42fd20b699b580e7d917.tar.gz |
Update nmount, troubleshooting
Diffstat (limited to 'plugins/nmount')
-rwxr-xr-x | plugins/nmount | 8 |
1 files changed, 6 insertions, 2 deletions
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)". |