This repository was archived by the owner on May 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpackage.sh
executable file
·80 lines (57 loc) · 2.36 KB
/
package.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
PACKAGE_ARCH=$1
OS=$2
DISTRO=$3
BUILD_TYPE=$4
if [ "${BUILD_TYPE}" == "docker" ]; then
cat << EOF > /etc/resolv.conf
options rotate
options timeout:1
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
fi
apt-get install -y apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/openhd/openhd-2-1/cfg/gpg/gpg.0AD501344F75A993.key' | apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/openhd/openhd-2-1-testing/cfg/gpg/gpg.58A6C96C088A96BF.key' | apt-key add -
echo "deb https://dl.cloudsmith.io/public/openhd/openhd-2-1/deb/${OS} ${DISTRO} main" > /etc/apt/sources.list.d/openhd-2-1.list
echo "deb https://dl.cloudsmith.io/public/openhd/openhd-2-1-testing/deb/${OS} ${DISTRO} main" > /etc/apt/sources.list.d/openhd-2-1-testing.list
apt -y update || exit 1
apt -y install libboost-regex-dev libasio-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev lifepoweredpi openhd python python-lxml || exit 1
curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
python2 get-pip.py
pip install future
# Create the Open.HD MAVLink dialect
pushd lib/Mavlink
./mavgenerate_dialect.py
popd
PACKAGE_NAME=openhd-microservice
TMPDIR=/tmp/${PACKAGE_NAME}-installdir
rm -rf ${TMPDIR}/*
mkdir -p ${TMPDIR} || exit 1
make clean || exit 1
make install DESTDIR=${TMPDIR} || exit 1
VERSION=$(git describe)
rm ${PACKAGE_NAME}_${VERSION//v}_${PACKAGE_ARCH}.deb > /dev/null 2>&1
fpm -a ${PACKAGE_ARCH} -s dir -t deb -n ${PACKAGE_NAME} -v ${VERSION//v} -C ${TMPDIR} \
-p ${PACKAGE_NAME}_VERSION_ARCH.deb \
-d "libasio-dev >= 1.10" \
-d "libboost-filesystem-dev >= 1.62.0" \
-d "libboost-system-dev >= 1.62.0" \
-d "libboost-regex-dev >= 1.62.0" \
-d "libboost-program-options-dev >= 1.62.0" \
-d "openhd" || exit 1
#
# Only push to cloudsmith for tags. If you don't want something to be pushed to the repo,
# don't create a tag. You can build packages and test them locally without tagging.
#
git describe --exact-match HEAD > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo "Pushing package to OpenHD repository"
cloudsmith push deb openhd/openhd-2-1/${OS}/${DISTRO} ${PACKAGE_NAME}_${VERSION//v}_${PACKAGE_ARCH}.deb
else
echo "Pushing package to OpenHD testing repository"
cloudsmith push deb openhd/openhd-2-1-testing/${OS}/${DISTRO} ${PACKAGE_NAME}_${VERSION//v}_${PACKAGE_ARCH}.deb
fi