[RFC patch iwhd] Add native systemd
Jim Meyering
jim at meyering.net
Wed Nov 9 20:42:01 UTC 2011
Pete Zaitcev wrote:
> This patch has 3, or actually 4, parts that I need commented.
>
> 0th part is that this patch needs the "final robust reconnect" or however
> we call it, which I posted for review on 10/28.
>
> 1. The unitdir madness. The problem here is that DESTDIR may be empty,
> and in the same time the prefix set to something. Therefore, unitdir
> cannot be defined as an absolute path. The _only_ way to stuff this
> makefile through the "make check" is to use one of the predefined
> variables that depend on prefix _and_ DESTDIR (which may be non-empty).
> Ergo, the double-dot over sysconfigdir. Madness.
...
> +unitdir = $(sysconfdir)/../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
> $(INSTALL_SCRIPT) iwhd.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/iwhd
> mkdir -p $(DESTDIR)$(sysconfdir)/iwhd
> $(INSTALL_DATA) iwhd-conf.js $(DESTDIR)$(sysconfdir)/iwhd/conf.js
> - $(INSTALL_DATA) iwhd-users.js $(DESTDIR)$(sysconfdir)/iwhd/users.js
> + $(INSTALL) -m 600 iwhd-users.js $(DESTDIR)$(sysconfdir)/iwhd/users.js
> + mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
> + $(INSTALL_DATA) $(top_srcdir)/iwhd.sysconfig $(DESTDIR)$(sysconfdir)/sysconfig/iwhd
> + mkdir -p $(DESTDIR)$(unitdir)
> + $(INSTALL_DATA) $(top_srcdir)/iwhd.service $(DESTDIR)$(unitdir)/iwhd.service
> mkdir -p $(logrotate_dir)
> $(INSTALL_DATA) $(top_srcdir)/iwhd.logrotate $(logrotate_dir)/iwhd
> mkdir -p $(DESTDIR)$(DEFAULT_FS_DIR)
> @@ -152,8 +159,10 @@ install-data-local: iwhd.init iwhd-conf.js iwhd-users.js
> uninstall-local:
> rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/iwhd \
> $(DESTDIR)$(sysconfdir)/iwhd/conf.js \
> - $(logrotate_dir)/iwhd \
> - $(DESTDIR)$(sysconfdir)/iwhd/users.js
> + $(DESTDIR)$(sysconfdir)/iwhd/users.js \
> + $(DESTDIR)$(sysconfdir)/sysconfig/iwhd \
> + $(DESTDIR)/lib/systemd/system/iwhd.service \
> + $(logrotate_dir)/iwhd
> rmdir $(DESTDIR)$(DEFAULT_FS_DIR)
Thanks!
Almost perfect.
The uninstall-local rule would have removed the system's
copy of /lib/systemd/system/iwhd.service
when run by root with empty DESTDIR and with a nonempty $(prefix).
With this small change (just folded in to yours),
it does what was intended:
diff --git a/Makefile.am b/Makefile.am
index 967c292..b0b1587 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -161,7 +161,7 @@ uninstall-local:
$(DESTDIR)$(sysconfdir)/iwhd/conf.js \
$(DESTDIR)$(sysconfdir)/iwhd/users.js \
$(DESTDIR)$(sysconfdir)/sysconfig/iwhd \
- $(DESTDIR)/lib/systemd/system/iwhd.service \
+ $(DESTDIR)/$(unitdir)/iwhd.service \
$(logrotate_dir)/iwhd
rmdir $(DESTDIR)$(DEFAULT_FS_DIR)
I've changed the one-line summary to this:
iwhd: add native systemd support
and pushed.
More information about the iwhd-devel
mailing list