Skip to content

Commit cee0c0e

Browse files
authored
Use color in output for better readability (#15)
1 parent 39b7ec9 commit cee0c0e

File tree

6 files changed

+117
-66
lines changed

6 files changed

+117
-66
lines changed

ubuntu1404/docker-entrypoint.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ if [ -d "${workspace_path}" ]; then
123123
echo "Error: Could not clone remote git repository, '${workspace_path}' exists"
124124
exit 1
125125
else
126-
echo "Removing ${workspace_path} ..."
126+
echo -e "\e[0;32mremoving ${workspace_path} ...\e[0m"
127127
rm -rf ${workspace_path}
128-
echo -e "\n--------\n"
128+
echo ""
129129
fi
130130
fi
131131
else
@@ -138,22 +138,21 @@ fi
138138
# Print out some environment information
139139
environment-info.sh
140140

141-
echo -e "\n--------\n"
142-
143141
# Clone the remote provided git repo and ref
144142
if [ $use_remote = true ]; then
145-
echo "Cloning $git_remote ..."
143+
echo -e "\e[0;32mcloning $git_remote ...\e[0m"
146144
git clone --quiet --depth=50 $git_remote ${workspace_path}
145+
echo ""
147146

148147
cd ${workspace_path}
149148

150-
echo "Fetching $git_ref ..."
149+
echo -e "\e[0;32mfetching $git_ref ...\e[0m"
151150
git fetch --quiet origin +$git_ref:
151+
echo ""
152152

153-
echo "Checking out $git_ref ..."
153+
echo -e "\e[0;32mchecking out $git_ref ...\e[0m"
154154
git checkout --quiet --force FETCH_HEAD
155-
156-
echo -e "\n--------\n"
155+
echo ""
157156
fi
158157

159158
# Make sure build-deb.sh script exists before going any further
@@ -163,12 +162,12 @@ if [ ! -f "${workspace_path}/packaging/build-deb.sh" ]; then
163162
fi
164163

165164
# convert LONG flags to SHORT flags for anything prior 4.12.x.x
166-
echo "Detecting CloudStack version ..."
165+
echo -e "\e[0;32mdetecting CloudStack version ...\e[0m"
167166
pom_version=$(cd ${workspace_path}; mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
168167
echo "${pom_version}"
169168
major_version=$(echo ${pom_version} | cut -d. -f1)
170169
minor_version=$(echo ${pom_version} | cut -d. -f2)
171-
echo -e "\n--------\n"
170+
echo ""
172171

173172
if [ $major_version -lt 4 ] || [ $major_version -eq 4 -a $minor_version -lt 12 ]; then
174173
if [ $show_help = true ]; then
@@ -223,6 +222,8 @@ function adjust_owner() {
223222
{
224223
cd ${workspace_path}/packaging
225224

225+
echo -e "\e[0;32mpackaging CloudStack DEB packages ...\e[0m"
226+
226227
# do the packaging
227228
bash -x ./build-deb.sh $@ && {
228229
mkdir -p ${workspace_path}/dist/debbuild/DEBS

ubuntu1404/environment-info.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,51 @@
1818

1919
set -e
2020

21-
echo -e "System information:"
21+
EXTRA_LINE=""
22+
23+
print_title() {
24+
local version_label=""
25+
if [[ "$1" = *":" ]]; then
26+
version_label=""
27+
else
28+
version_label=" version:"
29+
fi
30+
echo -e "${EXTRA_LINE}\e[1;34m$1${version_label}\e[0m"
31+
}
32+
33+
print_title "system information:"
2234
cat /etc/*-release
2335

24-
echo -e "\nGit version:"
36+
EXTRA_LINE="\n"
37+
38+
print_title "git"
2539
git --version
2640

27-
echo -e "\nJava version:"
41+
print_title "java"
2842
java -version
2943

30-
echo -e "\nMaven version:"
44+
print_title "maven"
3145
mvn --version
3246

33-
echo -e "\nPython version:"
47+
print_title "python"
3448
python --version
3549

36-
echo -e "\ndpkg version:"
50+
print_title "dpkg"
3751
dpkg --version
3852

39-
echo -e "\ndevscripts version:"
53+
print_title "devscripts"
4054
dpkg -s devscripts | grep "Version:" | awk '{print $2}'
4155

42-
echo -e "\ndebhelper version:"
56+
print_title "debhelper"
4357
dpkg -s debhelper | grep "Version:" | awk '{print $2}'
4458

45-
echo -e "\ngenisoimage version:"
59+
print_title "genisoimage"
4660
genisoimage --version
4761

48-
echo -e "\nlsb-release version:"
62+
print_title "lsb-release"
4963
dpkg -s lsb-release | grep "Version:" | awk '{print $2}'
5064

51-
echo -e "\nbuild-essential version:"
65+
print_title "build-essential"
5266
dpkg -s build-essential | grep "Version:" | awk '{print $2}'
67+
68+
echo ""

ubuntu1604/docker-entrypoint.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ if [ -d "${workspace_path}" ]; then
123123
echo "Error: Could not clone remote git repository, '${workspace_path}' exists"
124124
exit 1
125125
else
126-
echo "Removing ${workspace_path} ..."
126+
echo -e "\e[0;32mremoving ${workspace_path} ...\e[0m"
127127
rm -rf ${workspace_path}
128-
echo -e "\n--------\n"
128+
echo ""
129129
fi
130130
fi
131131
else
@@ -138,22 +138,21 @@ fi
138138
# Print out some environment information
139139
environment-info.sh
140140

141-
echo -e "\n--------\n"
142-
143141
# Clone the remote provided git repo and ref
144142
if [ $use_remote = true ]; then
145-
echo "Cloning $git_remote ..."
143+
echo -e "\e[0;32mcloning $git_remote ...\e[0m"
146144
git clone --quiet --depth=50 $git_remote ${workspace_path}
145+
echo ""
147146

148147
cd ${workspace_path}
149148

150-
echo "Fetching $git_ref ..."
149+
echo -e "\e[0;32mfetching $git_ref ...\e[0m"
151150
git fetch --quiet origin +$git_ref:
151+
echo ""
152152

153-
echo "Checking out $git_ref ..."
153+
echo -e "\e[0;32mchecking out $git_ref ...\e[0m"
154154
git checkout --quiet --force FETCH_HEAD
155-
156-
echo -e "\n--------\n"
155+
echo ""
157156
fi
158157

159158
# Make sure build-deb.sh script exists before going any further
@@ -163,12 +162,12 @@ if [ ! -f "${workspace_path}/packaging/build-deb.sh" ]; then
163162
fi
164163

165164
# convert LONG flags to SHORT flags for anything prior 4.12.x.x
166-
echo "Detecting CloudStack version ..."
165+
echo -e "\e[0;32mdetecting CloudStack version ...\e[0m"
167166
pom_version=$(cd ${workspace_path}; mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
168167
echo "${pom_version}"
169168
major_version=$(echo ${pom_version} | cut -d. -f1)
170169
minor_version=$(echo ${pom_version} | cut -d. -f2)
171-
echo -e "\n--------\n"
170+
echo ""
172171

173172
if [ $major_version -lt 4 ] || [ $major_version -eq 4 -a $minor_version -lt 12 ]; then
174173
if [ $show_help = true ]; then
@@ -223,6 +222,8 @@ function adjust_owner() {
223222
{
224223
cd ${workspace_path}/packaging
225224

225+
echo -e "\e[0;32mpackaging CloudStack DEB packages ...\e[0m"
226+
226227
# do the packaging
227228
bash -x ./build-deb.sh $@ && {
228229
mkdir -p ${workspace_path}/dist/debbuild/DEBS

ubuntu1604/environment-info.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,51 @@
1818

1919
set -e
2020

21-
echo -e "System information:"
21+
EXTRA_LINE=""
22+
23+
print_title() {
24+
local version_label=""
25+
if [[ "$1" = *":" ]]; then
26+
version_label=""
27+
else
28+
version_label=" version:"
29+
fi
30+
echo -e "${EXTRA_LINE}\e[1;34m$1${version_label}\e[0m"
31+
}
32+
33+
print_title "system information:"
2234
cat /etc/*-release
2335

24-
echo -e "\nGit version:"
36+
EXTRA_LINE="\n"
37+
38+
print_title "git"
2539
git --version
2640

27-
echo -e "\nJava version:"
41+
print_title "java"
2842
java -version
2943

30-
echo -e "\nMaven version:"
44+
print_title "maven"
3145
mvn --version
3246

33-
echo -e "\nPython version:"
47+
print_title "python"
3448
python --version
3549

36-
echo -e "\ndpkg version:"
50+
print_title "dpkg"
3751
dpkg --version
3852

39-
echo -e "\ndevscripts version:"
53+
print_title "devscripts"
4054
dpkg -s devscripts | grep "Version:" | awk '{print $2}'
4155

42-
echo -e "\ndebhelper version:"
56+
print_title "debhelper"
4357
dpkg -s debhelper | grep "Version:" | awk '{print $2}'
4458

45-
echo -e "\ngenisoimage version:"
59+
print_title "genisoimage"
4660
genisoimage --version
4761

48-
echo -e "\nlsb-release version:"
62+
print_title "lsb-release"
4963
dpkg -s lsb-release | grep "Version:" | awk '{print $2}'
5064

51-
echo -e "\nbuild-essential version:"
65+
print_title "build-essential"
5266
dpkg -s build-essential | grep "Version:" | awk '{print $2}'
67+
68+
echo ""

ubuntu1804/docker-entrypoint.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ if [ -d "${workspace_path}" ]; then
123123
echo "Error: Could not clone remote git repository, '${workspace_path}' exists"
124124
exit 1
125125
else
126-
echo "Removing ${workspace_path} ..."
126+
echo -e "\e[0;32mremoving ${workspace_path} ...\e[0m"
127127
rm -rf ${workspace_path}
128-
echo -e "\n--------\n"
128+
echo ""
129129
fi
130130
fi
131131
else
@@ -138,22 +138,21 @@ fi
138138
# Print out some environment information
139139
environment-info.sh
140140

141-
echo -e "\n--------\n"
142-
143141
# Clone the remote provided git repo and ref
144142
if [ $use_remote = true ]; then
145-
echo "Cloning $git_remote ..."
143+
echo -e "\e[0;32mcloning $git_remote ...\e[0m"
146144
git clone --quiet --depth=50 $git_remote ${workspace_path}
145+
echo ""
147146

148147
cd ${workspace_path}
149148

150-
echo "Fetching $git_ref ..."
149+
echo -e "\e[0;32mfetching $git_ref ...\e[0m"
151150
git fetch --quiet origin +$git_ref:
151+
echo ""
152152

153-
echo "Checking out $git_ref ..."
153+
echo -e "\e[0;32mchecking out $git_ref ...\e[0m"
154154
git checkout --quiet --force FETCH_HEAD
155-
156-
echo -e "\n--------\n"
155+
echo ""
157156
fi
158157

159158
# Make sure build-deb.sh script exists before going any further
@@ -163,12 +162,12 @@ if [ ! -f "${workspace_path}/packaging/build-deb.sh" ]; then
163162
fi
164163

165164
# convert LONG flags to SHORT flags for anything prior 4.12.x.x
166-
echo "Detecting CloudStack version ..."
165+
echo -e "\e[0;32mdetecting CloudStack version ...\e[0m"
167166
pom_version=$(cd ${workspace_path}; mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)
168167
echo "${pom_version}"
169168
major_version=$(echo ${pom_version} | cut -d. -f1)
170169
minor_version=$(echo ${pom_version} | cut -d. -f2)
171-
echo -e "\n--------\n"
170+
echo ""
172171

173172
if [ $major_version -lt 4 ] || [ $major_version -eq 4 -a $minor_version -lt 12 ]; then
174173
if [ $show_help = true ]; then
@@ -223,6 +222,8 @@ function adjust_owner() {
223222
{
224223
cd ${workspace_path}/packaging
225224

225+
echo -e "\e[0;32mpackaging CloudStack DEB packages ...\e[0m"
226+
226227
# do the packaging
227228
bash -x ./build-deb.sh $@ && {
228229
mkdir -p ${workspace_path}/dist/debbuild/DEBS

ubuntu1804/environment-info.sh

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,51 @@
1818

1919
set -e
2020

21-
echo -e "System information:"
21+
EXTRA_LINE=""
22+
23+
print_title() {
24+
local version_label=""
25+
if [[ "$1" = *":" ]]; then
26+
version_label=""
27+
else
28+
version_label=" version:"
29+
fi
30+
echo -e "${EXTRA_LINE}\e[1;34m$1${version_label}\e[0m"
31+
}
32+
33+
print_title "system information:"
2234
cat /etc/*-release
2335

24-
echo -e "\nGit version:"
36+
EXTRA_LINE="\n"
37+
38+
print_title "git"
2539
git --version
2640

27-
echo -e "\nJava version:"
41+
print_title "java"
2842
java -version
2943

30-
echo -e "\nMaven version:"
44+
print_title "maven"
3145
mvn --version
3246

33-
echo -e "\nPython version:"
47+
print_title "python"
3448
python --version
3549

36-
echo -e "\ndpkg version:"
50+
print_title "dpkg"
3751
dpkg --version
3852

39-
echo -e "\ndevscripts version:"
53+
print_title "devscripts"
4054
dpkg -s devscripts | grep "Version:" | awk '{print $2}'
4155

42-
echo -e "\ndebhelper version:"
56+
print_title "debhelper"
4357
dpkg -s debhelper | grep "Version:" | awk '{print $2}'
4458

45-
echo -e "\ngenisoimage version:"
59+
print_title "genisoimage"
4660
genisoimage --version
4761

48-
echo -e "\nlsb-release version:"
62+
print_title "lsb-release"
4963
dpkg -s lsb-release | grep "Version:" | awk '{print $2}'
5064

51-
echo -e "\nbuild-essential version:"
65+
print_title "build-essential"
5266
dpkg -s build-essential | grep "Version:" | awk '{print $2}'
67+
68+
echo ""

0 commit comments

Comments
 (0)