diff mbox

[v2] btrfs-progs: Add uninstall targets to Makefiles.

Message ID 1403490228-3513-1-git-send-email-git@n-st.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Nils Steinger June 23, 2014, 2:23 a.m. UTC
Signed-off-by: Nils Steinger <git@n-st.de>
---

v2: As Satoru Takeuchi pointed out, I forgot to remove $(libs) in the main
Makefile.

 Documentation/Makefile | 4 ++++
 Makefile               | 9 +++++++++
 2 files changed, 13 insertions(+)

Comments

Satoru Takeuchi June 23, 2014, 2:33 a.m. UTC | #1
(2014/06/23 11:23), Nils Steinger wrote:
> Signed-off-by: Nils Steinger <git@n-st.de>

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

> ---
> 
> v2: As Satoru Takeuchi pointed out, I forgot to remove $(libs) in the main
> Makefile.
> 
>   Documentation/Makefile | 4 ++++
>   Makefile               | 9 +++++++++
>   2 files changed, 13 insertions(+)
> 
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index 45299bb..5c9780b 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -76,6 +76,10 @@ install-man: man
>   	$(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir)
>   	$(LNS) btrfs-check.8.gz $(DESTDIR)$(man8dir)
>   
> +uninstall:
> +	cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
> +
>   clean:
>   	$(RM) *.xml *.xml+ *.8 *.8.gz
>   
> diff --git a/Makefile b/Makefile
> index 76565e8..fe6a2f8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -257,6 +257,15 @@ $(INSTALLDIRS):
>   	@echo "Making install in $(patsubst install-%,%,$@)"
>   	$(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
>   
> +uninstall:
> +	$(Q)$(MAKE) $(MAKEOPTS) -C Documentation uninstall
> +	cd $(DESTDIR)$(incdir); rm -f $(headers)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(incdir)
> +	cd $(DESTDIR)$(libdir); rm -f $(lib_links) $(libs)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
> +	cd $(DESTDIR)$(bindir); rm -f btrfsck fsck.btrfs $(progs)
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
> +
>   ifneq ($(MAKECMDGOALS),clean)
>   -include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
>   endif
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba June 23, 2014, 3:04 p.m. UTC | #2
On Mon, Jun 23, 2014 at 04:23:48AM +0200, Nils Steinger wrote:
> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)

> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)

> +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)

I don't think it's right to remove the systemwide directories: bindir,
libdir and man8dir. There rest are btrfs subdirs (eg. incdir), that's
fine.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nils Steinger June 25, 2014, 7:40 p.m. UTC | #3
On Mon, Jun 23, 2014 at 05:04:42PM +0200, David Sterba wrote:
> On Mon, Jun 23, 2014 at 04:23:48AM +0200, Nils Steinger wrote:
> > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
> 
> > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
> 
> > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
> 
> I don't think it's right to remove the systemwide directories: bindir,
> libdir and man8dir. There rest are btrfs subdirs (eg. incdir), that's
> fine.

On my system, man8dir didn't exist prior to the installation, so I
thought it would be reasonable to have the uninstallation routine remove
it. bindir and libdir will exist by default on most systems, so that's a
different case…
So, should we really keep the directories around, even if they were
created by the installation and are now empty (if they aren't, they
won't be removed anyway)?
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba June 27, 2014, 12:32 p.m. UTC | #4
On Wed, Jun 25, 2014 at 09:40:40PM +0200, Nils Steinger wrote:
> On Mon, Jun 23, 2014 at 05:04:42PM +0200, David Sterba wrote:
> > On Mon, Jun 23, 2014 at 04:23:48AM +0200, Nils Steinger wrote:
> > > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
> > 
> > > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
> > 
> > > +	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
> > 
> > I don't think it's right to remove the systemwide directories: bindir,
> > libdir and man8dir. There rest are btrfs subdirs (eg. incdir), that's
> > fine.
> 
> On my system, man8dir didn't exist prior to the installation, so I
> thought it would be reasonable to have the uninstallation routine remove
> it.

According to the FHS [1] the manX directories do not have to exsit, so
this part shall stay.

> bindir and libdir will exist by default on most systems, so that's a
> different case…
> So, should we really keep the directories around, even if they were
> created by the installation and are now empty (if they aren't, they
> won't be removed anyway)?

But we don't track if the directories were created by the installation
or not.  Normally the directories would exist anyway (/usr or /usr/local
as prefix) and are expected to exist at the locations. Installation to
arbitraty directory works, but managing the directories is IMO up to the
user.

So are you ok with keeping bindir and libdir only (ie. removing only
man8dir)?

Thanks.

[1] http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREMANMANUALPAGES
and then note #32
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nils Steinger July 25, 2014, 1:48 p.m. UTC | #5
I apologize for the long hiatus.

On Fri, Jun 27, 2014 at 02:32:01PM +0200, David Sterba wrote:
> On Wed, Jun 25, 2014 at 09:40:40PM +0200, Nils Steinger wrote:
> > On my system, man8dir didn't exist prior to the installation, so I
> > thought it would be reasonable to have the uninstallation routine remove
> > it.
> 
> According to the FHS [1] the manX directories do not have to exsit, so
> this part shall stay.
> 
> [1] http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREMANMANUALPAGES
> and then note #32
> 
> > bindir and libdir will exist by default on most systems, so that's a
> > different case…
> > So, should we really keep the directories around, even if they were
> > created by the installation and are now empty (if they aren't, they
> > won't be removed anyway)?
> 
> But we don't track if the directories were created by the installation
> or not.  Normally the directories would exist anyway (/usr or /usr/local
> as prefix) and are expected to exist at the locations. Installation to
> arbitraty directory works, but managing the directories is IMO up to the
> user.
> 
> So are you ok with keeping bindir and libdir only (ie. removing only
> man8dir)?

Yes, that should be sensible. I've updated my patch accordingly and
resubmitted it few minutes ago.

Regards,
Nils
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 45299bb..5c9780b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -76,6 +76,10 @@  install-man: man
 	$(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir)
 	$(LNS) btrfs-check.8.gz $(DESTDIR)$(man8dir)
 
+uninstall:
+	cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
+
 clean:
 	$(RM) *.xml *.xml+ *.8 *.8.gz
 
diff --git a/Makefile b/Makefile
index 76565e8..fe6a2f8 100644
--- a/Makefile
+++ b/Makefile
@@ -257,6 +257,15 @@  $(INSTALLDIRS):
 	@echo "Making install in $(patsubst install-%,%,$@)"
 	$(Q)$(MAKE) $(MAKEOPTS) -C $(patsubst install-%,%,$@) install
 
+uninstall:
+	$(Q)$(MAKE) $(MAKEOPTS) -C Documentation uninstall
+	cd $(DESTDIR)$(incdir); rm -f $(headers)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(incdir)
+	cd $(DESTDIR)$(libdir); rm -f $(lib_links) $(libs)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(libdir)
+	cd $(DESTDIR)$(bindir); rm -f btrfsck fsck.btrfs $(progs)
+	rmdir -p --ignore-fail-on-non-empty $(DESTDIR)$(bindir)
+
 ifneq ($(MAKECMDGOALS),clean)
 -include $(objects:.o=.o.d) $(cmd-objects:.o=.o.d) $(subst .btrfs,, $(filter-out btrfsck.o.d, $(progs:=.o.d)))
 endif