From 46f572d307a6400d2f70c68237673f3754a91d1e Mon Sep 17 00:00:00 2001 From: Fred Oh Date: Wed, 24 Jun 2020 11:10:30 -0700 Subject: [PATCH] env-check: add sof-dyndbg.conf file check Check sof-dyndbg.conf available in the system, give optional warning and print short usage of dyndbg for SOF modules. ShellCheck error, SC2059 is ignored. printf '\e[31mWarning\e[0m\nSolution:'"$out_str"'\n' ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo". Signed-off-by: Fred Oh --- env-check.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/env-check.sh b/env-check.sh index b97916e9..0be2f68b 100755 --- a/env-check.sh +++ b/env-check.sh @@ -1,5 +1,8 @@ #!/bin/bash +# enable dynamic debug logs for SOF modules +DYNDBG="/etc/modprobe.d/sof-dyndbg.conf" + # check for the system package out_str="" func_check_pkg(){ @@ -24,14 +27,25 @@ func_check_python_pkg(){ fi } +func_check_file(){ + if [ -e "$1" ]; then + return + fi + out_str=$out_str"\nOptional: Enable dynamic debug logs on \e[31m $1 \e[0m file\n\tFor example,\n\toptions snd_sof dyndbg=+p\n\toptions snd_sof_pci dyndbg=+p" + check_res=1 +} + check_res=0 echo -ne "Check for the package:\t\t" func_check_pkg expect func_check_pkg aplay func_check_pkg python3 func_check_python_pkg graphviz +func_check_file "$DYNDBG" [[ $check_res -eq 0 ]] && echo "pass" || \ - echo -e "\e[31mWarning\e[0m\nSolution:"$out_str + # We know exactly what $out_str is, it's not some random and unsanitized input + # shellcheck disable=SC2059 + printf '\e[31mWarning\e[0m\nSolution:'"$out_str"'\n' # check for the tools folder old_path=$PWD