-
Notifications
You must be signed in to change notification settings - Fork 14
/
package-deb.sh
executable file
·52 lines (42 loc) · 1.24 KB
/
package-deb.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
#!/bin/bash
set -ex
#Install Pre-req
gem install fpm
git clean -d -x -f -e node_modules
#Install dependencies
npm install --production
npm run-script bower
VERSION_NUMBER="`cat package.json | grep version | grep -o '[0-9]*\.[0-9]*\.[0-9]\+'`"
GIT_COMMIT="`git rev-parse --short HEAD`"
if [ "x$GIT_BRANCH" = "x" ]
then
GIT_BRANCH="`git for-each-ref --format='%(objectname) %(refname:short)' refs/heads | grep $GIT_COMMIT | awk '{print $2}'`"
fi
ARCH=`uname -m`
if [ ${ARCH} = "armv7l" ]
then
ARCH="armhf"
fi
CLEANGIT_BRANCH=`echo "${GIT_BRANCH}" | sed 's|/|-|g'`
if [ "$GIT_BRANCH" = "master" ]
then
PACKAGE_VERSION="$VERSION_NUMBER~~"
else
PACKAGE_VERSION="$VERSION_NUMBER~~${CLEANGIT_BRANCH}."
fi
if [ "x${BUILD_NUMBER}" = "x" ]
then
PACKAGE_VERSION="${PACKAGE_VERSION}${GIT_COMMIT}"
else
PACKAGE_VERSION="${PACKAGE_VERSION}${BUILD_NUMBER}.$GIT_COMMIT"
fi
rm -rf .git
#package
fpm -f -m [email protected] -s dir -t deb -a $ARCH \
-n openrov-dashboard \
-v ${PACKAGE_VERSION} \
--after-install=./install_lib/openrov-dashboard-afterinstall.sh \
--before-remove=./install_lib/openrov-dashboard-beforeremove.sh \
--before-install=./install_lib/openrov-dashboard-beforeinstall.sh \
--description "OpenROV Dashboard" \
.=/opt/openrov/dashboard