From fe7cb46d3ee768eb0d210e157c393877499973bc Mon Sep 17 00:00:00 2001 From: dakanji Date: Sat, 9 May 2020 17:37:24 +0300 Subject: [PATCH] Build: Implement OpenCore shell checks Closes acidanthera/bugtracker#902 (#48) --- .shellcheckrc | 2 ++ .travis.yml | 15 ++++++++++++++- Debug/efidebug.tool | 14 +++++++------- Docs/BuildDocs.tool | 8 ++++---- macbuild.tool | 4 ++-- 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000000..bc119bdcafc --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,2 @@ +# Ignore sourced files if any +disable=SC1091 diff --git a/.travis.yml b/.travis.yml index 0066fae2cdf..d2516b7208b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,19 @@ env: matrix: include: + - os: linux + name: "Shellcheck on Linux" + addons: + apt: + packages: + - shellcheck + + script: + # Check Parent Dir (Change "*.tool" to "*.{sh,tool}" as required if needed later) + - shellcheck ./*.tool + # Check Sub Dirs (Change "*.tool" to "*.{sh,tool}" as required if needed later) + - shellcheck ./**/*.tool + - os: osx name: "Build macOS XCODE5" osx_image: xcode10.2 @@ -77,7 +90,7 @@ matrix: name: "Analyze Coverity" osx_image: xcode11.3 compiler: clang - + before_install: - HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl - curl -Ls https://entrust.com/root-certificates/entrust_l1k.cer -o ~/entrust_l1k.crt || exit 1 diff --git a/Debug/efidebug.tool b/Debug/efidebug.tool index 0eaeed78475..5f900a79572 100755 --- a/Debug/efidebug.tool +++ b/Debug/efidebug.tool @@ -26,23 +26,23 @@ # RUNDIR=$(dirname "$0") -pushd "${RUNDIR}" >/dev/null +pushd "${RUNDIR}" >/dev/null || exit 1 RUNDIR=$(pwd) -popd >/dev/null +popd >/dev/null || exit 1 -cd "$RUNDIR" +cd "$RUNDIR" || exit 1 find_gdb() { if [ "${GDB}" = "" ]; then - GDB=$(which ggdb) + GDB=$(command -v ggdb) fi if [ "${GDB}" = "" ]; then - GDB=$(which gdb-multiarch) + GDB=$(command -v gdb-multiarch) fi if [ "${GDB}" = "" ]; then - GDB=$(which gdb) + GDB=$(command -v gdb) fi } @@ -52,7 +52,7 @@ find_lldb() { fi if [ "${LLDB}" = "" ]; then - LLDB=$(which lldb) + LLDB=$(command -v lldb) fi } diff --git a/Docs/BuildDocs.tool b/Docs/BuildDocs.tool index 527c720260f..a2d584e3188 100755 --- a/Docs/BuildDocs.tool +++ b/Docs/BuildDocs.tool @@ -7,15 +7,15 @@ abort() { cd "$(dirname "$0")" || abort "Wrong directory" -if [ "$(which latexdiff)" = "" ]; then +if [ "$(command -v latexdiff)" = "" ]; then abort "latexdiff is missing, check your TeX Live installation" fi -if [ "$(which pdflatex)" = "" ]; then +if [ "$(command -v pdflatex)" = "" ]; then abort "pdflatex is missing, check your TeX Live installation" fi -rm -f *.aux *.log *.out *.pdf *.toc +rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc pdflatex -draftmode Configuration.tex || \ abort "Unable to create configuration pdf" @@ -26,7 +26,7 @@ pdflatex Configuration.tex || \ cd Differences || abort "Unable to process annotations" -rm -f *.aux *.log *.out *.pdf *.toc +rm -f ./*.aux ./*.log ./*.out ./*.pdf ./*.toc latexdiff -s ONLYCHANGEDPAGE PreviousConfiguration.tex ../Configuration.tex \ > Differences.tex || \ diff --git a/macbuild.tool b/macbuild.tool index 3c503dbd66e..6b03a77f92d 100755 --- a/macbuild.tool +++ b/macbuild.tool @@ -7,7 +7,7 @@ package() { fi local ver - ver=$(cat Include/OpenCore.h | grep OPEN_CORE_VERSION | sed 's/.*"\(.*\)".*/\1/' | grep -E '^[0-9.]+$') + ver=$(grep OPEN_CORE_VERSION ./Include/OpenCore.h | sed 's/.*"\(.*\)".*/\1/' | grep -E '^[0-9.]+$') if [ "$ver" = "" ]; then echo "Invalid version $ver" fi @@ -68,7 +68,7 @@ package() { cp -r "${selfdir}/Utilities/disklabel/disklabel" tmp/Utilities/ || exit 1 cp -r "${selfdir}/Utilities/icnspack/icnspack" tmp/Utilities/ || exit 1 pushd tmp || exit 1 - zip -qry -FS ../"OpenCore-${ver}-${2}.zip" * || exit 1 + zip -qry -FS ../"OpenCore-${ver}-${2}.zip" ./* || exit 1 popd || exit 1 rm -rf tmp || exit 1 popd || exit 1