-
Notifications
You must be signed in to change notification settings - Fork 93
/
package-deb.sh
executable file
·54 lines (44 loc) · 1.23 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
53
54
#!/bin/bash
set -ex
#Install Pre-req
gem install fpm
git clean -d -x -f -e node_modules
#Install dependencies
npm install --production
pushd src/static
npm install --loglevel error --production
npm run bower
popd
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
if [ "$GIT_BRANCH" = "master" ]
then
PACKAGE_VERSION="$VERSION_NUMBER~~"
else
PACKAGE_VERSION="$VERSION_NUMBER~~${GIT_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-cockpit \
-v ${PACKAGE_VERSION} \
--after-install=./install_lib/openrov-cockpit-afterinstall.sh \
--before-remove=./install_lib/openrov-cockpit-beforeremove.sh \
--before-install=./install_lib/openrov-cockpit-beforeinstall.sh \
--description "OpenROV Cockpit" \
.=/opt/openrov/cockpit