git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't fail when an existing directory can't be created.
@ 2008-08-22  8:08 David Kågedal
  2008-08-22 22:35 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: David Kågedal @ 2008-08-22  8:08 UTC (permalink / raw)
  To: Git Mailing List

This makes it possible to install in a writable directory not owned by
the current user.
---
 Documentation/Makefile |    8 ++++----
 Makefile               |    4 ++--
 gitk-git/Makefile      |    2 +-
 templates/Makefile     |   10 +++++-----
 4 files changed, 12 insertions(+), 12 deletions(-)

I install git in /usr/local/*, to which I have write permission, but
I'm not necessarily the owner of. The permissions may look something
like this:

  drwxrwxr-x 2 root adm 4096 2008-08-07 17:54 /usr/local/bin/

To do this I set prefix=/usr/local and run "make install".
Unfortunately, this fails miserably because the install rules insist
on changing the permissions on any directory it installs to to
755. This of course fails because I'm not the owner. And even if it
worked, I wouldn't want it to do that.

This patch is just a simple fix to make the install not abort when it
fails to modify the directory permissions, but I have to ask why it
tries to do this at all? Most other programs I have built and
installed do not try to do this.

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 7a2130a..e6271d8 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -87,15 +87,15 @@ man7: $(DOC_MAN7)
 info: git.info gitman.info
 
 install: man
-	$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
-	$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
-	$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
+	-$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
+	-$(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
+	-$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
 	$(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir)
 	$(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir)
 	$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
 
 install-info: info
-	$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
+	-$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 	$(INSTALL) -m 644 git.info gitman.info $(DESTDIR)$(infodir)
 	if test -r $(DESTDIR)$(infodir)/dir; then \
 	  $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) git.info ;\
diff --git a/Makefile b/Makefile
index e8712e0..e6bb411 100644
--- a/Makefile
+++ b/Makefile
@@ -1341,8 +1341,8 @@ gitexec_instdir_SQ = $(subst ','\'',$(gitexec_instdir))
 export gitexec_instdir
 
 install: all
-	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
-	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
+	-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
+	-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'
 	$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X '$(DESTDIR_SQ)$(bindir_SQ)'
 	$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
diff --git a/gitk-git/Makefile b/gitk-git/Makefile
index e1b6045..117b841 100644
--- a/gitk-git/Makefile
+++ b/gitk-git/Makefile
@@ -41,7 +41,7 @@ all:: gitk-wish $(ALL_MSGFILES)
 
 install:: all
 	$(INSTALL) -m 755 gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
-	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'
+	-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(msgsdir_SQ)'
 	$(foreach p,$(ALL_MSGFILES), $(INSTALL) -m 644 $p '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
 
 uninstall::
diff --git a/templates/Makefile b/templates/Makefile
index 67be379..58f2bdd 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -26,10 +26,10 @@ boilerplates.made : $(bpsrc)
 	$(QUIET)ls *--* 2>/dev/null | \
 	while read boilerplate; \
 	do \
-		case "$$boilerplate" in *~) continue ;; esac && \
-		dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
-		dir=`expr "$$dst" : '\(.*\)/'` && \
-		$(INSTALL) -d -m 755 blt/$$dir && \
+		case "$$boilerplate" in *~) continue ;; esac ; \
+		dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` ; \
+		dir=`expr "$$dst" : '\(.*\)/'` ; \
+		$(INSTALL) -d -m 755 blt/$$dir ; \
 		case "$$boilerplate" in \
 		*--) ;; \
 		*) cp -p $$boilerplate blt/$$dst ;; \
@@ -46,6 +46,6 @@ clean:
 	$(RM) -r blt boilerplates.made
 
 install: all
-	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
+	-$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
 	(cd blt && $(TAR) cf - .) | \
 	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xf -)
-- 
1.6.0.rc2.7.gbf8a


-- 
David Kågedal

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-23 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22  8:08 [PATCH] Don't fail when an existing directory can't be created David Kågedal
2008-08-22 22:35 ` Junio C Hamano
2008-08-23 14:29   ` David Kågedal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).