chore(brew): Automatically install gcc if not present (#256)
This commit is contained in:
commit
14d98ff8e3
2 changed files with 13 additions and 7 deletions
|
|
@ -16,6 +16,7 @@ The brew module installs [Homebrew / Linuxbrew](https://brew.sh/) on your system
|
|||
|
||||
### Build-time:
|
||||
|
||||
- Necessary Brew package dependency `gcc` is installed if not present in the base image
|
||||
- Directories `/home/` & `/root/` are created
|
||||
- Empty `.dockerenv` file is created in the root of the image-builder, to convince official Brew installation script that we are **not** running as root
|
||||
- Official brew installation script is downloaded & executed
|
||||
|
|
|
|||
|
|
@ -2,22 +2,24 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
# Convince the installer that we are in CI
|
||||
touch /.dockerenv
|
||||
|
||||
# Debugging
|
||||
DEBUG="${DEBUG:-false}"
|
||||
if [[ "${DEBUG}" == true ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Check if gcc is installed
|
||||
if ! command -v gcc &> /dev/null
|
||||
then
|
||||
echo "ERROR: \"gcc\" package could not be found."
|
||||
# Check if gcc is installed & install it if it's not
|
||||
# (add VanillaOS package manager in the future when it gets supported)
|
||||
if ! command -v gcc &> /dev/null; then
|
||||
if command -v rpm-ostree &> /dev/null; then
|
||||
echo "Installing \"gcc\" package, which is necessary for Brew to function"
|
||||
rpm-ostree install gcc
|
||||
else
|
||||
echo "ERROR: \"gcc\" package could not be found"
|
||||
echo " Brew depends on \"gcc\" in order to function"
|
||||
echo " Please include \"gcc\" in the list of packages to install with the system package manager"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Module-specific directories and paths
|
||||
|
|
@ -68,6 +70,9 @@ fi
|
|||
mkdir -p /var/home
|
||||
mkdir -p /var/roothome
|
||||
|
||||
# Convince the installer that we are in CI
|
||||
touch /.dockerenv
|
||||
|
||||
# Always install Brew
|
||||
echo "Downloading and installing Brew..."
|
||||
curl -Lo /tmp/brew-install https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue