Skip to content

Instantly share code, notes, and snippets.

@gruis
Forked from dinigo/afp.conf
Created March 11, 2016 04:48
Show Gist options
  • Save gruis/df3547c1b4023abffc28 to your computer and use it in GitHub Desktop.
Save gruis/df3547c1b4023abffc28 to your computer and use it in GitHub Desktop.
Install netatalk (afp) in Ubuntu with service announcing and provide a Time Machine share. Users must belong to `timemachine` group to be allowed to use it.
[TimeMachine]
path = /store/time-machine
time machine = yes
valid users = @timemachine
#!/bin/bash
# This script will install the latest stable version of netatalk 3.x and libevent in order
# to configure a Time machine volume
# Versions to use
libevent_version="2.0.22-stable"
netatalk_version="3-1-7"
# Install prerequisites:
apt-get install build-essential pkg-config checkinstall git avahi-daemon libavahi-client-dev libcrack2-dev libwrap0-dev autotools-dev automake libtool libdb-dev libacl1-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev libtdb-dev
# libevent
cd /usr/local/src
wget http://skylink.dl.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-${libevent_version}.tar.gz
tar xfv libevent-${libevent_version}.tar.gz
cd libevent-${libevent_version}
./configure
make
checkinstall \
--pkgname=libevent-${libevent_version} \
--pkgversion=${libevent_version} \
--backup=no \
--deldoc=yes \
--default --fstrans=no
cd ../
# netatalk
git clone git://git.code.sf.net/p/netatalk/code netatalk-code
cd netatalk-code
git checkout netatalk-${netatalk_version}
./bootstrap
./configure \
--enable-debian \
--enable-krbV-uam \
--enable-zeroconf \
--enable-krbV-uam \
--enable-tcp-wrappers \
--with-cracklib \
--with-acls \
--with-dbus-sysconf-dir=/etc/dbus-1/system.d \
--with-init-style=debian-sysv \
--with-pam-confdir=/etc/pam.d \
--with-tracker-pkgconfig-version=0.16
make
checkinstall \
--pkgname=netatalk \
--pkgversion=${netatalk_version} \
--backup=no \
--deldoc=yes \
--default \
--fstrans=no
# Install time machine configuration
cp afp.conf /usr/local/etc/
# Start services
service avahi-daemon start
service netatalk start
# Instruct User
echo "************************************"
echo "* INSTALLATION COMPLETE *"
echo "************************************"
echo " To add users to your Time Machine symply"
echo " simadd them to the timemachine group by"
echo " running the following command as root:"
echo " sudo usermod -a -G timemachine <username>"
echo " Afterwards they can log in the Time Machine"
echo " volume with their linux user and password"
echo "------------------------------------"
echo " CONFIG FILE: /usr/local/etc/afp.conf"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment