summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWebpage-gh <70434775+Webpage-gh@users.noreply.github.com>2023-03-31 13:37:01 +0800
committerGitHub <noreply@github.com>2023-03-31 07:37:01 +0200
commit7837ba6a993fb2243b3e69fdbd63b437a8674b4c (patch)
treec067907b4284d0d382f644835b1ac7c3bf8c13bf /tools
parentfcbdc330ff50617c8b84d39ce069cc75df41108f (diff)
downloadzsh-7837ba6a993fb2243b3e69fdbd63b437a8674b4c.tar.gz
zsh-7837ba6a993fb2243b3e69fdbd63b437a8674b4c.tar.bz2
zsh-7837ba6a993fb2243b3e69fdbd63b437a8674b4c.zip
fix(installer): don't use `sudo` when user is in Termux (#11591)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/install.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/install.sh b/tools/install.sh
index f4ef16a0c..efdb7d482 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -84,6 +84,11 @@ command_exists() {
user_can_sudo() {
# Check if sudo is installed
command_exists sudo || return 1
+ # Termux can't run sudo unless the device is rooted. Either way, `chsh` works
+ # without sudo, so we can detect it and exit the function early.
+ case "$PREFIX" in
+ *com.termux*) return 1 ;;
+ esac
# The following command has 3 parts:
#
# 1. Run `sudo` with `-v`. Does the following: