Skip to content

Instantly share code, notes, and snippets.

@irae
Created April 1, 2010 18:59
Show Gist options
  • Save irae/352225 to your computer and use it in GitHub Desktop.
Save irae/352225 to your computer and use it in GitHub Desktop.
#!/bin/bash
## script to connect to indecent webdav implementations using wdfs
## on macosx with macfuse
## user config
user="o_seu"
pass="aprils_fools"
mount_to="/Remote/"
#mount_to="/Volumes/"
# Handles the cache
cache="-o auto_cache"
if [ "$3" == "nocache" ]
then
cache="-o noauto_cache -o nolocalcaches"
fi
# Haldle input vars
server=$1
if [ "$2" != "" ]
then
folder=$2
else
folder=$1
fi
# special case for omiting second parameter
# and using no cache
if [ "$2" == "nocache" ]
then
folder=$1
cache="-o noauto_cache -o nolocalcaches"
fi
# make the giant command line easyer to read
basic_config="-o accept_sslcert -o noappledouble -o noapplexattr"
user_config="-o username=$user -o password=$pass"
paths_config="https://upload3.intranet/$server/ $mount_to$folder/ -o volname=$folder"
# if the mount point doesn't exist, create it
echo
#echo "mkdir -p $mount_to$folder/"
mkdir -p $mount_to$folder/
sleep 0.3
#echo
# connect \o/
#echo "wdfs $paths_config $user_config $basic_config $cache"
wdfs $paths_config $user_config $basic_config $cache
echo
# if we don't wait the folder opened is "Computer" and not the connected drive
#sleep 1
# open the folder in Finder
#open $mount_to$folder/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment