What this script does is, check the gateway mac address to find out if you are within your lan or in a different place. If at home, mount a share as normal. If away, mount that share as a ssh file system.
#!/bin/bash
gateway=$(ip route show 0.0.0.0/0 | awk '{print $3}')
mactest=$(arp -n -a $gateway | awk '{print $4}')
targetmac="XX:XX:XX:XX:XX:XX"
homeup="mount -t cifs -o username=USER,password=PASSWORD //SERVER/SHARE /mnt/remote"
awayup="sshfs my.dyndns.tld:/path/to/share /mnt/remote"
down="umount -l /mnt/remote"
if [ $mactest==$targetmac ]
then
case "$2" in
up)
$homeup
;;
down)
$down
;;
esac
else
case "$2" in
up)
$awayup
;;
down)
$down
;;
esac
fi
exit $?