From 328b85d396bcd7d094b965dab6352e5e0c229268 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 19 Oct 2016 14:24:40 -0400 Subject: [PATCH] Add infrastructure for alternative name (currently nts) See https://github.com/projectatomic/rpm-ostree/issues/405 This patch adds an (off by default) `--enable-new-name` build option which currently defaults to `nts`. This is purely additive, and the intention is that we'll support the rpm-ostree name in perpetuity most likely. At the moment, we add a new name for: - /usr/bin/$name - The systemd unit file But we notably *don't* attempt to add a new name to the DBus API, as it'd be a lot more invasive of a patch, and less payoff (it's mostly just programs/scripts that interact with the DBus). Closes: #497 Approved by: jlebon --- Makefile-daemon.am | 10 ++++++++++ Makefile-rpm-ostree.am | 7 +++++++ Makefile.am | 8 ++++++++ configure.ac | 7 +++++++ src/daemon/org.projectatomic.rpmostree1.service.in | 4 ++-- src/daemon/rpm-ostreed.service.in | 4 ++-- 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Makefile-daemon.am b/Makefile-daemon.am index 26a3d6bb34..b3a52b3d8b 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -92,6 +92,16 @@ systemdunitdir = $(prefix)/lib/systemd/system/ $(systemdunit_DATA): $(SED_SUBST) $@.in > $@ +install-daemon-altname-hook: + mv $(DESTDIR)$(libexecdir)/rpm-ostreed $(DESTDIR)$(libexecdir)/$(primaryname)d + ln -sf $(primaryname)d $(DESTDIR)$(libexecdir)/rpm-ostreed + mv $(DESTDIR)$(systemdunitdir)/rpm-ostreed.service $(DESTDIR)$(systemdunitdir)/$(primaryname)d.service + ln -sf $(primaryname)d.service $(DESTDIR)$(systemdunitdir)/rpm-ostreed.service +if BUILDOPT_NEW_NAME +INSTALL_DATA_HOOKS += install-daemon-altname-hook +endif + +# We don't yet rename the DBus related items service_in_files = $(srcdir)/src/daemon/org.projectatomic.rpmostree1.service.in service_DATA = $(service_in_files:.service.in=.service) servicedir = $(dbusservicedir) diff --git a/Makefile-rpm-ostree.am b/Makefile-rpm-ostree.am index 02adcc9bd0..58f6218ae8 100644 --- a/Makefile-rpm-ostree.am +++ b/Makefile-rpm-ostree.am @@ -57,3 +57,10 @@ rpm_ostree_LDADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la librpmostree-1.l privdatadir=$(pkglibdir) privdata_DATA = src/app/rpm-ostree-0-integration.conf + +install-bin-hook: + mv $(DESTDIR)$(bindir)/rpm-ostree $(DESTDIR)$(bindir)/$(primaryname) + ln -sf $(primaryname) $(DESTDIR)$(bindir)/rpm-ostree +if BUILDOPT_NEW_NAME +INSTALL_DATA_HOOKS += install-bin-hook +endif diff --git a/Makefile.am b/Makefile.am index 29f69c6b0f..8828b825cd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,13 @@ include Makefile-decls.am +newname = nts +if BUILDOPT_NEW_NAME +primaryname = $(newname) +else +primaryname = rpm-ostree +endif + SUBDIRS += . if ENABLE_GTK_DOC @@ -39,6 +46,7 @@ GITIGNOREFILES += build-aux/ gtk-doc.make config.h.in aclocal.m4 SED_SUBST = sed \ -e 's,[@]libexecdir[@],$(libexecdir),g' \ + -e 's,[@]primaryname[@],$(primaryname),g' \ $(NULL) libglnx_srcpath := $(srcdir)/libglnx diff --git a/configure.ac b/configure.ac index ad31c113fb..295f87822e 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,12 @@ AC_ARG_ENABLE(installed_tests, [enable_installed_tests=no]) AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes) +AC_ARG_ENABLE(new-name, + AS_HELP_STRING([--enable-new-name], + [Install additionally as nts (default: no)]),, + [enable_new_name=no]) +AM_CONDITIONAL(BUILDOPT_NEW_NAME, test x$enable_new_name = xyes) + AC_ARG_WITH(bubblewrap, AS_HELP_STRING([--with-bubblewrap], [Path to bubblewrap binary (default: /usr/bin/bwrap)]),, @@ -152,6 +158,7 @@ AC_OUTPUT echo " $PACKAGE $VERSION + nts name: $enable_new_name compose tooling: $enable_compose_tooling bubblewrap: $with_bubblewrap gtk-doc: $enable_gtk_doc diff --git a/src/daemon/org.projectatomic.rpmostree1.service.in b/src/daemon/org.projectatomic.rpmostree1.service.in index 0b87802fe8..c0b8f3c425 100644 --- a/src/daemon/org.projectatomic.rpmostree1.service.in +++ b/src/daemon/org.projectatomic.rpmostree1.service.in @@ -1,5 +1,5 @@ [D-BUS Service] Name=org.projectatomic.rpmostree1 -Exec=@libexecdir@/rpm-ostreed +Exec=@libexecdir@/@primaryname@d User=root -SystemdService=rpm-ostreed.service +SystemdService=@primaryname@d.service diff --git a/src/daemon/rpm-ostreed.service.in b/src/daemon/rpm-ostreed.service.in index a5602502f1..c11c1053e3 100644 --- a/src/daemon/rpm-ostreed.service.in +++ b/src/daemon/rpm-ostreed.service.in @@ -1,8 +1,8 @@ [Unit] -Description=RPM OSTree Manager +Description=OSTree+RPM package management daemon ConditionPathExists=/ostree [Service] Type=dbus BusName=org.projectatomic.rpmostree1 -ExecStart=@libexecdir@/rpm-ostreed +ExecStart=@libexecdir@/@primaryname@d