dotfiles/bin/software-install

99 lines
2.6 KiB
Plaintext
Raw Normal View History

#!/bin/bash
2016-08-20 10:09:08 +01:00
function configure_Linux_software {
2016-08-24 07:10:09 +01:00
echo "Not configured yet."
2016-08-20 10:09:08 +01:00
}
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
2016-02-18 07:01:05 +00:00
echo "Sorry, I don't know how to install software on this OS yet."
exit 1
fi
#-------------------------------
xargs -n1 sudo ${INSTALLCMD} <<-EOF
ack
2016-03-01 10:20:34 +00:00
archey
2016-02-29 11:52:27 +00:00
bash-completion
git
htop
mosh
2016-03-01 10:20:34 +00:00
nmap
2016-03-01 18:59:18 +00:00
p7zip
psgrep
2016-03-01 10:23:04 +00:00
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
#-------------------------------
2016-02-09 08:30:03 +00:00
#-------------------------------
2016-03-29 20:19:19 +01:00
# Upgrade and clean Brew
2016-02-09 08:30:03 +00:00
#-------------------------------
brew upgrade
2016-02-09 08:30:03 +00:00
brew cleanup
brew bundle --global check
brew cask cleanup
2017-04-10 20:40:55 +01:00
brew cu -y --cleanup
2016-02-09 08:30:03 +00:00
#-------------------------------
2016-03-29 20:19:19 +01:00
#-------------------------------
# OS X software update
#-------------------------------
softwareupdate -irv
#-------------------------------
}
echo "#-------------------------------"
echo "# START: $(date)"
echo "#-------------------------------"
# Call the install function appropriate for this platform
install_$(uname -s)_software
2016-08-20 10:09:08 +01:00
configure_$(uname -s)_software
echo "#-------------------------------"
echo "# END: $(date)"
echo "#-------------------------------"
exit 0