tweaked automountctl

added some comments
added some helpfull output
some indentation
This commit is contained in:
Tobias Kessels
2018-02-14 14:36:04 +01:00
parent 07ede2792a
commit b2149bc7aa

View File

@@ -1,19 +1,23 @@
#!/bin/bash #!/bin/bash
command="${1}" command="${1}"
# test if gsettings tool is installed
if ! (which gsettings 1>/dev/null) ; then if ! (which gsettings 1>/dev/null) ; then
echo "need gsettings" echo "need gsettings"
exit 1 exit 1
fi fi
#test for existing mate settings
if (gsettings get org.mate.media-handling automount 1>/dev/null) ; then if (gsettings get org.mate.media-handling automount 1>/dev/null) ; then
mate=1 mate=1
fi fi
#test for existing gnome settings
if (gsettings get org.gnome.desktop.media-handling automount 1>/dev/null) ; then if (gsettings get org.gnome.desktop.media-handling automount 1>/dev/null) ; then
gnome=1 gnome=1
fi fi
#test if at least one of the known settings where found
if [ -z $mate ] && [ -z $gnome ] ; then if [ -z $mate ] && [ -z $gnome ] ; then
echo "No supported Settings found" echo "No supported Settings found"
echo "mate : org.mate.media-handling automount" echo "mate : org.mate.media-handling automount"
@@ -45,23 +49,28 @@ gsettings set org.gnome.desktop.media-handling automount-open false
fi fi
;; ;;
*) *)
echo "status" echo "Status:"
if [ $mate -eq "1" ] ; then if [ $mate -eq "1" ] ; then
echo "# mate-settings found" echo "# mate-settings found:"
echo "## org.mate.media-handling automount :" echo " - org.mate.media-handling automount :"
echo -n " "
gsettings get org.mate.media-handling automount gsettings get org.mate.media-handling automount
echo "## org.mate.media-handling automount-open :" echo " - org.mate.media-handling automount-open :"
echo -n " "
gsettings get org.mate.media-handling automount-open gsettings get org.mate.media-handling automount-open
fi fi
if [ $gnome -eq "1" ] ; then if [ $gnome -eq "1" ] ; then
echo "# gnome-settings found" echo "# gnome-settings found:"
echo "## org.gnome.desktop.media-handling automount :" echo " - org.gnome.desktop.media-handling automount :"
echo -n " "
gsettings get org.gnome.desktop.media-handling automount gsettings get org.gnome.desktop.media-handling automount
echo "## org.gnome.desktop.media-handling automount-open :" echo " - org.gnome.desktop.media-handling automount-open :"
echo -n " "
gsettings get org.gnome.desktop.media-handling automount-open gsettings get org.gnome.desktop.media-handling automount-open
fi fi
echo "-------------------"
echo "usage:"
echo " $0 on : turn on automount"
echo " $0 off : turn off automount"
esac esac