dotfiles/bin/software-install
Scott Wallace 717d0c1fa1 Convert genpw from Bash to Python.
Add a method to install Python modules via Pip to `software-install`.
2017-04-14 16:13:26 +01:00

104 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
function configure_Linux_software {
echo "Not configured yet."
}
function configure_Darwin_software {
# Ensure any preference cache is cleared
pkill -u ${USER} cfprefsd
}
function install_Linux_software {
#-------------------------------
# Check the OS and set install command
#-------------------------------
if [ -x "$(which yum)" ]; then
INSTALLCMD="yum install -y"
elif [ -x "$(which apt-get)" ]; then
INSTALLCMD="apt-get install -y"
else
echo "Sorry, I don't know how to install software on this OS yet."
exit 1
fi
#-------------------------------
xargs -n1 sudo ${INSTALLCMD} <<-EOF
ack
archey
bash-completion
git
htop
mosh
nmap
p7zip
psgrep
pv
ss
vim
EOF
}
function install_Darwin_software {
#-------------------------------
# Install Homebrew if missing
#-------------------------------
if [ ! -x /usr/local/bin/brew ]; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap buo/cask-upgrade
fi
#-------------------------------
# Disable Homebrew's Google Analytics tracking
brew analytics off
# Update Brew formulae if older than 24 hours
find /usr/local/Homebrew/.git -name FETCH_HEAD -mtime +0 -exec brew update \;
# Install homebrew/bundle tap if we don't have it
[ -d /usr/local/Library/Taps/homebrew/homebrew-bundle ] || brew tap homebrew/bundle
#-------------------------------
# Run brew bundle if there's a newer version of Brewfile
#-------------------------------
if [ ~/.Brewfile -nt ~/.Brewfile.updated ]; then
( brew bundle --global install && touch ~/.Brewfile.updated )
fi
#-------------------------------
#-------------------------------
# Upgrade and clean Brew
#-------------------------------
brew upgrade
brew cleanup
brew bundle --global check
brew cask cleanup
brew cu -y --cleanup
#-------------------------------
#-------------------------------
# OS X software update
#-------------------------------
softwareupdate -ia --verbose
#-------------------------------
}
function install_python_modules {
pip install pyopenssl
}
echo "#-------------------------------"
echo "# START: $(date)"
echo "#-------------------------------"
# Call the install function appropriate for this platform
install_$(uname -s)_software
configure_$(uname -s)_software
install_python_modules
echo "#-------------------------------"
echo "# END: $(date)"
echo "#-------------------------------"
exit 0