From 40c6ef856096b9e59ca82b261d4a807dc2bbeb38 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Wed, 3 Feb 2016 08:19:29 +0000 Subject: [PATCH] Attempt to install software on Linux too. --- bin/software-install.sh | 152 ++++++++++++++++++++++++---------------- 1 file changed, 90 insertions(+), 62 deletions(-) diff --git a/bin/software-install.sh b/bin/software-install.sh index 7eb1519..1103245 100755 --- a/bin/software-install.sh +++ b/bin/software-install.sh @@ -1,69 +1,97 @@ #!/bin/bash +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 machine yet." + exit 1 + fi + #------------------------------- + + xargs ${INSTALLCMD} <<-EOF + ack + git + htop + vim + EOF +} + +function install_osx_software { + #------------------------------- + # Install Homebrew if missing + #------------------------------- + if [ ! -x /usr/local/bin/brew ]; then + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + fi + #------------------------------- + + #------------------------------- + # Install the basics + #------------------------------- + xargs brew install <<-EOF + ack + git + coreutils + htop + python3 + vim + EOF + #------------------------------- + + #------------------------------- + # Install Casks + #------------------------------- + xargs brew cask install <<-EOF + alfred + bbc-iplayer-downloads + beardedspice + dashlane + day-o + dropbox + cleanmymac + firefox + flux + gitx + gpgtools + google-chrome + google-drive + google-hangouts + handbrake + iterm2 + sonos + textmate + vlc + vmware-fusion + wireshark + xquartz + yubikey-neo-manager + yubikey-personalization-gui + EOF + #------------------------------- + + #------------------------------- + # Some tools require root set-UID + #------------------------------- + xargs -n1 -I % bash -c 'find $(dirname $(greadlink -f $(which %))) -name $(basename $(which %)) -type f ! \( -perm -u+s -a -user root \) ' <<-EOF | xargs -n 1 -I % sudo bash -c 'chown root: % && chmod u+s %' + htop + EOF + #------------------------------- +} + #------------------------------- -# Check OS +# Check for Mac OS X #------------------------------- -if [ $(uname -s) != "Darwin" ]; then - echo "This should only run on Mac OS X." - exit 1 +if [ $(uname -s) == "Darwin" ]; then + install_osx_software +else + install_linux_software fi #------------------------------- -#------------------------------- -# Install Homebrew if missing -#------------------------------- -if [ ! -x /usr/local/bin/brew ]; then - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -fi -#------------------------------- - -#------------------------------- -# Install the basics -#------------------------------- -xargs brew install <