soma-connect with shairport-sync part 3

Okay, it turns out that there was a lot of hidden magic on the SOMA Connect image that was infeasible to try to migrate/clone over myself, both due to dependencies on how the old-ass Raspbian image is setup in terms of networking, and a whole bunch of random/hidden scripts that do who-knows-what. So I decided to take a different approach, and modify the SOMA Connect image instead.

  1. I downloaded SOMA Connect, specifically version 2.3.1 and flashed it to my RPi’s SD card

  2. I grew the partition to actually fill the card:

    sudo growpart /dev/mmcblk0 2
    sudo e2fsck -f /dev/mmcblk0p2
    sudo resize2fs /dev/mmcblk0p2
    
  3. Plugged a monitor and keyboard into the Pi, and booted it up

  4. Used the SOMA Connect app to set up wifi on the Pi (and also added it to HomeKit while I had the app open)

  5. Logged into the Pi using the provided username/password (pi/SOMAConnect1)

  6. Enabled ssh with sudo systemctl enable ssh && sudo systemctl start ssh (ideally there’s some way of doing this or its equivalent to the mounted SD card)

  7. Used sudo raspi-config to set the audio to “Headphones”, and then used alsamixer and alsactl store to save the default volume settings that I like

  8. sudo apt update && sudo apt dist-upgrade to update all of the system packages, and rebooted

  9. Discovered that the version of shairport-sync in the configured Debian repository is both super old and super broken, but also that the soma-connect image had all the devtools installed, so I opted to just build it locally, using the official build instructions. Here’s the steps I took, though, for completeness' sake:

    sudo apt install --no-install-recommends build-essential git autoconf automake libtool \
        libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev \
        libplist-dev libsodium-dev libavutil-dev libavcodec-dev libavformat-dev uuid-dev libgcrypt-dev xxd
    wget https://github.com/mikebrady/shairport-sync/archive/refs/tags/4.3.7.tar.gz
    tar xzvf 4.3.7.tar.gz
    cd shairport-sync-4.3.7
    autoreconf -fi
    ./configure --sysconfdir=/etc --with-alsa \
        --with-soxr --with-avahi --with-ssl=openssl --with-systemd --with-airplay-2
    make
    sudo make install
    sudo tee /etc/shairport-sync.conf << EOF
    
    general = {
        name = "bedroom";
    }
    alsa = {
        output_device = "hw:Headphones";
    }
    
    EOF
    
    sudo systemctl daemon-reload
    sudo systemctl enable shairport-sync
    sudo systemctl start shairport-sync
    
  10. Discovered that shairport-sync also needs nqptp to be running, so I just ran its (very simple) install instructions, followed with:

    sudo systemctl daemon-reload
    sudo systemctl enable nqptp
    sudo systemctl start nqptp
    
    sudo systemctl start shairport-sync
    
  11. Things seemed to be actually working now, so out of an abundance of caution I shut down the Pi and made a new image of the SD card for safekeeping so I wouldn’t have to go through all this crap all over again:

    sudo dd if=/dev/mmcblk0 of=soma-connect-2.3.1-shairport.img bs=1M
    

For steps 3-6 I’d really like to be able to just mount the SD card on my Linux machine and then edit some config file directly, but I’m not actually sure how systemctl enable works. It would certainly make things easier if I didn’t have to do that and could just start out being able to ssh into it. But this is such a minor annoyance compared to the rest of all this that there’s not too much point in trying to optimize that bit away.

Anyway now things seem to be working:

pi@soma-connect:~ $ ps auxwww | grep shair
shairpo+   693 10.8  1.8 155816 17732 ?        SLsl 06:17   0:02 /usr/local/bin/shairport-sync --log-to-syslog
pi        1234  0.0  0.0   7344   480 pts/0    S+   06:17   0:00 grep --color=auto shair
pi@soma-connect:~ $ ps auxwww | grep soma-con
avahi      374  1.2  0.3   6028  3020 ?        Ss   06:17   0:00 avahi-daemon: running [soma-connect.local]
pi        1236  0.0  0.0   7476   528 pts/0    S+   06:17   0:00 grep --color=auto soma-con
pi@soma-connect:~ $

and notably, I can both listen to music in my bedroom and (theoretically) control my blinds from HomeKit automations, so, yay.