Merge pull request #15656 from osalbahr/silverbrew

Feature: support symlinked /home
This commit is contained in:
Michka Popoff 2023-07-15 13:45:07 +02:00 committed by GitHub
commit 518fb43112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,17 +13,6 @@ case "${HOMEBREW_SYSTEM}" in
Linux) HOMEBREW_LINUX="1" ;;
esac
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
# These variables are set by bin/brew
# shellcheck disable=SC2154
if [[ -d "${HOMEBREW_REPOSITORY}/Cellar" ]]
then
HOMEBREW_CELLAR="${HOMEBREW_REPOSITORY}/Cellar"
else
HOMEBREW_CELLAR="${HOMEBREW_PREFIX}/Cellar"
fi
HOMEBREW_MACOS_ARM_DEFAULT_PREFIX="/opt/homebrew"
HOMEBREW_MACOS_ARM_DEFAULT_REPOSITORY="${HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}"
HOMEBREW_LINUX_DEFAULT_PREFIX="/home/linuxbrew/.linuxbrew"
@ -55,6 +44,37 @@ else
HOMEBREW_DEFAULT_TEMP="/tmp"
fi
realpath() {
(cd "$1" &>/dev/null && pwd -P)
}
# Support systems where HOMEBREW_PREFIX is the default,
# but a parent directory is a symlink.
# Example: Fedora Silverblue symlinks /home -> var/home
if [[ "${HOMEBREW_PREFIX}" != "${HOMEBREW_DEFAULT_PREFIX}" && "$(realpath "${HOMEBREW_DEFAULT_PREFIX}")" == "${HOMEBREW_PREFIX}" ]]
then
HOMEBREW_PREFIX="${HOMEBREW_DEFAULT_PREFIX}"
fi
# Support systems where HOMEBREW_REPOSITORY is the default,
# but a parent directory is a symlink.
# Example: Fedora Silverblue symlinks /home -> var/home
if [[ "${HOMEBREW_REPOSITORY}" != "${HOMEBREW_DEFAULT_REPOSITORY}" && "$(realpath "${HOMEBREW_DEFAULT_REPOSITORY}")" == "${HOMEBREW_REPOSITORY}" ]]
then
HOMEBREW_REPOSITORY="${HOMEBREW_DEFAULT_REPOSITORY}"
fi
# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
# These variables are set by bin/brew
# shellcheck disable=SC2154
if [[ -d "${HOMEBREW_REPOSITORY}/Cellar" ]]
then
HOMEBREW_CELLAR="${HOMEBREW_REPOSITORY}/Cellar"
else
HOMEBREW_CELLAR="${HOMEBREW_PREFIX}/Cellar"
fi
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"