1
2### Updating Shairport Sync
3This guide is for building and updating an installation of Shairport Sync. If you wish to build an installation of Shairport Sync to replace an installation that came from a package, this doesn't really apply – instead, please follow the guide at [INSTALL.md](https://github.com/mikebrady/shairport-sync/blob/master/INSTALL.md).
4
5To do an update, you basically have to go through the whole process of building Shairport Sync again,
6but a few steps are shorter because you've done them before; you won't have to reinstall the build tools or libraries needed, and you won't have to define the user and group or reconfigure the settings in the configuration file.
7
8But before you begin, you should update and upgrade any packages.
9
10Note that in this guide, a `$` prefix means you should be in the normal user mode; a `#` prefix means you should be in the superuser or root mode.
11
12Here is the sequence for Raspberry Pi OS (Buster), which is based on Debian Buster. The same commands work for Ubuntu, and maybe more. Here, a non-`root` user with `sudo` privileges is assumed.
13
14```
15$ sudo apt-get update
16$ sudo apt-get upgrade
17```
18Next, stop playing music to your device.
19
20### Remove Old Copies
21It's a good idea to search for and remove any existing copies of the application, called `shairport-sync`. Use the command `$ which shairport-sync` to find them. For example, if `shairport-sync` has been installed previously, this might happen:
22```
23$ which shairport-sync
24/usr/local/bin/shairport-sync
25```
26Remove it as follows:
27```
28# rm /usr/local/bin/shairport-sync
29```
30Do this until no more copies of `shairport-sync` are found. This is especially important if you are building Shairport Sync over an old version that was installed from packages, as the built application will be installed in a different directory to the packaged installation.
31
32### Remove Old Startup and Service Scripts
33You should also remove the startup script and service definition files `/etc/systemd/system/shairport-sync.service`, `/lib/systemd/system/shairport-sync.service`, `/etc/init.d/shairport-sync`, `/etc/dbus-1/system.d/shairport-sync-dbus.conf` and `/etc/dbus-1/system.d/shairport-sync-mpris.conf` if they exist – new ones will be installed if necessary. As with the previous section, this is especially important if you are building Shairport Sync over an old version that was installed from packages, as the scripts for the built application may be different to those of the packaged version. If they are left in place, bad things can happen.
34
35### Reboot after Cleaning Up
36If you removed any installations of Shairport Sync or any of its startup script files in the last two steps, you should reboot.
37
38### Building the Updated Shairport Sync
39Now, to build, update and install Shairport Sync, if you still have the directory in which you previously built Shairport Sync, it will contain the repository you originally downloaded. Navigate your way to it and 'pull' the changes from GitHub:
40
41```
42$ git pull
43```
44Otherwise – say if you deleted the repository – just pull Shairport Sync from GitHub again and move into the new directory:
45```
46$ git clone https://github.com/mikebrady/shairport-sync.git
47$ cd shairport-sync
48```
49(If you wish to use the `development` branch, you should enter the command `$ git checkout development` at this point. Everything else is the same.)
50
51Now, while in the `shairport-sync` directory, perform the following commands (note that there is a choice you must make in there):
52```
53$ autoreconf -fi
54```
55Please review the release notes to see if any configuration settings have been changed. For instance, in the transitions from version 2 to version 3, the `--with-ssl=polarssl` has been deprecated in favour of `--with-ssl=mbedtls`.
56```
57#The following is the standard configuration for a Linux that uses the alsa backend and systemd initialisation system:
58$ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --sysconfdir=/etc
59#OR
60#The following is the standard configuration for a Linux that uses the alsa backend and the older System V initialisation system:
61$ ./configure --with-libdaemon --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemv --sysconfdir=/etc
62
63$ make
64$ sudo make install
65```
66At this point you have downloaded, compiled and installed the updated Shairport Sync. However, the older version is still running. So, you need to do a little more:
67
68If you are on a `systemd`-based system such as Raspbian Jessie or recent versions of Ubuntu and Debian, execute the following commands:
69```
70$ sudo systemctl daemon-reload
71$ sudo systemctl restart shairport-sync
72```
73Otherwise execute the following command:
74```
75$ sudo service shairport-sync restart
76```
77
78Your Shairport Sync should be upgraded now.
79
80### Post Update Tasks
811 **Unmute the Output Device Mixer** (This applies only if you are using a hardware mixer for volume control.) Certain older versions of Shairport Sync could leave the output device mixer in a muted state after use to minimise the possibility of noise. However, this is not generally compatible with other audio players using the same device, as they would generally expect the device to be unmuted. Recent versions of Shairport Sync therefore do not use the mute facility by default. When you update Shairport Sync, the output device mixer might have been muted by the previous version, so you should unmute it, using, for instance, the following command:
82```
83$ sudo amixer sset <mixer_name> unmute
84```
85Alternatively you can use `alsamixer`. A muted output has the letter(s) `M` as its value. Select it and type `M` again to unmute.
86
87