diff --git a/script/get-generic-sys-util/run.sh b/script/get-generic-sys-util/run.sh index 27c2f62867..5074e756b8 100644 --- a/script/get-generic-sys-util/run.sh +++ b/script/get-generic-sys-util/run.sh @@ -1,6 +1,19 @@ -#!/bin/bash +# Safe execution of a command stored in a variable +cmd="${CM_SYS_UTIL_INSTALL_CMD}" +echo "$cmd" -cmd=${CM_SYS_UTIL_INSTALL_CMD} -echo $cmd -eval $cmd -test $? -eq 0 || exit $? +# Execute the command and capture the exit status directly +if ! eval "$cmd"; then + echo "Command failed with status $?" + if [[ "${CM_TMP_FAIL_SAFE}" == 'yes' ]]; then + # Exit safely if fail-safe is enabled + echo "Fail-safe is enabled, exiting with status 0" + exit 0 + else + # Otherwise exit with the actual error status + exit $? + fi +else + #echo "Command succeeded" + exit 0 +fi diff --git a/script/get-platform-details/_cm.json b/script/get-platform-details/_cm.json index 11c57baa18..b02576ad9e 100644 --- a/script/get-platform-details/_cm.json +++ b/script/get-platform-details/_cm.json @@ -66,7 +66,10 @@ "linux" ] }, - "tags": "get,sys-util,generic,_linux-tools" + "tags": "get,sys-util,generic,_linux-tools", + "env": { + "CM_TMP_FAIL_SAFE": "yes" + } } ], "tags": [ diff --git a/script/get-platform-details/run.sh b/script/get-platform-details/run.sh index acac8e0b23..ba2194e669 100644 --- a/script/get-platform-details/run.sh +++ b/script/get-platform-details/run.sh @@ -79,7 +79,7 @@ echo "------------------------------------------------------------" >> $OUTPUT_F echo "14. cpupower frequency-info" >> $OUTPUT_FILE eval "cpupower frequency-info" >> $OUTPUT_FILE -test $? -eq 0 || exit $? +test $? -eq 0 || echo "FAILED: cpupower frequency-info" >> $OUTPUT_FILE echo "------------------------------------------------------------" >> $OUTPUT_FILE echo "15. sysctl" >> $OUTPUT_FILE