Browse Source

Run nmount in a loop

master
Arun Prakash Jana 6 years ago
parent
commit
747490a180
No known key found for this signature in database GPG Key ID: A75979F35C080412
1 changed files with 19 additions and 17 deletions
  1. +19
    -17
      plugins/nmount

+ 19
- 17
plugins/nmount View File

@@ -12,22 +12,24 @@ echo
echo -n "device (e.g. sdc2): " echo -n "device (e.g. sdc2): "
read dev read dev


if [ -z "$dev" ]; then while ! [ -z "$dev" ]
exit 1 do
fi if grep -qs "$dev " /proc/mounts; then

sync
echo pumount "$dev"

if [ "$?" -eq "0" ]; then
if grep -qs "$dev " /proc/mounts; then echo "$dev" unmounted.
sync udisksctl power-off -b /dev/"$dev"
pumount "$dev" if [ "$?" -eq "0" ]; then
if [ "$?" -eq "0" ]; then echo "$dev" ejected.
udisksctl power-off -b /dev/"$dev" fi
echo $dev ejected. fi
else
pmount "$dev"
echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".
fi fi
else
pmount "$dev"
echo "$dev" mounted to "$(lsblk -n /dev/"$dev" | rev | cut -d' ' -f1 | rev)".
fi


read dummy echo
echo -n "next device: "
read dev
done

||||||
x
 
000:0
Loading…
Cancel
Save