[lxc-devel] [lxc/master] Update Makefiles to uninstall paths owned by LXC on installation.

caioboffo on Github lxc-bot at linuxcontainers.org
Fri Oct 18 12:23:44 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 654 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191018/2d1d52a0/attachment.bin>
-------------- next part --------------
From d5090b52b7720619e91dab8430ed16259b0cd94a Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:13:09 -0300
Subject: [PATCH 01/15] Remove install directories not been used by lxc

---
 Makefile.am | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index dd892c820c..56b631ecdc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,12 +19,9 @@ pcdata_DATA = lxc.pc
 libtool: $(LIBTOOL_DEPS)
 	$(SHELL) ./config.status libtool
 
-install-data-local:
-	$(MKDIR_P) $(DESTDIR)$(LXCPATH)
-	$(MKDIR_P) $(DESTDIR)$(localstatedir)/cache/lxc
-
 ChangeLog::
 	@touch ChangeLog
 
 rpm: dist
 	rpmbuild --clean -ta ${distdir}.tar.gz $(RPMARGS)
+

From 05c92a64a23fb4baca092b5ad682a8ad81cde703 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:23:19 -0300
Subject: [PATCH 02/15] remove /etc/apparmor.d from the directories that make
 uninstall will remove

---
 config/apparmor/Makefile.am | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/config/apparmor/Makefile.am b/config/apparmor/Makefile.am
index 858f58ddeb..de0c79530b 100644
--- a/config/apparmor/Makefile.am
+++ b/config/apparmor/Makefile.am
@@ -36,9 +36,8 @@ uninstall-apparmor:
 	rm -f $(DESTDIR)$(sysconfdir)/apparmor.d/lxc/lxc-default
 	rm -f $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/lxc/start-container
 	rm -f $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/lxc/container-base
-	rmdir $(DESTDIR)$(sysconfdir)/apparmor.d/lxc/ || :
-	rmdir $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/lxc/ || :
-	rmdir $(DESTDIR)$(sysconfdir)/apparmor.d/ || :
+	if test -d $(DESTDIR)$(sysconfdir)/apparmor.d/lxc; then rmdir $(DESTDIR)$(sysconfdir)/apparmor.d/lxc; fi
+	if test -d $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/lxc; then rmdir $(DESTDIR)$(sysconfdir)/apparmor.d/abstractions/lxc; fi
 
 install-data-local: install-apparmor
 uninstall-local: uninstall-apparmor

From f53d31ec6b61ef5fe004f5534e6ee6cc51629f7f Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:24:47 -0300
Subject: [PATCH 03/15] remove /etc/lxc directory when make uninstall

---
 config/etc/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/config/etc/Makefile.am b/config/etc/Makefile.am
index d5d0a9aac0..610f0c511a 100644
--- a/config/etc/Makefile.am
+++ b/config/etc/Makefile.am
@@ -3,6 +3,9 @@ config_DATA = default.conf
 
 EXTRA_DIST = default.conf.lxcbr default.conf.libvirt default.conf.unknown
 
+uninstall-local:
+	if test -d $(DESTDIR)$(configdir); then rmdir $(DESTDIR)$(configdir); fi
+
 distclean-local:
 	@$(RM) -f default.conf
 	@$(RM) -f compile config.guess config.sub depcomp install-sh ltmain.sh missing Makefile.in Makefile

From 934407fab6a2162652e28f358040cbdcd54c8f36 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:26:53 -0300
Subject: [PATCH 04/15] removes systemd_unit_dir from the directories make
 uninstall remove

---
 config/init/systemd/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/init/systemd/Makefile.am b/config/init/systemd/Makefile.am
index c448850d1b..7b060d101c 100644
--- a/config/init/systemd/Makefile.am
+++ b/config/init/systemd/Makefile.am
@@ -15,7 +15,6 @@ uninstall-systemd:
 	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc.service
 	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc at .service
 	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/lxc-net.service
-	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) || :
 
 pkglibexec_SCRIPTS = lxc-apparmor-load
 

From 4eee5e6838cc522cdfa4fbae0b24acf19f98e390 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:30:31 -0300
Subject: [PATCH 05/15] make uninstall should not remove initdir

---
 config/init/sysvinit/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/init/sysvinit/Makefile.am b/config/init/sysvinit/Makefile.am
index e8b9f4f3d5..1625f8d22d 100644
--- a/config/init/sysvinit/Makefile.am
+++ b/config/init/sysvinit/Makefile.am
@@ -18,7 +18,6 @@ install-sysvinit: lxc-containers lxc-net
 uninstall-sysvinit:
 	rm -f $(DESTDIR)$(sysconfdir)/$(initdir)/lxc
 	rm -f $(DESTDIR)$(sysconfdir)/$(initdir)/lxc-net
-	rmdir $(DESTDIR)$(sysconfdir)/$(initdir) || :
 
 install-data-local: install-sysvinit
 uninstall-local: uninstall-sysvinit

From 2d1ceae0f3fae731bf4284c42132644b412e27af Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:32:14 -0300
Subject: [PATCH 06/15] make uninstall should not remove sysconfdir/init

---
 config/init/upstart/Makefile.am | 1 -
 1 file changed, 1 deletion(-)

diff --git a/config/init/upstart/Makefile.am b/config/init/upstart/Makefile.am
index 5552d32d21..62e21656a2 100644
--- a/config/init/upstart/Makefile.am
+++ b/config/init/upstart/Makefile.am
@@ -11,7 +11,6 @@ uninstall-upstart:
 	rm -f $(DESTDIR)$(sysconfdir)/init/lxc.conf
 	rm -f $(DESTDIR)$(sysconfdir)/init/lxc-instance.conf
 	rm -f $(DESTDIR)$(sysconfdir)/init/lxc-net.conf
-	rmdir $(DESTDIR)$(sysconfdir)/init || :
 
 install-data-local: install-upstart
 uninstall-local: uninstall-upstart

From 9e5273938b8dc91722d8727c9e25869fcf44d60c Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:33:55 -0300
Subject: [PATCH 07/15] add selinuxdir to be removed on make uninstall

---
 config/selinux/Makefile.am | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/config/selinux/Makefile.am b/config/selinux/Makefile.am
index 9a2b21ce65..48efd1e403 100644
--- a/config/selinux/Makefile.am
+++ b/config/selinux/Makefile.am
@@ -1,4 +1,4 @@
-selinuxdir=@DATADIR@/lxc/selinux
+selinuxdir=$(pkgdatadir)/selinux
 
 EXTRA_DIST = \
 	lxc.if lxc.te
@@ -6,3 +6,6 @@ EXTRA_DIST = \
 selinux_DATA = \
 	lxc.if \
 	lxc.te
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(selinuxdir); then rmdir $(DESTDIR)$(selinuxdir); fi

From 7308976c98040f634440d7783d71e3fc9db62b33 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:36:03 -0300
Subject: [PATCH 08/15] removing double quotes enable sysconfigdir to be
 correctly removed by make uninstall

---
 config/sysconfig/Makefile.am | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/config/sysconfig/Makefile.am b/config/sysconfig/Makefile.am
index 3829a01c58..8cba72f332 100644
--- a/config/sysconfig/Makefile.am
+++ b/config/sysconfig/Makefile.am
@@ -1,6 +1,5 @@
-sysconfigdir="@LXC_DISTRO_SYSCONF@"
+sysconfigdir=@LXC_DISTRO_SYSCONF@
 
-sysconfig_DATA = \
-	lxc
+sysconfig_DATA = lxc
 
 EXTRA_DIST = $(sysconfig_DATA)

From 93ef0091355b0dc610e3b1e2e18508ee38fbe875 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:37:37 -0300
Subject: [PATCH 09/15] add templatesconfigdir to be removed by make uninstall

---
 config/templates/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/config/templates/Makefile.am b/config/templates/Makefile.am
index 3ec5809100..e89f41ca85 100644
--- a/config/templates/Makefile.am
+++ b/config/templates/Makefile.am
@@ -9,3 +9,6 @@ templatesconfig_DATA = common.conf \
 		       nesting.conf \
 		       oci.common.conf \
 		       userns.conf
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(templatesconfigdir); then rmdir $(DESTDIR)$(templatesconfigdir); fi

From 33b510dd4bdc71ff25d147a017a2ebea09a78da7 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:39:40 -0300
Subject: [PATCH 10/15] rename templatesconfigdir to commonconfddir and add it
 to be removed by make uninstall

---
 config/templates/common.conf.d/Makefile.am | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/templates/common.conf.d/Makefile.am b/config/templates/common.conf.d/Makefile.am
index b974249058..418620af00 100644
--- a/config/templates/common.conf.d/Makefile.am
+++ b/config/templates/common.conf.d/Makefile.am
@@ -1,6 +1,9 @@
-templatesconfigdir=@LXCTEMPLATECONFIG@/common.conf.d/
+commonconfddir=@LXCTEMPLATECONFIG@/common.conf.d/
 
 EXTRA_DIST = README
 
-templatesconfig_DATA = \
+commonconfd_DATA = \
 	README
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(commonconfddir); then rmdir $(DESTDIR)$(commonconfddir); fi

From 7f8e8f913cd11639acf7547e632ecbbc83097096 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:40:26 -0300
Subject: [PATCH 11/15] add docdir to be removed by make uninstall

---
 doc/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 29abd01543..556ee927f9 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -77,3 +77,6 @@ lxc-%.sgml : common_options.sgml see_also.sgml
 clean-local:
 	$(RM) manpage.* *.7 *.5 *.1 *.8 $(man_MANS)
 endif
+
+uninstall-local:
+	if test -d $(DESTDIR)$(docdir); then rmdir $(DESTDIR)$(docdir); fi

From 70378a01568c7638e3aa2ad2e05d75e9983435b7 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:40:45 -0300
Subject: [PATCH 12/15] add pkgexamplesdir to be removed by make uninstall

---
 doc/examples/Makefile.am | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index a420dfab2d..3da24f2ac1 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -12,6 +12,10 @@ pkgexamples_DATA = \
 	seccomp-v1.conf \
 	seccomp-v2-blacklist.conf \
 	seccomp-v2.conf
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(pkgexamplesdir); then rmdir $(DESTDIR)$(pkgexamplesdir); fi
+
 endif
 
 noinst_DATA = \
@@ -30,3 +34,5 @@ EXTRA_DIST = \
 	seccomp-v1.conf \
 	seccomp-v2-blacklist.conf \
 	seccomp-v2.conf
+
+

From add4140e3e81b12a6d78a3a79a8a40179bba87d5 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:45:06 -0300
Subject: [PATCH 13/15] add hooksdir and datadir/lxc to be removed by make
 uninstall

---
 hooks/Makefile.am | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hooks/Makefile.am b/hooks/Makefile.am
index 5ae73d72c5..8a76159115 100644
--- a/hooks/Makefile.am
+++ b/hooks/Makefile.am
@@ -22,3 +22,7 @@ unmount_namespace_SOURCES += \
 endif
 
 EXTRA_DIST=$(hooks_SCRIPTS)
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(hooksdir); then rmdir $(DESTDIR)$(hooksdir); fi
+	if test -d $(DESTDIR)$(datadir)/lxc; then rmdir $(DESTDIR)$(datadir)/lxc; fi

From f81bf7014d48e6b1b454633bb889b32a2f46385c Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:47:33 -0300
Subject: [PATCH 14/15] add prefix/include/lxc to be removed by make uninstall
 and remove manually installed file lxc.functions

---
 src/lxc/Makefile.am | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am
index 4b18ac5d82..7d5cea4852 100644
--- a/src/lxc/Makefile.am
+++ b/src/lxc/Makefile.am
@@ -490,9 +490,13 @@ install-exec-hook:
 	chmod u+s $(DESTDIR)$(libexecdir)/lxc/lxc-user-nic
 endif
 
+uninstall-hook:
+	if test -d $(DESTDIR)$(pkgincludedir); then rmdir $(DESTDIR)$(pkgincludedir); fi
+
 uninstall-local:
 	$(RM) $(DESTDIR)$(libdir)/liblxc.so*
 	$(RM) $(DESTDIR)$(libdir)/liblxc.a
+	rm -f $(DESTDIR)$(datadir)/lxc/lxc.functions
 if ENABLE_PAM
 if HAVE_PAM
 	$(RM) $(DESTDIR)$(pamdir)/pam_cgfs.so*

From ea8ac967aaa506ea639ae293269560c183031cd6 Mon Sep 17 00:00:00 2001
From: "Caio B. Silva" <caioboffo at gmail.com>
Date: Mon, 14 Oct 2019 17:48:11 -0300
Subject: [PATCH 15/15] add templatesdir to be removed by make uninstall

---
 templates/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/templates/Makefile.am b/templates/Makefile.am
index 15df51dffd..200647e2fb 100644
--- a/templates/Makefile.am
+++ b/templates/Makefile.am
@@ -4,3 +4,6 @@ templates_SCRIPTS = lxc-busybox \
 		    lxc-download \
 		    lxc-local \
 		    lxc-oci
+
+uninstall-hook:
+	if test -d $(DESTDIR)$(templatesdir); then rmdir $(DESTDIR)$(templatesdir); fi


More information about the lxc-devel mailing list