mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

- don't include GitHub Actions credentials - generate and include RTF version of Homebrew BSD license - create nicer installer with `productbuild` - customise welcome/conclusion messages - add Homebrew logo as a background image - remove unnecessary `preinstall` script - cleanup `postinstall` script to pass `brew doctor` - use `Distribution.xml` for a nicer installer - require CLT or Xcode rather than using our hacks to try and install CLT during installation
53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# $1 Full path to the installer (unused)
|
|
# $2 Location of the Homebrew installation we may need to move into place
|
|
# $3 Target install location (unused)
|
|
# $4 System root directory (unused)
|
|
set -xeu
|
|
|
|
# disable analytics while installing
|
|
export HOMEBREW_NO_ANALYTICS_THIS_RUN=1
|
|
export HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT=1
|
|
|
|
# verify the installation exists
|
|
# default to /opt/homebrew to make development/testing easier
|
|
homebrew_directory="${2:-/opt/homebrew}"
|
|
if [[ ! -d "${homebrew_directory:?}" ]]
|
|
then
|
|
echo "no directory at ${homebrew_directory}!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# add Git to path
|
|
export PATH="/Library/Developer/CommandLineTools/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:${PATH}"
|
|
|
|
# reset Git repository
|
|
cd "${homebrew_directory}"
|
|
git reset --hard
|
|
git checkout -f master
|
|
git branch | grep -v '\*' | xargs -n 1 git branch -D
|
|
|
|
# move to /usr/local if on x86_64
|
|
if [[ $(uname -m) == "x86_64" ]]
|
|
then
|
|
mv "${homebrew_directory}" "/usr/local/Homebrew"
|
|
# create symlink to /usr/local/bin/brew
|
|
ln -s "/usr/local/Homebrew/bin/brew" "/usr/local/bin/brew"
|
|
|
|
homebrew_directory="/usr/local"
|
|
cd "${homebrew_directory}"
|
|
fi
|
|
|
|
# create missing directories
|
|
sudo mkdir -p Cellar Frameworks etc include lib opt sbin share var/homebrew/linked
|
|
|
|
# set permissions
|
|
logged_in_user=$(echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }')
|
|
group=$(id -gn "${logged_in_user}")
|
|
if [[ "${homebrew_directory}" == "/usr/local" ]]
|
|
then
|
|
chown -R "${logged_in_user}:${group}" Cellar Frameworks Homebrew bin etc include lib sbin share var/homebrew/linked
|
|
else
|
|
chown -R "${logged_in_user}:${group}" .
|
|
fi
|