Merge pull request #49 from law/master
adding rudimentary debian package building support
This commit is contained in:
27
Makefile
27
Makefile
@@ -5,6 +5,7 @@ PKGNAME=stack_blackbox
|
|||||||
all:
|
all:
|
||||||
@echo 'Menu:'
|
@echo 'Menu:'
|
||||||
@echo ' make packages Make RPM packages'
|
@echo ' make packages Make RPM packages'
|
||||||
|
@echo ' make packages-deb Make DEB packages'
|
||||||
@echo ' make install (incomplete)'
|
@echo ' make install (incomplete)'
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@@ -24,6 +25,10 @@ packages: packages-rpm
|
|||||||
tools/mk_macports.vcs_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
|
tools/mk_macports.vcs_blackbox.txt: tools/mk_rpm_fpmdir.stack_blackbox.txt
|
||||||
sed -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_fpmdir.stack_blackbox.txt >$@
|
sed -e 's@/usr/blackbox/bin/@bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_rpm_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 's@/usr/blackbox/bin/@/usr/bin/@g' -e '/profile.d-usrblackbox.sh/d' <tools/mk_deb_fpmdir.stack_blackbox.txt >$@
|
||||||
|
|
||||||
check-destdir:
|
check-destdir:
|
||||||
ifndef DESTDIR
|
ifndef DESTDIR
|
||||||
$(error DESTDIR is undefined)
|
$(error DESTDIR is undefined)
|
||||||
@@ -60,15 +65,35 @@ lock-rpm:
|
|||||||
unlock-rpm:
|
unlock-rpm:
|
||||||
sudo yum versionlock clear
|
sudo yum versionlock clear
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
# Add other package types here.
|
# Add other package types here.
|
||||||
|
|
||||||
#
|
#
|
||||||
# System Test:
|
# System Test:
|
||||||
#
|
#
|
||||||
|
|
||||||
confidence:
|
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 [ -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
|
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; rm -rf /tmp/tmp.* ; fi
|
||||||
@export PATH=~/gitwork/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin ; tools/confidence_test.sh
|
@export PATH=~/gitwork/blackbox/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin ; tools/confidence_test.sh
|
||||||
|
cd ~/gitwork/blackbox && tools/confidence_test.sh
|
||||||
@if which >/dev/null gpg-agent ; then pkill gpg-agent ; fi
|
@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
|
@if [ -e ~/.gnupg ]; then echo ERROR: '~/.gnupg was created which means the scripts might be poluting GnuPG configuration. Fix this bug.'; false ; fi
|
||||||
|
|||||||
76
tools/mk_deb_fpmdir
Executable file
76
tools/mk_deb_fpmdir
Executable file
@@ -0,0 +1,76 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
# Use fpm to package up files into a DEB .
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# mk_deb_fpmdir PACKAGENAME MANIFEST1 MANIFEST2 ...
|
||||||
|
|
||||||
|
# Example:
|
||||||
|
# Make a package foopkg manifest.txt
|
||||||
|
# Where "manifest.txt" contains:
|
||||||
|
# exec /usr/bin/stack_makefqdn misc/stack_makefqdn.py
|
||||||
|
# exec /usr/bin/bar bar/bar.sh
|
||||||
|
# read /usr/man/man1/bar.1 bar/bar.1.man
|
||||||
|
# 0444 /etc/foo.conf bar/foo.conf
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Parameters for this DEB:
|
||||||
|
PACKAGENAME=${1?"First arg must be the package name."}
|
||||||
|
shift
|
||||||
|
|
||||||
|
# Defaults that can be overridden:
|
||||||
|
# All packages are 1.0 unless otherwise specifed:
|
||||||
|
: ${PKGVERSION:=1.0} ;
|
||||||
|
# If there is no iteration setting, assume "1":
|
||||||
|
: ${PKGRELEASE:=1}
|
||||||
|
# If there is no epoch, assume 0
|
||||||
|
: ${PKGEPOCH:=0}
|
||||||
|
|
||||||
|
# The DEB is output here: (should be a place that can be wiped)
|
||||||
|
OUTPUTDIR="${HOME}/debbuild-$PACKAGENAME"
|
||||||
|
# The TeamCity templates expect to find the list of artifacts here:
|
||||||
|
DEB_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
|
||||||
|
|
||||||
|
# -- Now the real work can be done.
|
||||||
|
|
||||||
|
# Clean the output dir.
|
||||||
|
rm -rf "$OUTPUTDIR"
|
||||||
|
mkdir -p "$OUTPUTDIR/installroot"
|
||||||
|
|
||||||
|
# Copy the files into place:
|
||||||
|
set -o pipefail # Error out if any manifest is not found.
|
||||||
|
cat """$@""" | while read -a arr ; do
|
||||||
|
PERM="${arr[0]}"
|
||||||
|
case $PERM in
|
||||||
|
\#*) continue ;; # Skip comments.
|
||||||
|
exec) PERM=0755 ;;
|
||||||
|
read) PERM=0744 ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
DST="$OUTPUTDIR/installroot/${arr[1]}"
|
||||||
|
SRC="${arr[2]}"
|
||||||
|
if [[ $SRC == "cmd/"* || $SRC == *"/cmd/"* ]]; then
|
||||||
|
( cd $(dirname "$SRC" ) && go build -a -v )
|
||||||
|
fi
|
||||||
|
install -D -T -b -m "$PERM" -T "$SRC" "$DST"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Build the DEB:
|
||||||
|
cd "$OUTPUTDIR" && fpm -s dir -t deb \
|
||||||
|
-a x86_64 \
|
||||||
|
-n "${PACKAGENAME}" \
|
||||||
|
--epoch "${PKGEPOCH}" \
|
||||||
|
--version "${PKGVERSION}" \
|
||||||
|
--iteration "${PKGRELEASE}" \
|
||||||
|
${PKGDESCRIPTION:+ --description="${PKGDESCRIPTION}"} \
|
||||||
|
${PKGVENDOR:+ --vendor="${PKGVENDOR}"} \
|
||||||
|
-C "$OUTPUTDIR/installroot" \
|
||||||
|
.
|
||||||
|
|
||||||
|
# TeamCity templates for DEBS expect to find
|
||||||
|
# the list of all packages created in bin-packages.txt.
|
||||||
|
# Generate that list:
|
||||||
|
find "$OUTPUTDIR" -maxdepth 1 -name '*.deb' >"$DEB_BIN_LIST"
|
||||||
|
# Output it for debugging purposes:
|
||||||
|
cat "$DEB_BIN_LIST"
|
||||||
14
tools/mk_deb_fpmdir.stack_blackbox.txt
Normal file
14
tools/mk_deb_fpmdir.stack_blackbox.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
exec /usr/bin/_blackbox_common.sh ../bin/_blackbox_common.sh
|
||||||
|
exec /usr/bin/_stack_lib.sh ../bin/_stack_lib.sh
|
||||||
|
exec /usr/bin/blackbox_addadmin ../bin/blackbox_addadmin
|
||||||
|
exec /usr/bin/blackbox_cat ../bin/blackbox_cat
|
||||||
|
exec /usr/bin/blackbox_edit ../bin/blackbox_edit
|
||||||
|
exec /usr/bin/blackbox_edit_end ../bin/blackbox_edit_end
|
||||||
|
exec /usr/bin/blackbox_edit_start ../bin/blackbox_edit_start
|
||||||
|
exec /usr/bin/blackbox_initialize ../bin/blackbox_initialize
|
||||||
|
exec /usr/bin/blackbox_postdeploy ../bin/blackbox_postdeploy
|
||||||
|
exec /usr/bin/blackbox_register_new_file ../bin/blackbox_register_new_file
|
||||||
|
exec /usr/bin/blackbox_removeadmin ../bin/blackbox_removeadmin
|
||||||
|
exec /usr/bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files
|
||||||
|
exec /usr/bin/blackbox_update_all_files ../bin/blackbox_update_all_files
|
||||||
|
exec /usr/bin/blackbox_list_files ../bin/blackbox_list_files
|
||||||
Reference in New Issue
Block a user