Attempt to install software on Linux too.
This commit is contained in:
parent
3e073236db
commit
40c6ef8560
|
@ -1,14 +1,28 @@
|
|||
#!/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
|
||||
fi
|
||||
#-------------------------------
|
||||
|
||||
xargs ${INSTALLCMD} <<-EOF
|
||||
ack
|
||||
git
|
||||
htop
|
||||
vim
|
||||
EOF
|
||||
}
|
||||
|
||||
function install_osx_software {
|
||||
#-------------------------------
|
||||
# Install Homebrew if missing
|
||||
#-------------------------------
|
||||
|
@ -20,7 +34,8 @@ fi
|
|||
#-------------------------------
|
||||
# Install the basics
|
||||
#-------------------------------
|
||||
xargs brew install <<EOF
|
||||
xargs brew install <<-EOF
|
||||
ack
|
||||
git
|
||||
coreutils
|
||||
htop
|
||||
|
@ -32,7 +47,7 @@ EOF
|
|||
#-------------------------------
|
||||
# Install Casks
|
||||
#-------------------------------
|
||||
xargs brew cask install <<EOF
|
||||
xargs brew cask install <<-EOF
|
||||
alfred
|
||||
bbc-iplayer-downloads
|
||||
beardedspice
|
||||
|
@ -63,7 +78,20 @@ 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 %'
|
||||
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 for Mac OS X
|
||||
#-------------------------------
|
||||
if [ $(uname -s) == "Darwin" ]; then
|
||||
install_osx_software
|
||||
else
|
||||
install_linux_software
|
||||
fi
|
||||
#-------------------------------
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue