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.
This commit is contained in:
anth64 committed 2026-11-10 19:08:11 +01:00
1 parent b860b0d607
commit 462e3420ea
2 files changed
+9 -1

No files matched your search

+3
View File
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [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 ## [1.0.1] - 2026-11-09
### Fixed ### Fixed
+6 -1
View File
@@ -10,6 +10,11 @@ case "$OS" in
*) MK_FILE="bmake.mk" ;; *) MK_FILE="bmake.mk" ;;
esac esac
case "$OS" in
mingw*|msys*|ucrt*|clang*) IS_WIN=1 ;;
*) IS_WIN=0 ;;
esac
HAS_INSTALL=0 HAS_INSTALL=0
HAS_UNINSTALL=0 HAS_UNINSTALL=0
for arg in "$@"; do for arg in "$@"; do
@@ -24,7 +29,7 @@ if [ "$HAS_INSTALL" = "1" ] || [ "$HAS_UNINSTALL" = "1" ]; then
make -f "$MK_FILE" release make -f "$MK_FILE" release
fi fi
if [ "$(id -u)" = "0" ]; then if [ "$IS_WIN" = "1" ] || [ "$(id -u)" = "0" ]; then
PRIV="" PRIV=""
elif command -v doas > /dev/null 2>&1; then elif command -v doas > /dev/null 2>&1; then
PRIV="doas" PRIV="doas"