summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-01-27 16:19:19 +0100
committerChristian Poessinger <christian@poessinger.com>2019-01-27 18:33:41 +0100
commit000cd8b2d962989e26c847a6337bc1b3a3f1c6a9 (patch)
tree6facf29c132e54f4f05df617a8f60b3ac760cd14
parent9210522425e2cd6ed5d9f83ad594e5588671863e (diff)
downloadvyos-build-000cd8b2d962989e26c847a6337bc1b3a3f1c6a9.tar.gz
vyos-build-000cd8b2d962989e26c847a6337bc1b3a3f1c6a9.zip
build-submodules: change VERBOSE logic
-rwxr-xr-xscripts/build-submodules34
1 files changed, 19 insertions, 15 deletions
diff --git a/scripts/build-submodules b/scripts/build-submodules
index 6fd945d1..79abf59f 100755
--- a/scripts/build-submodules
+++ b/scripts/build-submodules
@@ -24,6 +24,7 @@ print_help() {
}
BUILDLIST=""
+VERBOSE=0
while test $# -gt 0
do
@@ -70,6 +71,19 @@ status_skip() {
error_msg() {
echo -ne " $1\n"
}
+
+verbose_msg() {
+ if [ $VERBOSE -ne 0 ]; then
+ echo "Current Environment:"
+ env
+
+ if [ ! -z "$1" ]; then
+ echo "Logfile:"
+ cat $1
+ fi
+ fi
+}
+
ROOTDIR="$(pwd)"
PKGDIR="$ROOTDIR/packages"
SCRIPTDIR="$ROOTDIR/scripts"
@@ -104,9 +118,7 @@ build_package() {
) >>$PKGDIR/$PKG.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/$PKG.buildlog
- fi
+ verbose_msg "$PKGDIR/$PKG.buildlog"
error_msg "Failed to build package $PKG, look in $PKG.buildlog to examine the fault\n"
return 2
fi
@@ -131,9 +143,7 @@ initialize_packages() {
) >>$PKGDIR/init-packages.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/init-packages.buildlog
- fi
+ verbose_msg "$PKGDIR/init-packages.buildlog"
error_msg "Failed to update all package, look in init-packages.buildlog to examine the fault\n"
return 1
fi
@@ -311,9 +321,7 @@ build_kernel() {
) >>$PKGDIR/vyos-kernel.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/vyos-kernel.buildlog
- fi
+ verbose_msg "$PKGDIR/vyos-kernel.buildlog"
error_msg "Failed to build package vyos-kernel, look in vyos-kernel.buildlog to examine the fault\n"
return 1
fi
@@ -370,9 +378,7 @@ build_wireguard() {
) >>$PKGDIR/vyos-wireguard.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/vyos-wireguard.buildlog
- fi
+ verbose_msg "$PKGDIR/vyos-wireguard.buildlog"
error_msg "Failed to build package vyos-wireguard, look in vyos-wireguard.buildlog to examine the fault\n"
return 2
fi
@@ -421,9 +427,7 @@ build_accel-ppp() {
) >>$PKGDIR/vyos-accel-ppp.buildlog 2>&1
if [ $? -ne 0 ]; then
status_fail
- if [ $VERBOSE -eq 1 ]; then
- cat $PKGDIR/vyos-accel-ppp.buildlog
- fi
+ verbose_msg "$PKGDIR/vyos-accel-ppp.buildlog"
error_msg "Failed to build package vyos-accel-ppp, look in vyos-accel-ppp.buildlog to examine the fault\n"
return 1
fi