Skip to content

Commit e0fd3b6

Browse files
author
Ivan Zoratti
authored
Merge pull request #2 from foglamp/FOGL-1209a
FOGL-1209a - added clean and cleanall
2 parents fea9646 + f3a0e1e commit e0fd3b6

File tree

2 files changed

+69
-19
lines changed

2 files changed

+69
-19
lines changed

README.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ The repository contains the following set of files:
2929
- In the *build* folder, folders and files that have a sequence number are a previous package build.
3030

3131

32+
The make_deb Script
33+
===================
34+
35+
.. code-block:: console
36+
37+
$ ./make_deb --help
38+
make_deb {x86|arm} [clean|cleanall]
39+
This script is used to create the Debian package of FogLAMP
40+
Arguments:
41+
x86 - Build an x86_64 package
42+
arm - Build an armv7l package
43+
clean - Remove all the old versions saved in format .XXXX
44+
cleanall - Remove all the versions, including the last one
45+
$
46+
47+
3248
Building a Package
3349
==================
3450

@@ -91,4 +107,9 @@ If you execute the ``make_deb`` command again, you will see:
91107
92108
... where the previous build is now marked with the suffix *.0001*.
93109

94-
110+
111+
Cleaning the Package Folder
112+
===========================
113+
114+
Use the ``clean`` option to remove all the old packages and the files used to make the package.
115+
Use the ``cleanall`` option to remove all the packages and the files used to make the package.

make_deb

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,55 @@
2222

2323
set -e
2424

25-
usage="$(basename "$0") {x86|arm}
25+
GIT_ROOT=`pwd` # The script must be executed from the root git directory
26+
27+
architecture="none"
28+
usage="$(basename "$0") {x86|arm} [clean|cleanall]
2629
This script is used to create the Debian package of FogLAMP
2730
Arguments:
28-
x86 - Build an x86_64 package
29-
arm - Build an armv7l package"
30-
31-
GIT_ROOT=`pwd` # The script must be executed from the root git directory
31+
x86 - Build an x86_64 package
32+
arm - Build an armv7l package
33+
clean - Remove all the old versions saved in format .XXXX
34+
cleanall - Remove all the versions, including the last one"
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
69+
70+
# If the architecture has not been defined, then the script is complete
71+
if [[ "$architecture" == "none" ]]; then
72+
exit 0
73+
fi
3274

3375
# Check FOGLAMP_ROOT
3476
if [ -z ${FOGLAMP_ROOT+x} ]; then
@@ -45,19 +87,6 @@ fi
4587
version=`cat ${FOGLAMP_ROOT}/VERSION | tr -d ' ' | grep 'foglamp_version=' | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'`
4688
BUILD_ROOT="${GIT_ROOT}/packages/Debian/build"
4789

48-
case "$1" in
49-
x86)
50-
architecture="x86_64"
51-
;;
52-
arm)
53-
architecture="armhf"
54-
;;
55-
*)
56-
echo "${usage}"
57-
exit 1
58-
;;
59-
esac
60-
6190
# Final package name
6291
package_name="foglamp-${version}-${architecture}"
6392

0 commit comments

Comments
 (0)