#!/bin/sh
# postinst script for indi-gphoto

if [ -f "/usr/share/gvfs/mounts/gphoto2.mount" ] ;
then
    echo "Removing GVFS GPhoto2 mount files which conflict with INDI GPhoto driver. You need to restart your system for this to take effect."
    # JM: This usually doesn't work, but let's run it anyway
    dbus-launch --exit-with-session gsettings set org.gnome.desktop.media-handling automount false 2> /dev/null
    # JM: Above command usually does not prevent Gnome/Mate from automounting the camera anyway, so we resort to forcefully remove the following files to get the god damn thing to behave. I do not like this solution so if there is a better solution.
    rm -f "/usr/share/gvfs/mounts/gphoto2.mount" 2> /dev/null
    rm -f "/usr/share/dbus-1/services/org.gtk.Private.GPhoto2VolumeMonitor.service" 2> /dev/null
    rm -f "/usr/share/gvfs/remote-volume-monitors/gphoto2.monitor" 2> /dev/null
    rm -f "/usr/lib/gvfs/gvfs-gphoto2-volume-monitor" 2> /dev/null
fi
