From: Emil Velikov Date: Sat, 14 Sep 2024 15:46:27 +0000 (+0100) Subject: ci: flesh out print-kdir.sh script, bash ftw X-Git-Tag: v34~345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4694d0206bd53f94b6b76a7cebb38643c268ffc2;p=thirdparty%2Fkmod.git ci: flesh out print-kdir.sh script, bash ftw We'll be adding another action, where this script is handy. Flesh it out to scripts and convert to bash. v2: - move script to .github/ Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/132 Signed-off-by: Lucas De Marchi --- diff --git a/.github/print-kdir.sh b/.github/print-kdir.sh new file mode 100755 index 00000000..42bb9b35 --- /dev/null +++ b/.github/print-kdir.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +for moddir in /usr/lib/modules /lib/modules; do + if [[ -e "$moddir" ]]; then + kernel=$(find "$moddir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) + break + fi +done + +# There should be one entry - the kernel we installed +if (( $(echo "$kernel" | wc -l) != 1 )); then + echo >&2 "Error: exactly one kernel must be installed" +fi +echo "KDIR=$moddir/$kernel/build" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 552e697f..f8a386ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,18 +60,7 @@ jobs: # doesn't quite work. Perhaps our double/sparse checkout is to blame? git config --global --add safe.directory '*' - for moddir in /usr/lib/modules /lib/modules; do - if [ -e "$moddir" ]; then - kernel=$(find "$moddir" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;) - break - fi - done - - # There should be one entry - the kernel we installed - if [ $(echo "$kernel" | wc -l) -ne 1 ]; then - echo >&2 "Error: exactly one kernel must be installed" - fi - echo "KDIR=$moddir/$kernel/build" >> "$GITHUB_ENV" + .github/print-kdir.sh >> "$GITHUB_ENV" - name: configure (meson) if: ${{ matrix.build == 'meson' }}