Last active
February 19, 2017 19:29
-
-
Save D3MZ/a9c8f8c82f06ed7cbfa763a7ed925f1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this won't work as a script as you'll get user prompts that you should read. Just run each line individually. | |
#this is a blend of what's found on google, but re-arranged into a faster deploy. | |
#via: https://www.howtogeek.com/276468/how-to-use-a-raspberry-pi-as-a-networked-time-machine-drive-for-your-mac/ | |
#and: http://www.techradar.com/how-to/computing/how-to-make-a-mac-time-capsule-with-the-raspberry-pi-1319989 | |
# On your mac, make sure the USB hard drive is HFS+ (The better filesystems are more annoying to work with on Mac), with the appropriate permissions. | |
# In terminal write: "chmod 777 /Volumes/Time\ Machine && ls -l /Volumes" (Replace "Time\ Machine" with whatever your drive is called) | |
# You can connect the drive to your pi now. | |
#update system | |
sudo apt-get update && sudo apt-get upgrade | |
#read hfs+ filesystem (the one OSX & Mac OS uses) | |
sudo apt-get install hfsprogs hfsplus | |
#install, make, and build netatalk and it's dependencies. This is so we can connect to the pi via bonjour. | |
sudo aptitude install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev | |
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.1.10.tar.gz | |
tar -xf netatalk-3.1.10.tar.gz | |
cd netatalk-3.1.10 | |
./configure \ | |
--with-init-style=debian-systemd \ | |
--without-libevent \ | |
--without-tdb \ | |
--with-cracklib \ | |
--enable-krbV-uam \ | |
--with-pam-confdir=/etc/pam.d \ | |
--with-dbus-daemon=/usr/bin/dbus-daemon \ | |
--with-dbus-sysconf-dir=/etc/dbus-1/system.d \ | |
--with-tracker-pkgconfig-version=1.0 | |
make | |
sudo make install | |
#make a Time Machine folder, you can guess what tm stands for. | |
sudo mkdir -p /media/tm | |
#auto-mounts drives, links drive directory to to the folder we've just created. | |
#More: https://help.ubuntu.com/community/Fstab | |
#Your drive probably isn't "/dev/sda2" like mine, so use tools like "lsblk" to find out where it's connected to. | |
#TODO mount based on UUID | |
sudo nano /etc/fstab | |
/dev/sda2 /media/tm hfsplus force,rw,user,auto 0 0 | |
#may not be necessary to mount the drive - | |
sudo mount -a | |
# TODO - Auto config text files without copy and paste | |
#Here you need to add "mdns4" and "mdns" to the line that starts with “hosts:”, so that it looks like this: | |
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns | |
sudo nano /etc/nsswitch.conf | |
# Now add below to afpd.service, this will have the Raspberry Pi mimic the Apple Time Capsule. | |
# <?xml version="1.0" standalone='no'?><!--*-nxml-*--> | |
# <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> | |
# <service-group> | |
# <name replace-wildcards="yes">%h</name> | |
# <service> | |
# <type>_afpovertcp._tcp</type> | |
# <port>548</port> | |
# </service> | |
# <service> | |
# <type>_device-info._tcp</type> | |
# <port>0</port> | |
# <txt-record>model=TimeCapsule</txt-record> | |
# </service> | |
# </service-group> | |
sudo nano /etc/avahi/services/afpd.service | |
# Network share the external drive, by adding this below: | |
# [Global] | |
# mimic model = TimeCapsule6,106 | |
# | |
# [Time Machine] | |
# path = /media/tm | |
# time machine = yes | |
sudo nano /usr/local/etc/afp.conf | |
# Launch time machine now. | |
sudo service avahi-daemon start | |
sudo service netatalk start | |
# Autolaunch on every startup | |
sudo systemctl enable avahi-daemon | |
sudo systemctl enable netatalk | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment