2016-01-24 10:01:44 +00:00
|
|
|
#!/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 {
|
|
|
|
cp ~/.dotconfig/Darwin/com.shauninman.Day-O.plist ~/Library/Preferences
|
|
|
|
|
|
|
|
# Ensure any preference cache is cleared
|
|
|
|
pkill -u ${USER} cfprefsd
|
|
|
|
}
|
|
|
|
|
2016-03-11 20:24:39 +00:00
|
|
|
function install_Linux_software {
|
2016-02-03 08:19:29 +00:00
|
|
|
#-------------------------------
|
|
|
|
# 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."
|
2016-02-03 08:19:29 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
#-------------------------------
|
2016-01-27 15:55:53 +00:00
|
|
|
|
2016-03-11 20:11:11 +00:00
|
|
|
xargs -n1 sudo ${INSTALLCMD} <<-EOF
|
2016-02-03 08:19:29 +00:00
|
|
|
ack
|
2016-03-01 10:20:34 +00:00
|
|
|
archey
|
2016-02-29 11:52:27 +00:00
|
|
|
bash-completion
|
2016-02-03 08:19:29 +00:00
|
|
|
git
|
|
|
|
htop
|
2016-02-16 19:03:18 +00:00
|
|
|
mosh
|
2016-03-01 10:20:34 +00:00
|
|
|
nmap
|
2016-03-01 18:59:18 +00:00
|
|
|
p7zip
|
2016-04-08 08:40:05 +01:00
|
|
|
psgrep
|
2016-03-01 10:23:04 +00:00
|
|
|
pv
|
2016-02-05 13:18:22 +00:00
|
|
|
ss
|
2016-02-03 08:19:29 +00:00
|
|
|
vim
|
|
|
|
EOF
|
|
|
|
}
|
2016-01-24 12:42:52 +00:00
|
|
|
|
2016-03-11 20:24:39 +00:00
|
|
|
function install_Darwin_software {
|
2016-02-03 08:19:29 +00:00
|
|
|
#-------------------------------
|
|
|
|
# Install Homebrew if missing
|
|
|
|
#-------------------------------
|
|
|
|
if [ ! -x /usr/local/bin/brew ]; then
|
|
|
|
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
|
|
|
fi
|
|
|
|
#-------------------------------
|
2016-01-24 12:42:52 +00:00
|
|
|
|
2016-05-12 08:42:01 +01:00
|
|
|
# Disable Homebrew's Google Analytics tracking
|
|
|
|
brew analytics off
|
|
|
|
|
2016-03-07 21:23:56 +00:00
|
|
|
# Update Brew formulae if older than 24 hours
|
|
|
|
find /usr/local/.git -name FETCH_HEAD -mtime +0 -exec brew update \;
|
|
|
|
|
2016-03-11 19:25:16 +00:00
|
|
|
# Install homebrew/bundle tap if we don't have it
|
|
|
|
[ -d /usr/local/Library/Taps/homebrew/homebrew-bundle ] || brew tap homebrew/bundle
|
2016-02-03 08:19:29 +00:00
|
|
|
|
|
|
|
#-------------------------------
|
2016-03-11 19:25:16 +00:00
|
|
|
# Run brew bundle if there's a newer version of Brewfile
|
2016-02-03 08:19:29 +00:00
|
|
|
#-------------------------------
|
2016-03-16 17:41:28 +00:00
|
|
|
if [ ~/.Brewfile -nt ~/.Brewfile.updated ]; then
|
|
|
|
( brew bundle --global install && touch ~/.Brewfile.updated )
|
2016-03-11 19:25:16 +00:00
|
|
|
fi
|
2016-02-03 08:19:29 +00:00
|
|
|
#-------------------------------
|
|
|
|
|
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
|
|
|
#-------------------------------
|
2016-03-11 19:25:16 +00:00
|
|
|
brew upgrade
|
2016-02-09 08:30:03 +00:00
|
|
|
brew cleanup
|
2016-03-19 12:07:24 +00:00
|
|
|
brew bundle --global check
|
|
|
|
cask-upgrade -y && cask-tidy
|
2016-02-18 15:19:45 +00:00
|
|
|
brew cask cleanup
|
2016-02-09 08:30:03 +00:00
|
|
|
#-------------------------------
|
2016-03-29 20:19:19 +01:00
|
|
|
|
|
|
|
#-------------------------------
|
|
|
|
# OS X software update
|
|
|
|
#-------------------------------
|
|
|
|
softwareupdate -irv
|
|
|
|
#-------------------------------
|
2016-02-03 08:19:29 +00:00
|
|
|
}
|
2016-01-28 18:43:32 +00:00
|
|
|
|
2016-03-07 21:23:56 +00:00
|
|
|
echo "#-------------------------------"
|
|
|
|
echo "# START: $(date)"
|
|
|
|
echo "#-------------------------------"
|
|
|
|
|
2016-03-11 20:24:39 +00:00
|
|
|
# Call the install function appropriate for this platform
|
|
|
|
install_$(uname -s)_software
|
2016-08-20 10:09:08 +01:00
|
|
|
configure_$(uname -s)_software
|
2016-02-03 08:19:29 +00:00
|
|
|
|
2016-03-07 08:15:55 +00:00
|
|
|
#-------------------------------
|
2016-03-11 19:38:50 +00:00
|
|
|
# Ensure Vim plugins are up-to-date, if older than one day
|
2016-03-07 08:15:55 +00:00
|
|
|
#-------------------------------
|
2016-03-11 19:59:26 +00:00
|
|
|
find ~/.vim/updated -mtime +0 -exec bash -c "\
|
2016-03-11 19:38:50 +00:00
|
|
|
vim +PluginInstall! +PluginClean! +qall
|
2016-03-11 19:59:26 +00:00
|
|
|
touch ~/.vim/updated
|
2016-03-11 19:38:50 +00:00
|
|
|
" \;
|
2016-03-07 08:15:55 +00:00
|
|
|
#-------------------------------
|
|
|
|
|
2016-03-07 21:23:56 +00:00
|
|
|
echo "#-------------------------------"
|
|
|
|
echo "# END: $(date)"
|
|
|
|
echo "#-------------------------------"
|
|
|
|
|
2016-02-03 08:19:29 +00:00
|
|
|
exit 0
|