9663bccbeb1eaddc7d1f0452e3d061d7a742609a
[honeycomb.git] / packaging / deb / common / prepare.sh
1 #!/bin/bash
2 set -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 SOURCE_DIR=$1
8 VERSION=$(${SOURCE_DIR}/../../rpm/version)
9 RELEASE=$(${SOURCE_DIR}/../../rpm/release)
10 BUILD_DIR=${SOURCE_DIR}/honeycomb-${VERSION}
11
12 # Copy and unpack the archive with vpp-integration distribution
13 ARCHIVE_DIR=${SOURCE_DIR}/../../../vpp-integration/minimal-distribution/target/
14 ARCHIVE=${ARCHIVE_DIR}/vpp-integration-distribution-1.16.12-SNAPSHOT-hc.tar.gz
15 cp ${ARCHIVE} ${SOURCE_DIR}
16 ARCHIVE=${SOURCE_DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT-hc.tar.gz
17 tar -xf ${ARCHIVE} -C ${SOURCE_DIR}/
18
19 # Create packaging root
20 rm -rf ${BUILD_DIR}
21 mkdir ${BUILD_DIR}
22
23 # Copy contents of tar.gz
24 mv ${SOURCE_DIR}/vpp-integration-distribution-${VERSION}-SNAPSHOT/ ${BUILD_DIR}/
25 cp -r $2 ${BUILD_DIR}
26
27 # OS service definition
28 cp ${SOURCE_DIR}/$3 ${BUILD_DIR}
29
30 # Changelog file
31 cat <<EOT >> ${BUILD_DIR}/debian/changelog
32 honeycomb (${VERSION}-${RELEASE}) unstable; urgency=low
33
34   * 16.12 release
35
36  -- mmarsale <mmarsale@cisco.com>  Mon, 22 Aug 2016 09:41:37 +0200
37 EOT
38
39 # Install instructions
40 cat <<EOT >> ${BUILD_DIR}/debian/install
41 vpp-integration-distribution-${VERSION}-SNAPSHOT/* /opt/honeycomb/
42 $3 $4
43 EOT
44
45 echo ${BUILD_DIR}