From 46a05c0e88032e539af0e8927cfd098ca4651da7 Mon Sep 17 00:00:00 2001 From: anth64 Date: Tue, 10 Nov 2026 18:47:14 +0100 Subject: [PATCH] fix: skip doas/sudo escalation for install under MSYS2 Neither doas nor sudo exist there and id -u never reports root, so install/uninstall always hit the no-root error. IS_WIN is now computed once alongside MK_FILE and reused for the priv check. --- CHANGELOG.md | 1 + build.sh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfd92c8..1930620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,3 +10,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - `build.sh`: `uname -s` exported once and reused by make instead of being re-run - `gmake.mk`: stopped relying on the `OS` env var alone (unset under MSYS2), now also detects Windows via `uname -s` (`MINGW*`/`MSYS*`/`UCRT*`/`CLANG*`/`CYGWIN*`), with the native-Windows `cmd.exe` mkdir/rd path reserved for environments without a POSIX shell; fixes MSYS2 builds silently falling through to the Linux `mkdir -p`/`rm -rf` path mismatch +- `build.sh`: install/uninstall no longer requires `doas`/`sudo` under MSYS2, where neither exists and `id -u` never reports root diff --git a/build.sh b/build.sh index 7a27150..55b35b7 100755 --- a/build.sh +++ b/build.sh @@ -11,6 +11,11 @@ else MK_FILE="gmake.mk" fi +case "$OS" in + mingw*|msys*|ucrt*|clang*) IS_WIN=1 ;; + *) IS_WIN=0 ;; +esac + if grep -q "Raspberry Pi 5" /proc/device-tree/model 2>/dev/null; then GL_MAJOR=3 GL_MINOR=1 @@ -33,7 +38,7 @@ if [ "$HAS_INSTALL" = "1" ] || [ "$HAS_UNINSTALL" = "1" ]; then make -f "$MK_FILE" release GL_MAJOR=$GL_MAJOR GL_MINOR=$GL_MINOR fi - if [ "$(id -u)" = "0" ]; then + if [ "$IS_WIN" = "1" ] || [ "$(id -u)" = "0" ]; then PRIV="" elif command -v doas > /dev/null 2>&1; then PRIV="doas"