From d4ae5d20aba893d1fa97745ae6911dd8275c5ee1 Mon Sep 17 00:00:00 2001 From: macmpi <16296055+macmpi@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:37:48 +0100 Subject: [PATCH] raspinfo: remove bashisms and use POSIX sh This removes bash as dependency for downstream packagers. Workaround 3 bashisms: - &> - == test - process substitution for log file --- raspinfo/raspinfo | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/raspinfo/raspinfo b/raspinfo/raspinfo index 15d6803..29ef3ff 100755 --- a/raspinfo/raspinfo +++ b/raspinfo/raspinfo @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Some of the regex's used in sed # Catch basic IP6 address "s/\([0-9a-fA-F]\{1,4\}:\)\{7,7\}[0-9a-fA-F]\{1,4\}/y.y.y.y.y.y.y.y/g" @@ -68,7 +68,7 @@ display_info_drm() { cardfound=1 fi done - if [ "$cardfound" == "0" ]; + if [ "$cardfound" = "0" ]; then echo "kms state not found" echo @@ -115,7 +115,7 @@ display_info_legacy() { if pgrep Xorg > /dev/null && command -v xrandr > /dev/null && - DISPLAY=${DISPLAY:-:0} xrandr --listmonitors &>/dev/null; then + DISPLAY=${DISPLAY:-:0} xrandr --listmonitors >/dev/null 2>&1; then DISPLAY=${DISPLAY:-:0} xrandr --verbose echo fi @@ -171,7 +171,11 @@ OUT=raspinfo.txt rm -f $OUT -exec > >(tee -ia $OUT) +# avoid process substition bashism to generate logfile +PIPE_PATH=$(mktemp -u) +mkfifo $PIPE_PATH +tee -ia $OUT < $PIPE_PATH & +exec > $PIPE_PATH echo "System Information" echo "------------------"