From 60dd08fa2724c176485d182e487d115f70987a38 Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Thu, 17 Jun 2021 19:01:47 +0200 Subject: [PATCH] Fix sxmo_modemtext in terminal mode As we rely on the terminal name to use the contextual menu, we used the st target directly, preventing to use the taillog command in terminal mode. Add an optional TERMNAME env variable to manage this smoothly. Signed-off-by: Stacy Harper Signed-off-by: Maarten van Gompel --- scripts/core/sxmo_terminal.sh | 15 +++++++++++++-- scripts/modem/sxmo_modemtext.sh | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_terminal.sh b/scripts/core/sxmo_terminal.sh index bba64a8..853f737 100755 --- a/scripts/core/sxmo_terminal.sh +++ b/scripts/core/sxmo_terminal.sh @@ -1,7 +1,18 @@ #!/usr/bin/env sh - # shellcheck disable=SC2086 -set -- $TERMCMD "$@" + +if [ -n "$TERMNAME" ]; then + case "$TERMCMD" in + "st -e") + set -- st -T "$TERMNAME" -e "$@" + ;; + *) + printf "%s: '%s'\n" "Not implemented for TERMCMD" "$TERMCMD" >&2 + set -- $TERMCMD "$@" + esac +else + set -- $TERMCMD "$@" +fi if [ -z "$*" ]; then echo "sxmo_terminal.sh called in TERMMODE without any arguments (returning, nothing to do)" >&2 diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index f044f05..c82b624 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -76,7 +76,7 @@ tailtextlog() { CONTACTNAME="$(sxmo_contacts.sh | grep "^$NUMBER" | cut -d' ' -f2-)" [ "Unknown Number" = "$CONTACTNAME" ] && CONTACTNAME="$CONTACTNAME ($NUMBER)" - st -T "$NUMBER SMS" -e sh -c "tail -n9999 -f \"$LOGDIR/$NUMBER/sms.txt\" | sed \"s|$NUMBER|$CONTACTNAME|g\"" + TERMNAME="$NUMBER SMS" sxmo_terminal.sh sh -c "tail -n9999 -f \"$LOGDIR/$NUMBER/sms.txt\" | sed \"s|$NUMBER|$CONTACTNAME|g\"" } readtextmenu() {