Rework package build to use mk_rpm_fpmdir new filenames
This commit is contained in:
3
Makefile
3
Makefile
@@ -1,5 +1,4 @@
|
|||||||
SHELL=/bin/sh
|
SHELL=/bin/sh
|
||||||
BIN=tools
|
|
||||||
|
|
||||||
PKGNAME=stack_blackbox
|
PKGNAME=stack_blackbox
|
||||||
|
|
||||||
@@ -20,7 +19,7 @@ packages: packages-rpm
|
|||||||
#
|
#
|
||||||
|
|
||||||
packages-rpm:
|
packages-rpm:
|
||||||
PKGRELEASE="$${PKGRELEASE}" $(BIN)/build_rpm.sh stack_blackbox tools/rpm_filelist.txt
|
cd tools && PKGRELEASE="$${PKGRELEASE}" PKGDESCRIPTION="Safely store secrets in git/hg/svn repos using GPG encryption" ./mk_rpm_fpmdir stack_blackbox mk_rpm_fpmdir.blackbox.txt
|
||||||
|
|
||||||
packages-rpm-debug:
|
packages-rpm-debug:
|
||||||
@echo BUILD:
|
@echo BUILD:
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
#!/bin/bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
# build_rpm.sh - Build an RPM of these files. (uses FPM)
|
# Use fpm to package up files into an RPM.
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# make_rpm.sh PACKAGENAME MANIFEST1 MANIFEST2 ...
|
# mk_rpm_fpmdir PACKAGENAME MANIFEST1 MANIFEST2 ...
|
||||||
|
|
||||||
# Example:
|
# Example:
|
||||||
# Make a package foopkg manifest.txt
|
# Make a package foopkg manifest.txt
|
||||||
# Where "manifest.txt" contains:
|
# Where "manifest.txt" contains:
|
||||||
# exec /usr/bin/foo foo/foo
|
# exec /usr/bin/stack_makefqdn misc/stack_makefqdn.py
|
||||||
# exec /usr/bin/bar bar/bar.sh
|
# exec /usr/bin/bar bar/bar.sh
|
||||||
# read /usr/man/man1/bar.1 bar/bar.1.man
|
# read /usr/man/man1/bar.1 bar/bar.1.man
|
||||||
# 0444 /etc/foo.conf bar/foo.conf
|
# 0444 /etc/foo.conf bar/foo.conf
|
||||||
#
|
|
||||||
# Col1 chmod-style permissions or "exec" for 0755, "read" for 0744.
|
|
||||||
# Col2 Installation location.
|
|
||||||
# Col3 Source of the file.
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -23,7 +19,7 @@ set -e
|
|||||||
PACKAGENAME=${1?"First arg must be the package name."}
|
PACKAGENAME=${1?"First arg must be the package name."}
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# Defaults that can be overridden via env variables:
|
# Defaults that can be overridden:
|
||||||
# All packages are 1.0 unless otherwise specifed:
|
# All packages are 1.0 unless otherwise specifed:
|
||||||
: ${PKGVERSION:=1.0} ;
|
: ${PKGVERSION:=1.0} ;
|
||||||
# If there is no iteration setting, assume "1":
|
# If there is no iteration setting, assume "1":
|
||||||
@@ -31,7 +27,7 @@ shift
|
|||||||
|
|
||||||
# The RPM is output here: (should be a place that can be wiped)
|
# The RPM is output here: (should be a place that can be wiped)
|
||||||
OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME"
|
OUTPUTDIR="${HOME}/rpmbuild-$PACKAGENAME"
|
||||||
# Our build system expects to find the list of artifacts here:
|
# The TeamCity templates expect to find the list of artifacts here:
|
||||||
RPM_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
|
RPM_BIN_LIST="${OUTPUTDIR}/bin-packages.txt"
|
||||||
|
|
||||||
# -- Now the real work can be done.
|
# -- Now the real work can be done.
|
||||||
@@ -41,19 +37,20 @@ rm -rf "$OUTPUTDIR"
|
|||||||
mkdir -p "$OUTPUTDIR/installroot"
|
mkdir -p "$OUTPUTDIR/installroot"
|
||||||
|
|
||||||
# Copy the files into place:
|
# Copy the files into place:
|
||||||
cat """$@""" | grep -v '^$' | while read -a arr ; do
|
cat """$@""" | while read -a arr ; do
|
||||||
PERM="${arr[0]}"
|
PERM="${arr[0]}"
|
||||||
DEST="${arr[1]}"
|
|
||||||
SRC="${arr[2]}"
|
|
||||||
echo ========== "$PERM $DEST"
|
|
||||||
case $PERM in
|
case $PERM in
|
||||||
\#*) continue ;; # Skip comments.
|
\#*) continue ;; # Skip comments.
|
||||||
exec) PERM=0755 ;;
|
exec) PERM=0755 ;;
|
||||||
read) PERM=0744 ;;
|
read) PERM=0744 ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
FULLDEST="$OUTPUTDIR/installroot/${arr[1]}"
|
DST="$OUTPUTDIR/installroot/${arr[1]}"
|
||||||
install -D -T -b -m "$PERM" -T "$SRC" "$FULLDEST"
|
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
|
done
|
||||||
|
|
||||||
# Build the RPM:
|
# Build the RPM:
|
||||||
@@ -63,13 +60,13 @@ cd "$OUTPUTDIR" && fpm -s dir -t rpm \
|
|||||||
-n "${PACKAGENAME}" \
|
-n "${PACKAGENAME}" \
|
||||||
--version "${PKGVERSION}" \
|
--version "${PKGVERSION}" \
|
||||||
--iteration "${PKGRELEASE}" \
|
--iteration "${PKGRELEASE}" \
|
||||||
--description 'Safely store secrets in Git/Hg repos using GPG encryption' \
|
|
||||||
-C "$OUTPUTDIR/installroot" \
|
-C "$OUTPUTDIR/installroot" \
|
||||||
|
--description="$PKGDESCRIPTION" \
|
||||||
.
|
.
|
||||||
|
|
||||||
# Our build system expects to find the list of all packages created
|
# TeamCity templates for RPMS expect to find
|
||||||
# in bin-packages.txt. Generate that list:
|
# the list of all packages created in bin-packages.txt.
|
||||||
|
# Generate that list:
|
||||||
find "$OUTPUTDIR" -maxdepth 1 -name '*.rpm' >"$RPM_BIN_LIST"
|
find "$OUTPUTDIR" -maxdepth 1 -name '*.rpm' >"$RPM_BIN_LIST"
|
||||||
# Output the list for debugging purposes:
|
# Output it for debugging purposes:
|
||||||
echo ========== "$RPM_BIN_LIST"
|
|
||||||
cat "$RPM_BIN_LIST"
|
cat "$RPM_BIN_LIST"
|
||||||
14
tools/mk_rpm_fpmdir.blackbox.txt
Normal file
14
tools/mk_rpm_fpmdir.blackbox.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
read /etc/profile.d/usrblackbox.sh profile.d-usrblackbox.sh
|
||||||
|
exec /usr/blackbox/bin/_blackbox_common.sh ../bin/_blackbox_common.sh
|
||||||
|
exec /usr/blackbox/bin/_stack_lib.sh ../bin/_stack_lib.sh
|
||||||
|
exec /usr/blackbox/bin/blackbox_addadmin ../bin/blackbox_addadmin
|
||||||
|
exec /usr/blackbox/bin/blackbox_cat ../bin/blackbox_cat
|
||||||
|
exec /usr/blackbox/bin/blackbox_edit ../bin/blackbox_edit
|
||||||
|
exec /usr/blackbox/bin/blackbox_edit_end ../bin/blackbox_edit_end
|
||||||
|
exec /usr/blackbox/bin/blackbox_edit_start ../bin/blackbox_edit_start
|
||||||
|
exec /usr/blackbox/bin/blackbox_initialize ../bin/blackbox_initialize
|
||||||
|
exec /usr/blackbox/bin/blackbox_postdeploy ../bin/blackbox_postdeploy
|
||||||
|
exec /usr/blackbox/bin/blackbox_register_new_file ../bin/blackbox_register_new_file
|
||||||
|
exec /usr/blackbox/bin/blackbox_removeadmin ../bin/blackbox_removeadmin
|
||||||
|
exec /usr/blackbox/bin/blackbox_shred_all_files ../bin/blackbox_shred_all_files
|
||||||
|
exec /usr/blackbox/bin/blackbox_update_all_files ../bin/blackbox_update_all_files
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
read /etc/profile.d/usrblackbox.sh tools/profile.d-usrblackbox.sh
|
|
||||||
exec /usr/blackbox/bin/_blackbox_common.sh bin/_blackbox_common.sh
|
|
||||||
exec /usr/blackbox/bin/_stack_lib.sh bin/_stack_lib.sh
|
|
||||||
exec /usr/blackbox/bin/blackbox_addadmin bin/blackbox_addadmin
|
|
||||||
exec /usr/blackbox/bin/blackbox_cat bin/blackbox_cat
|
|
||||||
exec /usr/blackbox/bin/blackbox_edit bin/blackbox_edit
|
|
||||||
exec /usr/blackbox/bin/blackbox_edit_end bin/blackbox_edit_end
|
|
||||||
exec /usr/blackbox/bin/blackbox_edit_start bin/blackbox_edit_start
|
|
||||||
exec /usr/blackbox/bin/blackbox_initialize bin/blackbox_initialize
|
|
||||||
exec /usr/blackbox/bin/blackbox_postdeploy bin/blackbox_postdeploy
|
|
||||||
exec /usr/blackbox/bin/blackbox_register_new_file bin/blackbox_register_new_file
|
|
||||||
exec /usr/blackbox/bin/blackbox_removeadmin bin/blackbox_removeadmin
|
|
||||||
exec /usr/blackbox/bin/blackbox_shred_all_files bin/blackbox_shred_all_files
|
|
||||||
exec /usr/blackbox/bin/blackbox_update_all_files bin/blackbox_update_all_files
|
|
||||||
Reference in New Issue
Block a user