Attempt to install software on Linux too.

This commit is contained in:
Scott Wallace 2016-02-03 08:19:29 +00:00
parent 3e073236db
commit 40c6ef8560

View file

@ -1,38 +1,53 @@
#!/bin/bash #!/bin/bash
#------------------------------- function install_linux_software {
# Check OS #-------------------------------
#------------------------------- # Check the OS and set install command
if [ $(uname -s) != "Darwin" ]; then #-------------------------------
echo "This should only run on Mac OS X." 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 exit 1
fi fi
#------------------------------- #-------------------------------
#------------------------------- xargs ${INSTALLCMD} <<-EOF
# Install Homebrew if missing ack
#------------------------------- git
if [ ! -x /usr/local/bin/brew ]; then 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)" ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi fi
#------------------------------- #-------------------------------
#------------------------------- #-------------------------------
# Install the basics # Install the basics
#------------------------------- #-------------------------------
xargs brew install <<EOF xargs brew install <<-EOF
ack
git git
coreutils coreutils
htop htop
python3 python3
vim vim
EOF EOF
#------------------------------- #-------------------------------
#------------------------------- #-------------------------------
# Install Casks # Install Casks
#------------------------------- #-------------------------------
xargs brew cask install <<EOF xargs brew cask install <<-EOF
alfred alfred
bbc-iplayer-downloads bbc-iplayer-downloads
beardedspice beardedspice
@ -57,13 +72,26 @@ xargs brew cask install <<EOF
xquartz xquartz
yubikey-neo-manager yubikey-neo-manager
yubikey-personalization-gui yubikey-personalization-gui
EOF 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
#-------------------------------
}
#------------------------------- #-------------------------------
# Some tools require root set-UID # Check for Mac OS X
#------------------------------- #-------------------------------
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 %' if [ $(uname -s) == "Darwin" ]; then
htop install_osx_software
EOF else
install_linux_software
fi
#------------------------------- #-------------------------------
exit 0