Skip to content

Instantly share code, notes, and snippets.

@erikvanoosten
Created November 3, 2013 19:35
Show Gist options
  • Save erikvanoosten/7293883 to your computer and use it in GitHub Desktop.
Save erikvanoosten/7293883 to your computer and use it in GitHub Desktop.
TIMECAPSULE_IP="" # e.g. "192.168.1.100"
TIMECAPSULE_VOLUME="/Time Capsule" # also try "/Data"
export PASSWD='YOURPASSWORDHERE' # No need to escape anything (except "'")
MOUNT_POINT="/mnt/timecapsule" # no need to create the directory
IS_MOUNTED=`mount 2> /dev/null | grep "$MOUNT_POINT" | cut -d' ' -f3`
TIMECAPSULE_PATH="//$TIMECAPSULE_IP$TIMECAPSULE_VOLUME"
if [[ "$IS_MOUNTED" ]] ;then
umount $MOUNT_POINT
rmdir $MOUNT_POINT
else
CHECK_TIMECAPSULE=`smbclient --no-pass -L "$TIMECAPSULE_IP" 2>&1 > /dev/null | grep -m1 -i apple`
if [[ "$CHECK_TIMECAPSULE" =~ "Apple" ]] ;then
mkdir "$MOUNT_POINT"
mount -t cifs "$TIMECAPSULE_PATH" "$MOUNT_POINT" -o file_mode=0777,dir_mode=0777,sec=ntlm
fi
fi
unset PASSWD
@smeuldersp
Copy link

Thank you Erik van Oosten, I just run your program for the linux mint system installed on the PC and it worked straight away. the only problem was that I had to mount on my personal files and not on those of root.
Paul Smeulders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment