-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
30 lines (26 loc) · 1.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ./Makefile
# Unlimited use with this notice. (C) 2017 George Georgalis
SHELL= /bin/sh -e
noerr?= echo "<<< $@ >>>"
arch : # push local commits and create archive from master
# c :: empty unless there are uncommitted changed to previously added files
rm -rf tmp/$@ && mkdir -p tmp/$@
cat ~/.ssh/*.pub >tmp/$@/root.pub
# c="$$(git status --short . | grep -v '^??' || true )" ; \
# [ -z "$$c" ] || { echo $$c ; false ;} # test local modifications
# git push # include local commits
# m :: remote, master url
# r :: remote fetch basename (first), archive root
# p :: prefix of pwd from r
m=$$(git remote -v show | grep fetch | awk '{print $$2}') ; \
r="$$(basename "$$m")" ; p=$$(git rev-parse --show-prefix) ; \
[ -n "$$p" ] || p="./" ; \
git archive --prefix="./$$r/" master:$$p | gzip >./tmp/$@/$$r.tgz
@$(noerr)
@ls -d ./tmp/$@/*
quick_arch : # create archive from uncommitted files
rm -rf tmp/arch && mkdir -p tmp/arch
cat ~/.ssh/*.pub >tmp/arch/root.pub
for x in dev tmp .git ; do echo "$$x" >>./tmp/arch/exclude ; done
tar -C .. -czf ../pub/tmp/arch/pub.tgz -X ./tmp/arch/exclude ./pub
@echo ./tmp/arch/pub.tgz tmp/arch/root.pub