1
- #! /bin/bash
1
+ #! /usr/ bin/env bash
2
2
3
3
# #--------------------------------------------------------------------
4
4
# # Copyright (c) 2018 OSIsoft, LLC
16
16
# # limitations under the License.
17
17
# #--------------------------------------------------------------------
18
18
# #
19
- # # Author: Ivan Zoratti
19
+ # # Author: Ivan Zoratti, Ashish Jabble
20
20
# #
21
21
22
22
@@ -27,45 +27,54 @@ GIT_ROOT=`pwd` # The script must be executed from the root git directory
27
27
architecture=" none"
28
28
usage=" $( basename " $0 " ) {x86|arm} [clean|cleanall]
29
29
This script is used to create the Debian package of FogLAMP
30
- Arguments:
30
+ Arguments:
31
31
x86 - Build an x86_64 package
32
32
arm - Build an armv7l package
33
33
clean - Remove all the old versions saved in format .XXXX
34
34
cleanall - Remove all the versions, including the last one"
35
35
36
- for i in " $@ "
37
- do
38
- case " $i " in
39
- x86)
40
- architecture=" x86_64"
41
- shift
42
- ;;
43
- arm)
44
- architecture=" armhf"
45
- shift
46
- ;;
47
- clean)
48
- echo -n " Cleaning the build folder from older versions..."
49
- find " ${GIT_ROOT} /packages/Debian/build" -maxdepth 1 | grep ' .*\.[0-9][0-9][0-9][0-9]' | xargs rm -rf
50
- echo " Done."
51
- shift
52
- ;;
53
- cleanall)
54
- if [ -d " ${GIT_ROOT} /packages/Debian/build" ]; then
55
- echo -n " Cleaning the build folder..."
56
- rm -rf ${GIT_ROOT} /packages/Debian/build/*
57
- echo " Done."
58
- else
59
- echo " No build folder, skipping cleanall"
60
- fi
61
- shift
62
- ;;
63
- * )
64
- echo " ${usage} "
65
- exit 1
66
- ;;
67
- esac
68
- done
36
+ if [ $# -gt 0 ]
37
+ then
38
+ for i in " $@ "
39
+ do
40
+ case " $i " in
41
+ x86)
42
+ architecture=" x86_64"
43
+ shift
44
+ ;;
45
+ arm)
46
+ architecture=" armhf"
47
+ shift
48
+ ;;
49
+ clean)
50
+ echo -n " Cleaning the build folder from older versions..."
51
+ find " ${GIT_ROOT} /packages/Debian/build" -maxdepth 1 | grep ' .*\.[0-9][0-9][0-9][0-9]' | xargs rm -rf
52
+ echo " Done."
53
+ shift
54
+ ;;
55
+ cleanall)
56
+ if [ -d " ${GIT_ROOT} /packages/Debian/build" ]; then
57
+ echo -n " Cleaning the build folder..."
58
+ rm -rf ${GIT_ROOT} /packages/Debian/build/*
59
+ echo " Done."
60
+ else
61
+ echo " No build folder, skipping cleanall"
62
+ fi
63
+ shift
64
+ ;;
65
+ --help)
66
+ echo " ${usage} "
67
+ exit 1
68
+ ;;
69
+ * )
70
+ echo " Unrecognized option: $i "
71
+ exit 1
72
+ ;;
73
+ esac
74
+ done
75
+ else
76
+ echo " See help and select the architecture to use, *x86* or *arm*"
77
+ fi
69
78
70
79
# If the architecture has not been defined, then the script is complete
71
80
if [[ " $architecture " == " none" ]]; then
@@ -94,7 +103,7 @@ package_name="foglamp-${version}-${architecture}"
94
103
echo " The package root directory is : ${GIT_ROOT} "
95
104
echo " The FogLAMP directory is : ${FOGLAMP_ROOT} "
96
105
echo " The FogLAMP version is : ${version} "
97
- echo " The Package will be built in : ${BUILD_ROOT} "
106
+ echo " The package will be built in : ${BUILD_ROOT} "
98
107
echo " The architecture is set as : ${architecture} "
99
108
echo " The package name is : ${package_name} "
100
109
echo
@@ -123,7 +132,7 @@ echo -n "Populating the package and updating version in control file..."
123
132
cd " ${package_name} "
124
133
cp -R ${GIT_ROOT} /packages/Debian/common/* .
125
134
cp -R ${GIT_ROOT} /packages/Debian/${architecture} /* .
126
- sed -i " s/Version: 0.0/Version: $version /g" DEBIAN/control
135
+ sed -i " s/Version: 1. 0.0/Version: $version /g" DEBIAN/control
127
136
mkdir -p usr/local/foglamp
128
137
cd usr/local/foglamp
129
138
cp -R ${FOGLAMP_ROOT} /* .
@@ -166,4 +175,3 @@ echo "Building Complete."
166
175
167
176
168
177
exit 0
169
-
0 commit comments