-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathhomebrew.sh
48 lines (38 loc) · 1.66 KB
/
homebrew.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash -e
################################################################################
## File: homebrew.sh
## Desc: Installs the Homebrew on Linux
## Caveat: Brew MUST NOT be used to install any tool during the image build to avoid dependencies, which may come along with the tool
################################################################################
# Source the helpers
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/install.sh
# Install the Homebrew on Linux
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Invoke shellenv to make brew available during runnig session
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
setEtcEnvironmentVariable HOMEBREW_NO_AUTO_UPDATE 1
setEtcEnvironmentVariable HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS 3650
# Validate the installation ad hoc
echo "Validate the installation reloading /etc/environment"
reloadEtcEnvironment
# Install additional brew packages
# brew GCC installation needed because the default Ubuntu components
# are too old for current brew software
# See:
# https://github.com/Homebrew/homebrew-core/issues/110877
brew_packages=$(get_toolset_value .brew[].name)
for package in $brew_packages; do
echo "Install $package"
brew install $package
# create symlinks for zstd in /usr/local/bin
if [[ $package == "zstd" ]]; then
find $(brew --prefix)/bin -name *zstd* -exec sudo sh -c 'ln -s {} /usr/local/bin/$(basename {})' ';'
fi
done
gfortran=$(brew --prefix)/bin/gfortran
# Remove gfortran symlink, not to conflict with system gfortran
if [[ -e $gfortran ]]; then
rm $gfortran
fi
invoke_tests "Tools" "Homebrew"