forked from RackHD/RackHD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HWIMO-BUILD
executable file
·41 lines (31 loc) · 1.12 KB
/
HWIMO-BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
###########################################
# Build debian packages
###########################################
set -e
set -x
rm -rf packagebuild
git clone . packagebuild
pushd packagebuild
cp -r ../debian .
wget https://raw.githubusercontent.com/RackHD/RackHD/master/packer/ansible/roles/monorail/files/config.json -O config.json
# If PKG_VERSION is not set as an environment variable
# compute it as below:
if [ -z "$PKG_VERSION" ];then
GIT_COMMIT_DATE=$(git show -s --pretty="format:%ci")
DATE_STRING=$(date -d "$GIT_COMMIT_DATE" -u +"%Y%m%dUTC")
GIT_COMMIT_HASH=$(git show -s --pretty="format:%h")
CHANGELOG_VERSION=$(dpkg-parsechangelog --show-field Version)
PKG_VERSION="$CHANGELOG_VERSION-$DATE_STRING-$GIT_COMMIT_HASH"
fi
echo $PKG_VERSION
if [[ $PKG_VERSION =~ ^([0-9]+\.){2}[0-9]+$ ]];then
# If version looks like 1.2.3, the build is official build.
# So update the distribution of changelog from "UNRELEASED" to "unstable"
dch -r ""
else
COMMIT_STR=`git log -n 1 --oneline`
dch -v $PKG_VERSION -u low $COMMIT_STR -b -m
fi
debuild --no-lintian --no-tgz-check -us -uc
popd