]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
make.sh: Show total runtime of commands after they are finished
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jul 2024 10:11:57 +0000 (10:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jul 2024 15:39:44 +0000 (15:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
make.sh

diff --git a/make.sh b/make.sh
index c04d86fc4f1e156654c165ff0d859b8ce4b78097..3062e20f8645951ac1772d609999df610e0d427d 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -806,15 +806,28 @@ run_command() {
                        ;;
        esac
 
+       # Return code
+       local r=0
+
+       # Store the start time
+       local t="${SECONDS}"
+
        # Run the command and pipe all output to the logfile
        if ! "${command[@]}" >> "${LOGFILE}" 2>&1; then
-               print_status FAIL
-               return 1
+               r="$?"
        fi
 
+       # Print the runtime
+       print_runtime "$(( SECONDS - t ))"
+
        # All done
-       print_status DONE
-       return 0
+       if [ "${r}" -eq 0 ]; then
+               print_status DONE
+       else
+               print_status FAIL
+       fi
+
+       return "${r}"
 }
 
 lfsmake2() {