fix(installer): don't use `sudo` when user is in Termux (#11591)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
Diff
1diff --git a/tools/install.sh b/tools/install.sh
2index f4ef16a0cca674899731af68e6ac948c053cdc9d..efdb7d4829fb2f2a23d7208dea8bee80c4a24653 100755
3--- a/tools/install.sh
4+++ b/tools/install.sh
5@@ -84,6 +84,11 @@ command_exists() {
6 user_can_sudo() {
7 # Check if sudo is installed
8 command_exists sudo || return 1
9+ # Termux can't run sudo unless the device is rooted. Either way, `chsh` works
10+ # without sudo, so we can detect it and exit the function early.
11+ case "$PREFIX" in
12+ *com.termux*) return 1 ;;
13+ esac
14 # The following command has 3 parts:
15 #
16 # 1. Run `sudo` with `-v`. Does the following: