Skip to content

Commit

Permalink
sof_remove.sh: make lib.sh optional
Browse files Browse the repository at this point in the history
This makes is possible to use this file separately from sof-test, as
requested in #1169.

Signed-off-by: Marc Herbert <[email protected]>
  • Loading branch information
marc-hb committed Jul 18, 2024
1 parent df8e22e commit dfb75d7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tools/kmod/sof_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@

TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)

# shellcheck source=case-lib/lib.sh
source "$TOPDIR"/case-lib/lib.sh
# Used only by more advanced error handling
source_opt_libsh()
{
local libsh="$TOPDIR"/case-lib/lib.sh
if test -e "$libsh"; then
# shellcheck source=case-lib/lib.sh
source "$libsh"
fi
}

remove_module() {

Expand All @@ -27,8 +34,9 @@ exit_handler()
# "non-deterministically". So even if we are successful this time,
# warn about any running pulseaudio because it could make us fail
# the next time.
# TODO: display any pipewire process too.
if pgrep -a pulseaudio; then
systemctl_show_pulseaudio
systemctl_show_pulseaudio || true
fi

if test "$exit_status" -ne 0; then
Expand Down Expand Up @@ -56,6 +64,7 @@ kill_trace_users()
)
}

source_opt_libsh
trap 'exit_handler $?' EXIT

# Breaks systemctl --user and "double sudo" is not great
Expand Down

0 comments on commit dfb75d7

Please sign in to comment.