mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
add Homebrew on Linux (#589)
* Add homebrew installation and validation scripts * Update `/etc/environment` in `updatepath.sh` script Keep this code for sake of compatibility with the existing installation logic. It will be changed in its own PR * Remove env. variables from homebrew validation task * Move reboot to the dedicated script and task Co-authored-by: Sergey Dolin <v-sedoli@micorosoft.com>
This commit is contained in:
14
images/linux/scripts/installers/homebrew-validate.sh
Normal file
14
images/linux/scripts/installers/homebrew-validate.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: homebrew-validate.sh
|
||||
## Desc: Validate the Homebrew can run after reboot without extra configuring
|
||||
################################################################################
|
||||
|
||||
# Validate the installation
|
||||
echo "Validate the Homebrew can run after reboot"
|
||||
|
||||
if ! command -v brew; then
|
||||
echo "brew cat not run after reboot"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
36
images/linux/scripts/installers/homebrew.sh
Normal file
36
images/linux/scripts/installers/homebrew.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: homebrew.sh
|
||||
## Desc: Installs the Homebrew on Linux
|
||||
################################################################################
|
||||
|
||||
# Source the helpers
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
source $HELPER_SCRIPTS/etc-environment.sh
|
||||
|
||||
# Install the Homebrew on Linux
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
|
||||
|
||||
# Make brew files and directories writable by any user
|
||||
sudo chmod -R o+w $HOMEBREW_PREFIX
|
||||
|
||||
# Update /etc/environemnt
|
||||
## Put HOMEBREW_* variables
|
||||
brew shellenv|grep 'export HOMEBREW'|sed -E 's/^export (.*);$/\1/' | sudo tee -a /etc/environment
|
||||
# add brew executables locations to PATH
|
||||
brew_path=$(brew shellenv|grep '^export PATH' |sed -E 's/^export PATH="([^$]+)\$.*/\1/')
|
||||
addEtcEnvironmentPathElement "$brew_path"
|
||||
|
||||
# Validate the installation ad hoc
|
||||
echo "Validate the installation reloading /etc/environment"
|
||||
reloadEtcEnvironment
|
||||
|
||||
if ! command -v brew; then
|
||||
echo "brew was not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Document the installed version
|
||||
echo "Document the installed version"
|
||||
DocumentInstalledItem "Homebrew on Linux ($(brew -v 2>&1))"
|
||||
@@ -3,4 +3,5 @@
|
||||
CARGO_HOME=/usr/share/rust/.cargo
|
||||
DOTNET_TOOLS_HOME=/home/runner/.dotnet/tools
|
||||
PHP_COMPOSER_HOME=/home/runner/.config/composer/vendor/bin
|
||||
echo "PATH=${CARGO_HOME}/bin:${PATH}:${DOTNET_TOOLS_HOME}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment
|
||||
BREW_PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin
|
||||
echo "PATH=${BREW_PATH}:${CARGO_HOME}/bin:${PATH}:${DOTNET_TOOLS_HOME}:${PHP_COMPOSER_HOME}" | tee -a /etc/environment
|
||||
|
||||
Reference in New Issue
Block a user