mirror of
https://github.com/ff4500/utilities.git
synced 2026-07-01 11:47:04 -05:00
working
This commit is contained in:
70
system/macos/basic_IM_utilities_setup/lib/functions.sh
Executable file
70
system/macos/basic_IM_utilities_setup/lib/functions.sh
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
function install_homebrew() {
|
||||
brew_check=$(command -v brew) > /dev/null 2>&1
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
echo -e "You don't have Homebrew installed. Installing..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
if [[ $? != 0 ]]; then
|
||||
error "unable to install homebrew, script $0 abort!"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
echo -e "Brew is already installed"
|
||||
read -r -p "Would you like to run brew update && upgrade? [y|N] " response
|
||||
if [[ $response =~ (y|yes|Y) ]]; then
|
||||
action "Updating homebrew..."
|
||||
brew update
|
||||
ok "Homebrew updated"
|
||||
action "Upgrading brew packages..."
|
||||
brew upgrade
|
||||
ok "Brews upgraded"
|
||||
else
|
||||
ok "Skipped brew package upgrades."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_brewcask() {
|
||||
output=$(command -v brew cask --version) > /dev/null 2>&1
|
||||
if [[ $? != 0 ]]; then
|
||||
echo -e "brew-cask is not installed"
|
||||
else
|
||||
echo -e "brew-cask is installed"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# source ./echos.sh
|
||||
|
||||
function require_cask() {
|
||||
running "brew cask $1"
|
||||
brew cask list $1 > /dev/null 2>&1 | true
|
||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||
action "brew cask install $1 $2"
|
||||
brew cask install $1
|
||||
if [[ $? != 0 ]]; then
|
||||
error "failed to install $1! aborting..."
|
||||
# exit -1
|
||||
fi
|
||||
fi
|
||||
ok
|
||||
}
|
||||
|
||||
function require_brew() {
|
||||
running "brew $1 $2"
|
||||
brew list $1 > /dev/null 2>&1 | true
|
||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||
action "brew install $1 $2"
|
||||
brew install $1 $2
|
||||
if [[ $? != 0 ]]; then
|
||||
error "failed to install $1! aborting..."
|
||||
# exit -1
|
||||
fi
|
||||
fi
|
||||
ok
|
||||
}
|
||||
Reference in New Issue
Block a user