forked from StackExchange/blackbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
129 lines (103 loc) · 4.4 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
SHELL=/bin/sh
PKGNAME=stack_blackbox
all:
@echo 'Menu:'
@echo ' make update Update any generated files'
@echo ' make packages Make RPM packages'
@echo ' make packages-deb Make DEB packages'
@echo ' make install (incomplete)'
install:
@echo 'To install, copy the files from bin to somewhere in your PATH.'
@echo 'Or, if you use RPMs, "make packages" and install the result.'
# The default package type is RPM.
packages: packages-rpm
#
# RPM builds
#
# NOTE: mk_rpm_fpmdir.stack_blackbox.txt is the master list of files. All
# other packages should generate their list from it.
packages-rpm:
cd tools && PKGRELEASE="$${PKGRELEASE}" PKGDESCRIPTION="Safely store secrets in git/hg/svn repos using GPG encryption" ./mk_rpm_fpmdir stack_blackbox mk_rpm_fpmdir.stack_blackbox.txt
packages-rpm-debug:
@echo BUILD:
@PKGRELEASE=99 make packages
@echo ITEMS TO BE PACKAGED:
find ~/rpmbuild-$(PKGNAME)/installroot -type f
@echo ITEMS ACTUALLY IN PACKAGE:
@rpm -qpl $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt)
local-rpm:
@PKGRELEASE=1 make packages
-@sudo rpm -e $(PKGNAME)
sudo rpm -i $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt)
lock-rpm:
sudo yum versionlock add $(PKGNAME)
unlock-rpm:
sudo yum versionlock clear
#
# Manual install
#
manual-install:
@echo 'Symlinking files from ./bin to /usr/local/bin'
@cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do ln -fs `pwd`/$$f /usr/local/bin/$$f; done
@echo 'Done.'
manual-uninstall:
@echo 'Removing blackbox files from /usr/local/bin'
@cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do rm /usr/local/bin/$$f; done
@echo 'Done.'
#
# DEB builds
#
packages-deb: tools/mk_deb_fpmdir.stack_blackbox.txt
cd tools && PKGRELEASE="$${PKGRELEASE}" PKGDESCRIPTION="Safely store secrets in git/hg/svn repos using GPG encryption" ./mk_deb_fpmdir stack_blackbox mk_deb_fpmdir.stack_blackbox.txt
# Make mk_deb_fpmdir.vcs_blackbox.txt from mk_rpm_fpmdir.stack_blackbox.txt:
tools/mk_deb_fpmdir.stack_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
sed -e '/^#/d' -e 's@/usr/blackbox/bin/@/usr/bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
packages-deb-debug: tools/mk_deb_fpmdir.stack_blackbox.txt
@echo BUILD:
@PKGRELEASE=99 make packages-deb
@echo ITEMS TO BE PACKAGED:
find ~/debbuild-$(PKGNAME)/installroot -type f
@echo ITEMS ACTUALLY IN PACKAGE:
@dpkg --contents $$(cat ~/debbuild-$(PKGNAME)/bin-packages.txt)
local-deb:
@PKGRELEASE=1 make packages
-@sudo dpkg -e $(PKGNAME)
sudo dpkg -i $$(cat ~/rpmbuild-$(PKGNAME)/bin-packages.txt)
#
# MacPorts builds
#
# To test:
# rm -rf /tmp/foo ; mkdir -p /tmp/foo;make packages-macports DESTDIR=/tmp/foo;find /tmp/foo -ls
# Make mk_macports.vcs_blackbox.txt from mk_rpm_fpmdir.stack_blackbox.txt:
tools/mk_macports.vcs_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
sed -e '/^#/d' -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
# MacPorts expects to run: make packages-macports DESTDIR=${destroot}
packages-macports: tools/mk_macports.vcs_blackbox.txt
mkdir -p $(DESTDIR)/bin
cd tools && ./mk_macports mk_macports.vcs_blackbox.txt
# stow is a pretty easy way to manage simple local installs on GNU systems
install-stow:
mkdir -p /usr/local/stow/blackbox/bin
cp bin/* /usr/local/stow/blackbox/bin
rm /usr/local/stow/blackbox/bin/Makefile
cd /usr/local/stow; stow -R blackbox
uninstall-stow:
cd /usr/local/stow; stow -D blackbox
rm -rf /usr/local/stow/blackbox
# Add other package types here.
#
# Updates
#
update: tools/mk_deb_fpmdir.stack_blackbox.txt tools/mk_macports.vcs_blackbox.txt
clean:
rm tools/mk_deb_fpmdir.stack_blackbox.txt tools/mk_macports.vcs_blackbox.txt
#
# System Test:
#
confidence:
@if [ -e ~/.gnupg ]; then echo ERROR: '~/.gnupg should not exist. If it does, bugs may polute your .gnupg configuration. If the code has no bugs everything will be fine. Do you feel lucky?'; false ; fi
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; rm -rf /tmp/tmp.* ; fi
@export PATH="$(PWD)/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:$(PATH)" ; tools/confidence_test.sh
tools/confidence_test.sh
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; fi
@if [ -e ~/.gnupg ]; then echo ERROR: '~/.gnupg was created which means the scripts might be poluting GnuPG configuration. Fix this bug.'; false ; fi