prepare.sh revision b248447c
1#!/bin/bash
2set -xe
3# $1 - source dir root
4# $2 - $1/debian - just configurable for reuse
5# $3 - service definition file
6# $4 - service definition target during install
7# $5 - build dependencies file
8SOURCE_DIR=$1
9VERSION=$(${SOURCE_DIR}/../../rpm/version)
10HC2VPP_VERSION=$(${SOURCE_DIR}/../../rpm/hc2vpp_version)
11RELEASE=$(${SOURCE_DIR}/../../rpm/release)
12BUILD_DIR=${SOURCE_DIR}/honeycomb-${VERSION}
13VPP_DEPENDENCIES=$(${SOURCE_DIR}/../../deb/common/vpp_dependencies)
14BUILD_DEPENDENCIES=$($5)
15
16# Copy and unpack the archive with vpp-integration distribution
17ARCHIVE_DIR=${SOURCE_DIR}/../../../vpp-integration/minimal-distribution/target/
18ARCHIVE=${ARCHIVE_DIR}/vpp-integration-distribution-${HC2VPP_VERSION}-hc.tar.gz
19cp ${ARCHIVE} ${SOURCE_DIR}
20ARCHIVE=${SOURCE_DIR}/vpp-integration-distribution-${HC2VPP_VERSION}-hc.tar.gz
21tar -xf ${ARCHIVE} -C ${SOURCE_DIR}/
22
23# Create packaging root
24rm -rf ${BUILD_DIR}
25mkdir ${BUILD_DIR}
26
27# Copy contents of tar.gz
28mv ${SOURCE_DIR}/vpp-integration-distribution-${HC2VPP_VERSION}/ ${BUILD_DIR}/
29cp -r $2 ${BUILD_DIR}
30
31# OS service definition
32cp ${SOURCE_DIR}/$3 ${BUILD_DIR}
33
34# Changelog file
35cat <<EOT >> ${BUILD_DIR}/debian/changelog
36honeycomb (${VERSION}-${RELEASE}) unstable; urgency=low
37
38  * 19.08 release
39
40 -- mcmarada <mcmarada@cisco.com>  Thu, 18 Oct 2018 13:42:07 +0200
41EOT
42
43# Install instructions
44cat <<EOT >> ${BUILD_DIR}/debian/install
45vpp-integration-distribution-${HC2VPP_VERSION}/* /opt/honeycomb/
46$3 $4
47EOT
48
49# Generate control file
50cat <<EOT >> ${BUILD_DIR}/debian/control
51Source: honeycomb
52Section: misc
53Priority: optional
54Maintainer: fd.io/hc2vpp <hc2vpp@lists.fd.io>
55Build-Depends: ${BUILD_DEPENDENCIES}
56Standards-Version: 3.9.6
57Homepage: https://wiki.fd.io/view/Hc2vpp
58Vcs-Browser: https://git.fd.io/cgit/hc2vpp/tree/
59
60Package: honeycomb
61Architecture: all
62Depends: ${VPP_DEPENDENCIES}, openjdk-8-jre-headless
63Suggests:
64Description: Honeycomb agent for VPP
65EOT
66
67echo ${BUILD_DIR}