From d89a31fd968f48f6ef077b10badab4a1a93bf611 Mon Sep 17 00:00:00 2001 From: Jat Date: Tue, 23 Apr 2024 15:01:59 +0800 Subject: [PATCH 1/4] On Arch Linux, `Xorg` is located at `/usr/lib/Xorg` --- tests/xorg-test-run.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/xorg-test-run.sh b/tests/xorg-test-run.sh index 948440c3..3bae8b4f 100755 --- a/tests/xorg-test-run.sh +++ b/tests/xorg-test-run.sh @@ -7,6 +7,9 @@ if [ -z "$XORG" ]; then if [ -x /usr/lib/xorg/Xorg ]; then # Don't use the Ubuntu wrapped server XORG=/usr/lib/xorg/Xorg + elif [ -x /usr/lib/Xorg ]; then + # Don't use the Arch Linux wrapped server + XORG=/usr/lib/Xorg else XORG=Xorg fi From ab48e0e97ddd904ad016ac599c0f4e452b00f198 Mon Sep 17 00:00:00 2001 From: Jat Date: Tue, 23 Apr 2024 16:00:00 +0800 Subject: [PATCH 2/4] guess xorg path --- tests/xorg-test-run.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/xorg-test-run.sh b/tests/xorg-test-run.sh index 3bae8b4f..a6f42111 100755 --- a/tests/xorg-test-run.sh +++ b/tests/xorg-test-run.sh @@ -1,16 +1,25 @@ -#!/bin/sh +#!/bin/bash # Test that Xorg can load the compiled modules # X server to run if [ -z "$XORG" ]; then - if [ -x /usr/lib/xorg/Xorg ]; then - # Don't use the Ubuntu wrapped server - XORG=/usr/lib/xorg/Xorg - elif [ -x /usr/lib/Xorg ]; then - # Don't use the Arch Linux wrapped server - XORG=/usr/lib/Xorg - else + xorg_paths=( + /usr/local/libexec/Xorg + /usr/libexec/Xorg + /usr/lib/xorg/Xorg + /usr/lib/Xorg + /usr/bin/Xorg + ) + + for path in "${xorg_paths[@]}"; do + if [ -x "$path" ]; then + XORG=$path + break + fi + done + + if [ -z "$XORG" ]; then XORG=Xorg fi fi From c19d8767b02690e5d4757d98adf4c9f2a44448da Mon Sep 17 00:00:00 2001 From: Jat Date: Tue, 23 Apr 2024 17:06:20 +0800 Subject: [PATCH 3/4] stick with sh --- tests/xorg-test-run.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/xorg-test-run.sh b/tests/xorg-test-run.sh index a6f42111..48f0dda7 100755 --- a/tests/xorg-test-run.sh +++ b/tests/xorg-test-run.sh @@ -1,18 +1,17 @@ -#!/bin/bash +#!/bin/sh # Test that Xorg can load the compiled modules # X server to run if [ -z "$XORG" ]; then - xorg_paths=( - /usr/local/libexec/Xorg - /usr/libexec/Xorg - /usr/lib/xorg/Xorg - /usr/lib/Xorg + set -- \ + /usr/local/libexec/Xorg \ + /usr/libexec/Xorg \ + /usr/lib/xorg/Xorg \ + /usr/lib/Xorg \ /usr/bin/Xorg - ) - for path in "${xorg_paths[@]}"; do + for path in "$@"; do if [ -x "$path" ]; then XORG=$path break From d0ec07defe18b542a07063f1016291148a4ed4a2 Mon Sep 17 00:00:00 2001 From: Jat Date: Tue, 23 Apr 2024 17:46:17 +0800 Subject: [PATCH 4/4] Refactor Xorg path detection into FindXorg function in xorg-test-run.sh Signed-off-by: Jat --- tests/xorg-test-run.sh | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/tests/xorg-test-run.sh b/tests/xorg-test-run.sh index 48f0dda7..250fe06f 100755 --- a/tests/xorg-test-run.sh +++ b/tests/xorg-test-run.sh @@ -2,25 +2,30 @@ # Test that Xorg can load the compiled modules +FindXorg() +{ + set -- \ + /usr/local/libexec/Xorg \ + /usr/libexec/Xorg \ + /usr/lib/xorg/Xorg \ + /usr/lib/Xorg \ + /usr/bin/Xorg + + for path in "$@"; do + if [ -x "$path" ]; then + echo "$path" + exit + fi + done + + if [ -z "$XORG" ]; then + echo 'Xorg' + fi +} + # X server to run if [ -z "$XORG" ]; then - set -- \ - /usr/local/libexec/Xorg \ - /usr/libexec/Xorg \ - /usr/lib/xorg/Xorg \ - /usr/lib/Xorg \ - /usr/bin/Xorg - - for path in "$@"; do - if [ -x "$path" ]; then - XORG=$path - break - fi - done - - if [ -z "$XORG" ]; then - XORG=Xorg - fi + XORG=`FindXorg` fi # Client to connect to Xorg