2014-08-26 16:26:25 -04:00
SHELL = /bin/sh
2020-02-01 10:10:25 -05:00
PREFIX ?= /usr/local
2014-08-28 20:47:32 +00:00
PKGNAME = stack_blackbox
2016-05-20 16:15:15 -06:00
BASEDIR ?= $( HOME)
2016-05-20 15:08:46 -06:00
OUTPUTDIR ?= " $( BASEDIR) /debbuild- ${ PKGNAME } "
2014-08-28 20:47:32 +00:00
2014-08-26 16:26:25 -04:00
all :
@echo 'Menu:'
2018-02-22 13:46:42 -05:00
@echo ' make update Update any generated files'
@echo ' make packages-rpm Make RPM packages'
@echo ' make packages-deb Make DEB packages'
2020-02-01 10:10:25 -05:00
@echo ' make symlinks-install Make symlinks in ${PREFIX}/bin/'
@echo ' make copy-install Copy "bin" files to ${PREFIX}/bin/'
@echo ' make copy-uninstall Remove blackbox files from ${PREFIX}/bin/'
2018-02-22 13:46:42 -05:00
@echo ' make test Run tests'
2014-08-26 16:26:25 -04:00
install :
@echo 'To install, copy the files from bin to somewhere in your PATH.'
2018-02-22 13:46:42 -05:00
@echo 'The README.md document gives more details.'
@echo 'Or run "make" (with no options) for more info.'
2014-08-28 20:47:32 +00:00
2014-11-17 15:38:03 +00:00
# The default package type is RPM.
packages : packages -rpm
#
# RPM builds
#
2015-06-02 15:37:06 +00:00
# NOTE: mk_rpm_fpmdir.stack_blackbox.txt is the master list of files. All
# other packages should generate their list from it.
2014-11-17 15:38:03 +00:00
packages-rpm :
2015-01-29 16:43:26 -05:00
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
2014-11-17 15:38:03 +00:00
packages-rpm-debug :
2014-08-28 20:47:32 +00:00
@echo BUILD:
@PKGRELEASE= 99 make packages
@echo ITEMS TO BE PACKAGED:
2016-02-26 13:28:01 -08:00
find $( BASEDIR) /rpmbuild-$( PKGNAME) /installroot -type f
2014-08-28 20:47:32 +00:00
@echo ITEMS ACTUALLY IN PACKAGE:
2016-02-26 13:28:01 -08:00
@rpm -qpl $$ ( cat $( BASEDIR) /rpmbuild-$( PKGNAME) /bin-packages.txt)
2014-08-28 20:47:32 +00:00
2014-11-17 15:38:03 +00:00
local-rpm :
2014-08-28 20:47:32 +00:00
@PKGRELEASE= 1 make packages
-@sudo rpm -e $( PKGNAME)
2016-02-26 13:28:01 -08:00
sudo rpm -i $$ ( cat $( BASEDIR) /rpmbuild-$( PKGNAME) /bin-packages.txt)
2014-08-28 20:47:32 +00:00
2014-11-17 15:38:03 +00:00
lock-rpm :
2014-08-28 20:47:32 +00:00
sudo yum versionlock add $( PKGNAME)
2014-11-17 15:38:03 +00:00
unlock-rpm :
2014-08-28 20:47:32 +00:00
sudo yum versionlock clear
2014-08-29 20:21:02 +00:00
2015-09-01 17:20:03 -07:00
#
# Manual install
#
2018-02-22 13:46:42 -05:00
symlinks-install :
2020-02-01 10:10:25 -05:00
@echo " Symlinking files from ./bin to ${ PREFIX } /bin "
@cd bin && for f in ` find . -type f -iname "*" ! -iname "Makefile" ` ; do ln -fs ` pwd ` /$$ f $( PREFIX) /bin/$$ f; done
2015-09-01 17:20:03 -07:00
@echo 'Done.'
2018-06-15 18:04:07 -06:00
manual-install :
@echo '***************************************************************'
@echo '* DEPRECATED *'
@echo '* `make manual-install` is now called `make symlinks-install` *'
@echo '***************************************************************'
$( MAKE) symlinks-install
2018-02-22 13:46:42 -05:00
copy-install :
2020-02-01 10:10:25 -05:00
@echo " Copying files from ./bin to ${ PREFIX } /bin "
@cd bin && for f in ` find . -type f -iname "*" ! -iname "Makefile" ` ; do cp ` pwd ` /$$ f $( PREFIX) /bin/$$ f; done
2018-02-22 13:46:42 -05:00
@echo 'Done.'
2020-02-01 10:10:25 -05:00
copy-uninstall :
@echo " Removing blackbox files from ${ PREFIX } /bin "
@cd bin && for f in ` find . -type f -iname "*" ! -iname "Makefile" ` ; do rm $( PREFIX) /bin/$$ f; done
2015-09-01 17:20:03 -07:00
@echo 'Done.'
2015-03-01 14:37:07 -08:00
#
# DEB builds
#
2015-03-01 14:58:09 -08:00
packages-deb : tools /mk_deb_fpmdir .stack_blackbox .txt
2016-02-26 13:28:01 -08:00
cd tools && OUTPUTDIR = $( OUTPUTDIR) 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
2015-02-28 20:44:28 -08:00
2015-06-02 15:37:06 +00:00
# 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
2015-07-09 22:52:42 -07:00
sed -e '/^#/d' -e 's@/usr/blackbox/bin/@/usr/bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
2015-06-02 15:37:06 +00:00
2015-03-01 14:58:09 -08:00
packages-deb-debug : tools /mk_deb_fpmdir .stack_blackbox .txt
2015-02-28 20:44:28 -08:00
@echo BUILD:
2015-03-01 14:37:07 -08:00
@PKGRELEASE= 99 make packages-deb
2015-02-28 20:44:28 -08:00
@echo ITEMS TO BE PACKAGED:
find ~/debbuild-$( PKGNAME) /installroot -type f
@echo ITEMS ACTUALLY IN PACKAGE:
2016-02-26 13:28:01 -08:00
@dpkg --contents $$ ( cat $( BASEDIR) /debbuild-$( PKGNAME) /bin-packages.txt)
2015-02-28 20:44:28 -08:00
local-deb :
@PKGRELEASE= 1 make packages
-@sudo dpkg -e $( PKGNAME)
2016-02-26 13:28:01 -08:00
sudo dpkg -i $$ ( cat $( BASEDIR) /rpmbuild-$( PKGNAME) /bin-packages.txt)
2015-02-28 20:44:28 -08:00
2015-06-02 15:37:06 +00:00
#
# 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
2015-07-09 22:52:42 -07:00
sed -e '/^#/d' -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
2015-06-02 15:37:06 +00:00
# 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
2015-09-01 17:20:03 -07:00
# stow is a pretty easy way to manage simple local installs on GNU systems
2015-06-14 18:01:06 -04:00
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
2014-11-17 15:38:03 +00:00
# Add other package types here.
2015-07-09 22:52:42 -07:00
#
# Updates
#
update : tools /mk_deb_fpmdir .stack_blackbox .txt tools /mk_macports .vcs_blackbox .txt
clean :
2017-09-17 17:39:14 -04:00
rm -f tools/mk_deb_fpmdir.stack_blackbox.txt tools/mk_macports.vcs_blackbox.txt
2015-07-09 22:52:42 -07:00
2014-11-17 15:38:03 +00:00
#
# System Test:
#
2017-02-22 19:31:55 +00:00
test : confidence
2014-11-02 08:39:12 -05:00
confidence :
2015-03-03 09:31:09 +07:00
@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
2014-11-05 16:47:15 +00:00
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; rm -rf /tmp/tmp.* ; fi
2022-03-16 13:29:31 -04:00
@export PATH = " $( PWD) /bin: $( PREFIX) /bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:/usr/local/MacGPG2/bin:/opt/homebrew/bin: $( PATH) " ; tools/auto_system_test
2014-11-05 16:47:15 +00:00
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; fi
2015-03-03 09:31:09 +07:00
@if [ -e ~/.gnupg ] ; then echo ERROR: '~/.gnupg was created which means the scripts might be poluting GnuPG configuration. Fix this bug.' ; false ; fi