Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install to another dir on GNU/Linux #770

Closed
ctrlcctrlv opened this issue May 12, 2023 · 3 comments
Closed

Cannot install to another dir on GNU/Linux #770

ctrlcctrlv opened this issue May 12, 2023 · 3 comments
Labels

Comments

@ctrlcctrlv
Copy link

Please apply this patch:

From b6a7b5c84b1626fd93a8c2871835a2cd2b242446 Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <[email protected]>
Date: Fri, 12 May 2023 10:12:17 -0400
Subject: [PATCH 1/2] Use HOMEBREW_PREFIX from env

---
 install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sh b/install.sh
index 2fa9330..17c26da 100755
--- a/install.sh
+++ b/install.sh
@@ -149,7 +149,7 @@ else
   UNAME_MACHINE="$(uname -m)"
 
   # On Linux, this script installs to /home/linuxbrew/.linuxbrew only
-  HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew"
+  HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-"/home/linuxbrew/.linuxbrew"}"
   HOMEBREW_REPOSITORY="${HOMEBREW_PREFIX}/Homebrew"
   HOMEBREW_CACHE="${HOME}/.cache/Homebrew"
 
-- 
2.40.1

I also suggest you apply:

From 1ba263e6884e0d3a28063a4996ecd10796117839 Mon Sep 17 00:00:00 2001
From: Fredrick Brennan <[email protected]>
Date: Fri, 12 May 2023 10:15:24 -0400
Subject: [PATCH 2/2] +$HOMEBREW_SUPPRESS_PATH_WARNING

---
 install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/install.sh b/install.sh
index 17c26da..518d2e8 100755
--- a/install.sh
+++ b/install.sh
@@ -950,7 +950,7 @@ ohai "Downloading and installing Homebrew..."
   execute "${HOMEBREW_PREFIX}/bin/brew" "update" "--force" "--quiet"
 ) || exit 1
 
-if [[ ":${PATH}:" != *":${HOMEBREW_PREFIX}/bin:"* ]]
+if [[ ":${PATH}:" != *":${HOMEBREW_PREFIX}/bin:"* && -z "$HOMEBREW_SUPPRESS_PATH_WARNING" ]]
 then
   warn "${HOMEBREW_PREFIX}/bin is not in your PATH.
   Instructions on how to configure your shell for Homebrew
-- 
2.40.1
@MikeMcQuaid
Copy link
Member

We intentionally don't support installing to unsupported directories with the official installer, sorry.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale May 12, 2023
@ctrlcctrlv
Copy link
Author

That's fine, but I'm still going to make an AUR package.

@ctrlcctrlv
Copy link
Author

ctrlcctrlv commented May 12, 2023

should i just not distribute your installer and use my hacked up version? if so i can do things like

diff --git a/install.sh b/install.sh
index 518d2e8..22d1fbd 100755
--- a/install.sh
+++ b/install.sh
@@ -198,37 +198,7 @@ export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1
 unset HAVE_SUDO_ACCESS # unset this from the environment
 
 have_sudo_access() {
-  if [[ ! -x "/usr/bin/sudo" ]]
-  then
-    return 1
-  fi
-
-  local -a SUDO=("/usr/bin/sudo")
-  if [[ -n "${SUDO_ASKPASS-}" ]]
-  then
-    SUDO+=("-A")
-  elif [[ -n "${NONINTERACTIVE-}" ]]
-  then
-    SUDO+=("-n")
-  fi
-
-  if [[ -z "${HAVE_SUDO_ACCESS-}" ]]
-  then
-    if [[ -n "${NONINTERACTIVE-}" ]]
-    then
-      "${SUDO[@]}" -l mkdir &>/dev/null
-    else
-      "${SUDO[@]}" -v && "${SUDO[@]}" -l mkdir &>/dev/null
-    fi
-    HAVE_SUDO_ACCESS="$?"
-  fi
-
-  if [[ -n "${HOMEBREW_ON_MACOS-}" ]] && [[ "${HAVE_SUDO_ACCESS}" -ne 0 ]]
-  then
-    abort "Need sudo access on macOS (e.g. the user ${USER} needs to be an Administrator)!"
-  fi
-
-  return "${HAVE_SUDO_ACCESS}"
+  return 1
 }
 
 execute() {

because getting root is not allowed in makepkg PKGBUIDL

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants