Skip to content

Commit 9a0e87c

Browse files
committed
raspinfo: remove bashisms and use POSIX sh
This removes bash as dependency for downstream packagers. Workaround 3 bashisms: - &> - == test - process substitution for log file
1 parent f05444f commit 9a0e87c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

raspinfo/raspinfo

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ display_info_drm() {
6868
cardfound=1
6969
fi
7070
done
71-
if [ "$cardfound" == "0" ];
71+
if [ "$cardfound" = "0" ];
7272
then
7373
echo "kms state not found"
7474
echo
@@ -115,7 +115,7 @@ display_info_legacy() {
115115

116116
if pgrep Xorg > /dev/null &&
117117
command -v xrandr > /dev/null &&
118-
DISPLAY=${DISPLAY:-:0} xrandr --listmonitors &>/dev/null; then
118+
DISPLAY=${DISPLAY:-:0} xrandr --listmonitors >/dev/null 2>&1; then
119119
DISPLAY=${DISPLAY:-:0} xrandr --verbose
120120
echo
121121
fi
@@ -171,7 +171,11 @@ OUT=raspinfo.txt
171171

172172
rm -f $OUT
173173

174-
exec > >(tee -ia $OUT)
174+
# avoid process substition bashism to generate logfile
175+
PIPE_PATH=$(mktemp -u)
176+
mkfifo $PIPE_PATH
177+
tee -ia $OUT < $PIPE_PATH &
178+
exec > $PIPE_PATH
175179

176180
echo "System Information"
177181
echo "------------------"

0 commit comments

Comments
 (0)