Skip to content

Instantly share code, notes, and snippets.

@plasticine
Last active August 29, 2015 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plasticine/35960b0447200e00145f to your computer and use it in GitHub Desktop.
Save plasticine/35960b0447200e00145f to your computer and use it in GitHub Desktop.
Install ShairPort on Arch on a Rpi
#!/usr/bin/env bash +xe
# Assumes a sane-ish system with git and wget
pacman -S --noconfirm avahi libao openssl perl-crypt-openssl-rsa perl-io-socket-inet6 perl-libwww
wget https://aur.archlinux.org/packages/pe/perl-net-sdp/perl-net-sdp.tar.gz
tar -zxvf perl-net-sdp.tar.gz
pushd perl-net-sdp
makepkg -s --asroot
pacman -U perl-net-sdp-*.pkg.tar.xz
popd
rm -rf perl-net-sdp*
pacman -S --noconfirm alsa-utils alsa-firmware alsa-lib alsa-plugins
git clone https://github.com/abrasive/shairport.git shairport
pushd shairport
make
make install
popd
rm -rf shairport
cat > /etc/systemd/system/shairport.service << "EOF"
[Unit]
Description=Startup ShairPort (Apple AirPlay)
After=network.target
After=avahi-daemon.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/shairport -a Irradiated -b 256 -d
ExecStop=/usr/bin/killall shairport
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
systemctl enable avahi-daemon
systemctl enable shairport
@senselessDev
Copy link

Nice, worked for me (except the shebangline).
But maybe it is a little bit cleaner to tell systemd, that we are using a daemon so that it could keep track of failures of the forked shairport process. My systemd service looks like this:

[Unit]
Description=Startup ShairPort (Apple AirPlay)
After=network.target
After=avahi-daemon.service

[Service]
Type=forking
PIDFile=/var/run/shairport.pid
ExecStart=/usr/local/bin/shairport --daemon --pidfile=/var/run/shairport.pid 
ExecStop=/usr/bin/kill $MAINPID

[Install]
WantedBy=multi-user.target

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