sábado, 19 de dezembro de 2015

HOW TO MOUNT APPLE TIMECAPSULE STORAGE ON LINUX

First, execute: apt-get install cifs-utils

After create this file on your folder: vi /usr/local/bin/timecapsule

 Put this code:

#!/bin/bash
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#

# Version 3, enhanced for Ubuntu 13.X+, Fedora 19+, and similar distros.
# Runs on all GNU/Linux distros (install cifs-utils)

# Author: Daniel Graziotin <dgraziotin AT task3 DOT cc> - http://task3.cc
# Purpose: Check if there is a TimeCapsule in your network and mount it
#     for use it under Gnu/Linux. Unmount it if it is already mounted.
#       The mount point is created and destroyed after use (for prevent
#       automatic backup software to backup in the directory if the device
#       is not mounted)
# Instructions:
#   1) Install cifs-utils (sudo apt-get install cifs-utils)
#        1) Change the first four variables according to your configuration.
#        2) Run this program at boot when your network is already
#           set up. Also, run it on logoff to umount Time Capsule.

TIMECAPSULE_IP="time capsule ip"                         # e.g. "192.168.1.100"
TIMECAPSULE_VOLUME="<first volume>"       # also try "/Data"
TIMECAPSULE_PASSWORD="your pass"   # prefix special characters, e.g. \!
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
        echo "mount.cifs $TIMECAPSULE_PATH $MOUNT_POINT -o pass=$TIMECAPSULE_PASSWORD,file_mode=0777,dir_mode=0777,sec=ntlm" | /bin/bash
    fi
fi
 ##############end script#############################

chmod +x timecapsule



After that start script ./usr/local/bin/timecapsule

Obs.: If you need umount something, just execute the script again, worked very fine.

Congratulations for my friend: Daniel Graziotin
source: https://ineed.coffee/418/how-to-automatically-mount-and-umount-apple-time-capsule-on-linux/

2 comentários:

  1. Recently I have come across this blog here. What I felt about it as every posts are good and relevant in nature and content.

    ResponderExcluir
  2. Thank you so much for sharing This post. It's gretful blog I have really enjoyed keeping up with you on this blog

    ---------
    Free open vpn​

    ResponderExcluir