From: "David Kågedal" <davidk@lysator.liu.se>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] Don't fail when an existing directory can't be created.
Date: Fri, 22 Aug 2008 10:08:46 +0200 [thread overview]
Message-ID: <87pro1pj3l.fsf@lysator.liu.se> (raw)
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
next reply other threads:[~2008-08-22 8:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 8:08 David Kågedal [this message]
2008-08-22 22:35 ` [PATCH] Don't fail when an existing directory can't be created Junio C Hamano
2008-08-23 14:29 ` David Kågedal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pro1pj3l.fsf@lysator.liu.se \
--to=davidk@lysator.liu.se \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).