1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 14:57:52 +01:00
git/templates/Makefile
Junio C Hamano d8bdc49265 Fix permission bits on sources checked out with an overtight umask
Two patches 9907721 (templates/Makefile: don't depend on local umask
setting, 2008-02-28) and 96cda0b (templates/Makefile: install is
unnecessary, just use mkdir -p, 2008-08-21) tried to prevent an overtight
umask the builder/installer might have from screwing over the installation
procedure, but we forgot there was another source of trouble.  If the
person who checked out the source tree had an overtight umask, it will
leak out to the built products, which is propagated to the installation
destination.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-09 13:32:32 -07:00

53 lines
1.4 KiB
Makefile

# make and install sample templates
ifndef V
QUIET = @
endif
INSTALL ?= install
TAR ?= tar
RM ?= rm -f
prefix ?= $(HOME)
template_instdir ?= $(prefix)/share/git-core/templates
# DESTDIR=
# Shell quote (do not use $(call) to accommodate ancient setups);
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
template_instdir_SQ = $(subst ','\'',$(template_instdir))
all: boilerplates.made custom
# Put templates that can be copied straight from the source
# in a file direc--tory--file in the source. They will be
# just copied to the destination.
bpsrc = $(filter-out %~,$(wildcard *--*))
boilerplates.made : $(bpsrc)
$(QUIET)umask 022 && 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" : '\(.*\)/'` && \
mkdir -p blt/$$dir && \
case "$$boilerplate" in \
*--) continue;; \
esac && \
cp $$boilerplate blt/$$dst && \
if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \
chmod a+$$rx "blt/$$dst" || exit; \
done && \
date >$@
# If you need build-tailored templates, build them into blt/
# directory yourself here.
custom:
$(QUIET): no custom templates yet
clean:
$(RM) -r blt boilerplates.made
install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)'
(cd blt && $(TAR) cf - .) | \
(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -)