From ee5e46b05098ad1d7dfa854525b5c67ca82b645f Mon Sep 17 00:00:00 2001 From: anth64 Date: Tue, 10 Nov 2026 18:47:12 +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 | 3 +++ build.sh | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 009d691..bf9f0c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- `build.sh`: install/uninstall no longer requires `doas`/`sudo` under MSYS2, where neither exists and `id -u` never reports root + ## [1.0.1] - 2026-11-09 ### Fixed diff --git a/build.sh b/build.sh index 0ecefd3..82803c0 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,11 @@ case "$OS" in *) MK_FILE="bmake.mk" ;; esac +case "$OS" in + mingw*|msys*|ucrt*|clang*) IS_WIN=1 ;; + *) IS_WIN=0 ;; +esac + HAS_INSTALL=0 HAS_UNINSTALL=0 for arg in "$@"; do @@ -24,7 +29,7 @@ if [ "$HAS_INSTALL" = "1" ] || [ "$HAS_UNINSTALL" = "1" ]; then make -f "$MK_FILE" release 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"