2018-10-06 23:34:47 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
basedir=$(realpath "$(dirname "$0")"/..)
|
|
|
|
#tmptmpl=$(basename "$0")
|
|
|
|
#tmpd=$(mktemp -t "$tmptmpl")
|
|
|
|
tmpd=$basedir/_build/stage
|
|
|
|
manifest=$tmpd/+MANIFEST
|
|
|
|
rootdir=$tmpd/rootdir
|
|
|
|
|
|
|
|
|
|
|
|
trap 'rm -rf $tmpd' 0 INT EXIT
|
|
|
|
|
|
|
|
mkdir -p "$rootdir"/usr/local/sbin \
|
|
|
|
"$rootdir"/usr/local/libexec/albatross \
|
|
|
|
"$rootdir"/usr/local/etc/rc.d
|
|
|
|
|
|
|
|
# stage service scripts
|
|
|
|
for f in albatross_log \
|
|
|
|
albatross_stat \
|
|
|
|
albatross_console \
|
|
|
|
albatross_daemon \
|
2018-10-29 21:23:34 +00:00
|
|
|
albatross_influx \
|
2019-10-06 20:55:25 +00:00
|
|
|
albatross_tls
|
2018-10-06 23:34:47 +00:00
|
|
|
do install -U $basedir/packaging/rc.d/$f $rootdir/usr/local/etc/rc.d/$f; done
|
|
|
|
|
|
|
|
# stage albatross app binaries
|
2019-03-27 23:11:43 +00:00
|
|
|
for f in albatrossd albatross_log albatross_console albatross_influx; do
|
|
|
|
install -U $basedir/_build/default/daemon/$f.exe \
|
2018-10-06 23:34:47 +00:00
|
|
|
$rootdir/usr/local/libexec/albatross/$f; done
|
|
|
|
|
2019-03-27 23:11:43 +00:00
|
|
|
for f in albatross_tls_endpoint albatross_tls_inetd; do
|
|
|
|
install -U $basedir/_build/default/tls/$f.exe \
|
|
|
|
$rootdir/usr/local/libexec/albatross/$f; done
|
|
|
|
|
|
|
|
install -U $basedir/_build/default/stats/albatross_stats.exe \
|
|
|
|
$rootdir/usr/local/libexec/albatross/albatross_stats
|
|
|
|
|
|
|
|
install -U $basedir/_build/default/stats/albatross_stat_client.exe \
|
|
|
|
$rootdir/usr/local/sbin/albatross_stat_client
|
|
|
|
|
|
|
|
for f in albatross_client_local albatross_client_remote_tls albatross_client_bistro; do
|
|
|
|
install -U $basedir/_build/default/client/$f.exe \
|
|
|
|
$rootdir/usr/local/sbin/$f; done
|
|
|
|
|
|
|
|
for f in albatross_provision_ca albatross_provision_request; do
|
|
|
|
install -U $basedir/_build/default/provision/$f.exe \
|
2018-10-28 22:18:07 +00:00
|
|
|
$rootdir/usr/local/sbin/$f; done
|
2018-10-06 23:34:47 +00:00
|
|
|
|
|
|
|
# create +MANIFEST
|
|
|
|
flatsize=$(find "$rootdir" -type f -exec stat -f %z {} + |
|
|
|
|
awk 'BEGIN {s=0} {s+=$1} END {print s}')
|
|
|
|
|
|
|
|
gitver=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
sed -e "s:%%GITVER%%:${gitver}:" -e "s:%%FLATSIZE%%:${flatsize}:" \
|
|
|
|
"$basedir/packaging/MANIFEST" > "$manifest"
|
|
|
|
|
|
|
|
{
|
|
|
|
printf '\nfiles {\n'
|
2018-10-31 22:20:44 +00:00
|
|
|
find "$rootdir" -type f -exec sha256 -r {} + | sort |
|
2018-10-06 23:34:47 +00:00
|
|
|
awk '{print " " $2 ": \"" $1 "\"," }'
|
2018-10-31 22:20:44 +00:00
|
|
|
find "$rootdir" -type l | sort |
|
2018-10-06 23:34:47 +00:00
|
|
|
awk "{print \" \"\$1 \": -,\"}"
|
|
|
|
printf '}\n'
|
|
|
|
} | sed -e "s:${rootdir}::" >> "$manifest"
|
|
|
|
|
2018-10-31 22:44:06 +00:00
|
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=format:%ct)
|
2018-10-06 23:34:47 +00:00
|
|
|
pkg create -r "$rootdir" -M "$manifest" -o $basedir/_build/
|