Pete Zaitcev wrote:
On Thu, 10 Nov 2011 18:10:49 +0100 Jim Meyering jim@meyering.net wrote:
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local
I didn't want this because I thought that prefix may be /usr, in which case this does not work... But on second thought $(sysconfdir) turns into /usr/etc in such case too, right?
Right, unless you override it.
I'm asking because I cannot build the RPM, because the following happens:
[zaitcev@simbelmyne ~]$ rpmbuild -ba rpms/SPECS/iwhd.spec .................. RPM build errors: File not found: /q/zaitcev/rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/lib/systemd/system/iwhd.service [zaitcev@simbelmyne ~]$ find rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64 -name 'iwhd.service' rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/usr/lib/systemd/system/iwhd.service
Oh! Thanks for catching that. Here's the fix:
From 9bdb7d01ea61a455654f7283f771aaea8a95048d Mon Sep 17 00:00:00 2001
From: Jim Meyering meyering@redhat.com Date: Fri, 11 Nov 2011 08:46:25 +0100 Subject: [PATCH] build/rpm: install iwhd.service in the right place
* Makefile.am (p): Define a surrogate for $(prefix) that we can nuke when it's /usr. Use it in $(unitdir) definition so that iwhd.service is installed under /lib/..., rather than under /usr/lib/... [bug introduced via commit fc01ab35, "maint: improve new "unitdir" definition and uses"] Reported by Pete Zaitcev. --- Makefile.am | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 30e546e..df9d4f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -138,8 +138,11 @@ iwhd-users.js: $(top_builddir)/config.status $(AM_V_GEN)echo '[ { "name":"admin", "secret":"replaceme" } ]' \ > $@-t && chmod a-w $@-t && mv $@-t $@
+# Honor $(prefix) in the expansion of $(unitdir), except when it is "/usr". +p = $$(echo '$(prefix)' | sed 's,^/usr$$,,') +unitdir = $(DESTDIR)$(p)/lib/systemd/system + logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local install-data-local: iwhd.init iwhd-conf.js iwhd-users.js mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d -- 1.7.8.rc0.61.g8a042