shairport-sync icon indicating copy to clipboard operation
shairport-sync copied to clipboard

[Problem]: INSTALL_USER_TARGET = install-user-local causes issues for packaging

Open p3ck opened this issue 1 year ago • 7 comments

What happened?

I'm trying to update the fedora package for shairport-sync and I have previously let the configure script generate and install the sysemd file but now when I do this the Makefile also tries to generate a local user and group. This should not be done when building the RPM but when installing the RPM.

Can we have a way to generate the systemd file but not try to create the user/group? An extra flag maybe?

Thanks

Relevant log output

/usr/bin/make  install-am
make[1]: Entering directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
make[2]: Entering directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
 /usr/bin/mkdir -p '/home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/usr/bin'
  /usr/bin/install -p shairport-sync '/home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/usr/bin'
/usr/bin/make  install-exec-hook
make[3]: Entering directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
install -d /home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/etc
install -m 0644 ./scripts/shairport-sync.conf /home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/etc/shairport-sync.conf.sample
[ -f /home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/etc/shairport-sync.conf ] || cp ./scripts/shairport-sync.conf /home/bpeck/rpmbuild/BUILDROOT/shairport-sync-4.3.2-0.fc41.x86_64/etc/shairport-sync.conf
getent group shairport-sync &>/dev/null || groupadd -r shairport-sync &>/dev/null
make[3]: *** [Makefile:1656: install-group-local] Error 10
make[3]: Leaving directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
make[2]: *** [Makefile:1497: install-exec-am] Error 2
make[2]: Leaving directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
make[1]: *** [Makefile:1385: install-am] Error 2
make[1]: Leaving directory '/home/bpeck/Sandbox/shairport-sync/shairport-sync-4.3.2'
make: *** [Makefile:1378: install] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.TWfmMT (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.TWfmMT (%install)

System Information.

Fedora release 39 (Thirty Nine)

Configuration Information.

%build
autoreconf -i -f
%configure --sysconfdir=/etc --with-alsa --with-pipe --with-dummy \
           --with-stdout --with-pa --with-pq --with-metadata \
           --with-soxr --with-avahi --with-ssl=openssl \
           --with-systemd --with-ssl=openssl

PulseAudio or PipeWire installed?

  • [ ] Check if your system uses a Sound Server.

How did you install Shairport Sync?

Built from source

Check previous issues

  • [X] Confirm

p3ck avatar Feb 23 '24 14:02 p3ck

Thanks for the post. I'll set about it, but it may be a little while...

mikebrady avatar Feb 25 '24 17:02 mikebrady

Would this be acceptable?

diff -ur shairport-sync-4.3.2.orig/Makefile.am shairport-sync-4.3.2/Makefile.am
--- shairport-sync-4.3.2.orig/Makefile.am	2023-10-15 13:42:38.000000000 -0400
+++ shairport-sync-4.3.2/Makefile.am	2024-02-26 07:45:04.857503260 -0500
@@ -18,7 +18,7 @@
 
 # See below for the flags for the test client program
 
-shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c
+shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c scripts/shairport-sync.service scripts/shairport-sync.service-avahi scripts/shairport-sync
 
 if BUILD_FOR_DARWIN
   AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"

Then the spec file does this..

 autoreconf -i -f
 %configure --sysconfdir=/etc --with-alsa --with-pipe --with-dummy \
            --with-stdout --with-pa --with-pq --with-metadata \
-           --with-soxr --with-avahi --with-systemd --with-ssl=openssl
+           --with-soxr --with-avahi --with-ssl=openssl
 
 %make_build
 
 %install
 %make_install
 rm %{buildroot}/etc/shairport-sync.conf.sample
+install -p -m644 -D scripts/shairport-sync.service-avahi %{buildroot}%{_unitdir}/%{name}.service
 mkdir -p %{buildroot}/%{_sharedstatedir}/%{name}
 
 %pre

I can push a proper Pull Request if agreed upon.

p3ck avatar Feb 26 '24 12:02 p3ck

Thanks, I'll check it out, soon!

mikebrady avatar Feb 27 '24 12:02 mikebrady

Just taking a look at this. If I understand your suggestion correctly, you would always build scripts/shairport-sync.service, scripts/shairport-sync.service-avahi scripts/shairport-sync anyway, even when --with-systemd configuration flag was not selected. Then, later on in your spec file, you would copy them in as appropriate? Did I get that right?

mikebrady avatar Feb 29 '24 10:02 mikebrady

Yes, that is correct.

On Thu, Feb 29, 2024, 5:04 AM Mike Brady @.***> wrote:

Just taking a look at this. If I understand your suggestion correctly, you would always build scripts/shairport-sync.service, scripts/shairport-sync.service-avahi scripts/shairport-sync anyway, even when --with-systemd configuration flag was not selected. Then, later on in your spec file, you would copy them in as appropriate? Did I get that right?

— Reply to this email directly, view it on GitHub https://github.com/mikebrady/shairport-sync/issues/1808#issuecomment-1970798834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUPZODBLOZRKNXCETWZIFDYV36I5AVCNFSM6AAAAABDW3AAT2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG44TQOBTGQ . You are receiving this because you authored the thread.Message ID: @.***>

p3ck avatar Feb 29 '24 11:02 p3ck

Thanks. I'll make that change in there next day or so -- no need for a PR.

mikebrady avatar Mar 03 '24 15:03 mikebrady

Hi there. I've pushed an update which implements your idea, thanks, but with a slight change that should specialise it to Linux only. I hope it works! Thanks for the idea.

mikebrady avatar Mar 04 '24 11:03 mikebrady

This issue has been inactive for 28 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.

github-actions[bot] avatar May 04 '24 00:05 github-actions[bot]