From e73084119bd8faca8a7cd0f386fb84db2bc5ded3 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 24 Jun 2025 12:46:45 +0200 Subject: [PATCH 1/5] compile: fixed shellcheck issues Signed-off-by: Lars Erik Wik --- build-scripts/compile | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/build-scripts/compile b/build-scripts/compile index b1dd7a029..91097da8b 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -1,6 +1,6 @@ #!/bin/sh -x -. `dirname "$0"`/functions +. "$(dirname "$0")"/functions . detect-environment . compile-options @@ -16,19 +16,17 @@ case "$PROJECT" in exit 42;; esac -$MAKE -C $BASEDIR/core -k -$MAKE -C $BASEDIR/core install DESTDIR=$BASEDIR/cfengine/dist +$MAKE -C "$BASEDIR"/core -k +$MAKE -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist -if test "x$NOVA" = "xyes"; then - $MAKE -C $BASEDIR/enterprise -k - $MAKE -C $BASEDIR/enterprise install DESTDIR=$BASEDIR/cfengine/dist - if test "x$ROLE" = "xhub"; then - $MAKE -C $BASEDIR/nova -k - $MAKE -C $BASEDIR/nova install DESTDIR=$BASEDIR/cfengine/dist - $MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist +if [ "$NOVA" = yes ]; then + $MAKE -C "$BASEDIR"/enterprise -k + $MAKE -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist + if [ "$ROLE" = hub ]; then + $MAKE -C "$BASEDIR"/nova -k + $MAKE -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist + $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi else - $MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist + $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi - - From d83145901e853c46cd1641e9780ec7ad0d51fbed Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 24 Jun 2025 13:13:41 +0200 Subject: [PATCH 2/5] compile: Reduced verbosity of script Signed-off-by: Lars Erik Wik --- build-scripts/compile | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/build-scripts/compile b/build-scripts/compile index 91097da8b..df4107363 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . "$(dirname "$0")"/functions . detect-environment @@ -12,21 +12,29 @@ case "$PROJECT" in NOVA=yes ;; *) - echo "Unknown project: $PROJECT" + echo "$(basename "$0"): Error: Unknown project: $PROJECT" exit 42;; esac -$MAKE -C "$BASEDIR"/core -k -$MAKE -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist +echo "$(basename "$0"): Debug: Running make in core repo..." +run_and_print_on_failure $MAKE -C "$BASEDIR"/core -k +echo "$(basename "$0"): Debug: Running make install in core repo..." +run_and_print_on_failure $MAKE -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist if [ "$NOVA" = yes ]; then - $MAKE -C "$BASEDIR"/enterprise -k - $MAKE -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist + echo "$(basename "$0"): Debug: Running make in enterprise repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/enterprise -k + echo "$(basename "$0"): Debug: Running make install in enterprise repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist if [ "$ROLE" = hub ]; then - $MAKE -C "$BASEDIR"/nova -k - $MAKE -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist - $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist + echo "$(basename "$0"): Debug: Running make in nova repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/nova -k + echo "$(basename "$0"): Debug: Running make install in nova repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist + echo "$(basename "$0"): Debug: Running make install in masterfiles repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi else - $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist + echo "$(basename "$0"): Debug: Running make install in masterfiles repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi From b143756b0078e5fc98bad0043d3b883ba9551c52 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 24 Jun 2025 13:17:48 +0200 Subject: [PATCH 3/5] compile: Fixed inconsistent indents Signed-off-by: Lars Erik Wik --- build-scripts/compile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build-scripts/compile b/build-scripts/compile index df4107363..cc99249a4 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -5,15 +5,15 @@ . compile-options case "$PROJECT" in - community) - NOVA=no - ;; - nova) - NOVA=yes - ;; - *) - echo "$(basename "$0"): Error: Unknown project: $PROJECT" - exit 42;; + community) + NOVA=no + ;; + nova) + NOVA=yes + ;; + *) + echo "$(basename "$0"): Error: Unknown project: $PROJECT" + exit 42;; esac echo "$(basename "$0"): Debug: Running make in core repo..." From e5dc63134657c3c4247059b9f46eabbfdbda0992 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 24 Jun 2025 13:18:45 +0200 Subject: [PATCH 4/5] compile: Placed block terminator on a new line for consistency Signed-off-by: Lars Erik Wik --- build-scripts/compile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build-scripts/compile b/build-scripts/compile index cc99249a4..df90a7d46 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -13,7 +13,8 @@ case "$PROJECT" in ;; *) echo "$(basename "$0"): Error: Unknown project: $PROJECT" - exit 42;; + exit 42 + ;; esac echo "$(basename "$0"): Debug: Running make in core repo..." From e4d98d82fb108a625c7170b9bb748c7e667c42fa Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 24 Jun 2025 13:26:08 +0200 Subject: [PATCH 5/5] compile: Documented script Ticket: ENT-12600 Signed-off-by: Lars Erik Wik --- build-scripts/compile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build-scripts/compile b/build-scripts/compile index df90a7d46..d09a78ac9 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -1,5 +1,19 @@ #!/bin/sh +# Usage: PROJECT=[nova|community] ROLE=[hub|agent] ./buildscripts/build-scripts/compile +# +# This script compiles and installs the CFEngine repositories into +# '$BASEDIR/cfengine/dist'. You should first run the 'autogen' script, then +# 'configure' script before running this script. +# +# The script expects the following repositories to exist side by side: +# . +# ├── buildscripts +# ├── core +# ├── enterprise +# ├── nova +# └── masterfiles + . "$(dirname "$0")"/functions . detect-environment . compile-options