diff --git a/home/dot_local/bin/executable_provision.tmpl b/home/dot_local/bin/executable_provision.tmpl index 350713e3..6abfc5c5 100644 --- a/home/dot_local/bin/executable_provision.tmpl +++ b/home/dot_local/bin/executable_provision.tmpl @@ -90,13 +90,13 @@ if command -v qubesctl > /dev/null; then fi ### System package manager update / Homebrew dependencies -if ! command -v curl > /dev/null || ! command -v git > /dev/null; then +if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v brew > /dev/null; then # shellcheck disable=SC2016 logg info 'Ensuring `curl` and `git` are installed via the system package manager' if command -v apt-get > /dev/null; then # Debian / Ubuntu sudo apt-get update - sudo apt-get install -y curl git + sudo apt-get install -y build-essential curl git elif command -v dnf > /dev/null; then # Fedora sudo dnf install -y curl git @@ -140,9 +140,17 @@ ensurePackageManagerHomebrew() { logg info 'Installing Homebrew' if command -v sudo > /dev/null && sudo -n true; then echo | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install gcc + fi else logg info 'Looks like the user does not have passwordless sudo privileges. A sudo password may be required.' bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || BREW_EXIT_CODE="$?" + if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install gcc + fi if [ -n "$BREW_EXIT_CODE" ]; then if command -v brew > /dev/null; then logg warn 'Homebrew was installed but part of the installation failed. Attempting to fix..' @@ -173,6 +181,8 @@ if command -v brew > /dev/null; then installBrewPackage gum installBrewPackage node installBrewPackage zx +else + logg error 'Homebrew is not available in the PATH' && exit 1 fi ### Ensure source files are present diff --git a/local/provision.sh b/local/provision.sh index 5eb73de0..cc706f56 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -256,13 +256,13 @@ if command -v qubesctl > /dev/null; then fi ### System package manager update / Homebrew dependencies -if ! command -v curl > /dev/null || ! command -v git > /dev/null; then +if ! command -v curl > /dev/null || ! command -v git > /dev/null || ! command -v brew > /dev/null; then # shellcheck disable=SC2016 logg info 'Ensuring `curl` and `git` are installed via the system package manager' if command -v apt-get > /dev/null; then # Debian / Ubuntu sudo apt-get update - sudo apt-get install -y curl git + sudo apt-get install -y build-essential curl git elif command -v dnf > /dev/null; then # Fedora sudo dnf install -y curl git @@ -306,9 +306,17 @@ ensurePackageManagerHomebrew() { logg info 'Installing Homebrew' if command -v sudo > /dev/null && sudo -n true; then echo | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install gcc + fi else logg info 'Looks like the user does not have passwordless sudo privileges. A sudo password may be required.' bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || BREW_EXIT_CODE="$?" + if [ -f /home/linuxbrew/.linuxbrew/bin/brew ]; then + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install gcc + fi if [ -n "$BREW_EXIT_CODE" ]; then if command -v brew > /dev/null; then logg warn 'Homebrew was installed but part of the installation failed. Attempting to fix..'