nqptp
nqptp copied to clipboard
Does not build from makedeb and makepkg
Similar to an issue I set with shairport-sync
, this will not build as a package with either makedeb (for debian/RPi) nor makepkg (Arch) due to a permissions problem when it tries to create a group for nqptp
.
Using either of these methods allows for nice build of installable/up[grade-able packages, FWIW. Under Arch, this patch allows shairport-sync
to build.
I will have to craft a similar one for nqptp
.
Thought you'd like to know.
This is the error I get:
[#] Starting package()...
make[1]: Entering directory '/Rune_dev/RuneOS/rpios_packages/nqptp/src/nqptp'
make[1]: Nothing to be done for 'install-data-am'.
/usr/bin/mkdir -p '/Rune_dev/RuneOS/rpios_packages/nqptp/pkg/nqptp-git//usr/bin'
/usr/bin/install -c nqptp '/Rune_dev/RuneOS/rpios_packages/nqptp/pkg/nqptp-git//usr/bin'
make install-exec-hook
make[2]: Entering directory '/Rune_dev/RuneOS/rpios_packages/nqptp/src/nqptp'
getent group nqptp &>/dev/null || groupadd -r nqptp &>/dev/null
make[2]: *** [Makefile:817: install-exec-hook] Error 10
make[2]: Leaving directory '/Rune_dev/RuneOS/rpios_packages/nqptp/src/nqptp'
make[1]: *** [Makefile:734: install-exec-am] Error 2
make[1]: Leaving directory '/Rune_dev/RuneOS/rpios_packages/nqptp/src/nqptp'
make: *** [Makefile:673: install-am] Error 2
[! package()] A failure occurred in package().
Aborting...
Thanks for the post and the suggestions. Let me take a look and try to understand this.
I may have a solution. I comment out the lines in Makefile.am that creates the user and group.
# getent group nqptp &>/dev/null || groupadd -r nqptp &>/dev/null
# getent passwd nqptp &> /dev/null || useradd -r -M -g nqptp -s /usr/sbin/nologin nqptp &>/dev/null
I create a sysusers file that looks like this:
u nqptp - "nqptp user" /dev/null /usr/sbin/nologin
g nqptp -
and then tell the package maker to put this in the package:
install -D -m644 "$srcdir"/nqptp.sysusers "$pkgdir"/usr/lib/sysusers.d/nqptp.conf
I will see if this works. I inferred this from other PKGBUILDs that I use that also create users. No guarantees that it does the same thing....
This is very interesting, thanks!
This looks like it would work for systemd
-based systems, but not for systems based on the older System V. Very interesting.
I see some other contributors mentioned this in the past. Sigh.
Okay, so I've taken a good look at this. Unfortunately, (AFAIK), the otherwise very nice scheme you propose above doesn't quite work.
As you write, if one creates a file nqptp.sysusers
with the following contents (slightly different to yours):
u nqptp - "nqptp" /dev/null /usr/sbin/nologin
and if the contents of Makefile.am
are changed to:
bin_PROGRAMS = nqptp
nqptp_SOURCES = nqptp.c nqptp-clock-sources.c nqptp-message-handlers.c nqptp-utilities.c general-utilities.c debug.c
AM_CFLAGS = -fno-common -Wall -Wextra -pthread --include=config.h
CLEANFILES =
if USE_GIT_VERSION
nqptp.c: gitversion.h
gitversion.h: .git/index
echo "// Do not edit!" > gitversion.h
echo "// This file is automatically generated by 'git describe --tags --dirty --broken', if available." >> gitversion.h
echo -n " char git_version_string[] = \"" >> gitversion.h
git describe --tags --dirty --broken | tr -d '[[:space:]]' >> gitversion.h
echo "\";" >> gitversion.h
FORCE: ;
CLEANFILES += gitversion.h
endif
install-exec-hook:
if BUILD_FOR_LINUX
# Note: NQPTP runs as user/group nqptp/nqptp on Linux.
# Access is given via AmbientCapabilities in the service file.
# If you want to run it from the command line, e.g. for debugging, run it as root user.
# no installer for System V
if INSTALL_SYSTEMD_STARTUP
install -d $(DESTDIR)/usr/lib/sysusers.d
install -m 0644 nqptp.sysusers $(DESTDIR)/usr/lib/sysusers.d/nqptp.conf
[ -e $(DESTDIR)$(libdir)/systemd/system ] || mkdir -p $(DESTDIR)$(libdir)/systemd/system
# don't replace a service file if it already exists...
[ -e $(DESTDIR)$(libdir)/systemd/system/nqptp.service ] || cp nqptp.service $(DESTDIR)$(libdir)/systemd/system
endif
endif
if BUILD_FOR_FREEBSD
# NQPTP runs as root on FreeBSD to access ports 319 and 320
if INSTALL_FREEBSD_STARTUP
cp nqptp.freebsd /usr/local/etc/rc.d/nqptp
chmod 555 /usr/local/etc/rc.d/nqptp
endif
endif
Then the user and group nqptp
will be created. This is a nice "declarative" solution. However, the unfortunate problem (again, AFAIK) is that the nqptp
is not created during installation -- it will only be created when the system reboots.
As the Bard didn't quite say: "if this be error, and upon me proved... I'd love to be corrected!"
Agreed that the sysusers file is read at boot, but if we need it 'now' can't we not also run 'systemctl restart systemd-sysusers'. Will that solve it for us?
Hi there. Just wondering if the most recent change in the development
branch will have any positive impact on this -- the systemd
DynamicUser
facility is used instead of defining the nqptp
user and group.