Skip to content

Instantly share code, notes, and snippets.

@dannygsmith
Last active April 23, 2018 19:50
Show Gist options
  • Save dannygsmith/c6c280f0c6f7664b0037944c73e13c35 to your computer and use it in GitHub Desktop.
Save dannygsmith/c6c280f0c6f7664b0037944c73e13c35 to your computer and use it in GitHub Desktop.
Install all of the files for valet etc.
#!/usr/bin/env bash
SCRIPTS="bin"
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
VP_BOLD='\033[1m'
# go to the home directory and create a bin directory
cd
# check to see if directory exists
if [ ! -d "$SCRIPTS" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir ${HOME}/${SCRIPTS}
fi
#echo ${HOME}/${SCRIPTS}
cd ${HOME}/${SCRIPTS}
# change permission for only the owner
chmod 700 ${HOME}/${SCRIPTS}
#ls -al ${HOME}/${SCRIPTS}
# check to see if directory exists
if [ ! -d "${SCRIPTS}" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mkdir ${HOME}/${SCRIPTS}/backup
fi
curl -LJO https://gist.githubusercontent.com/dannygsmith/7a05686adf69018ad5017b8009e0b437/raw/95e79ac33473c5a4c7ffc6bd7d028220e2a20e69/.bash_profile
curl -LJO https://gist.githubusercontent.com/dannygsmith/694fa4d86a6691fac1a17becb4cc4a65/raw/3e15ff118e07bcb42b8fa8c3e6af0db09bea0eb4/.bashrc
curl -LJO https://gist.githubusercontent.com/dannygsmith/50ad7321df7b9b95bc334afd993ebe32/raw/f4c61dd5a73e1dc5be78f6cea6509cfa53ed3ab9/my.cnf
curl -LJO https://gist.githubusercontent.com/dannygsmith/6bbd7c3a90fb66cc6d0e996c4c66726f/raw/2a03b3acda80068128995ec7bccaeea1be9039c4/valet-install
curl -LJO https://gist.githubusercontent.com/dannygsmith/05f997dda77e7ffa7b62c4dfaffe244b/raw/e79ac53148f1f7f66228941ee0bbf35b3d74ccaf/siteground.sh
curl -LJO https://gist.githubusercontent.com/dannygsmith/e8c80bdd326d56f2bb451569db0589a6/raw/da0d896ee437ebe6a4133dd8913fa6ec524988c2/wp-blueprint-backup
curl -LJO https://gist.githubusercontent.com/dannygsmith/127666b417582c65aaafb5a2962a9996/raw/ee1e70dd1dd6c90387fc5464ca0c8aed63882b2c/wp-daily-updates
curl -LJO https://gist.githubusercontent.com/dannygsmith/d70f42f035d23365ca8c3ae9be7a4b7c/raw/4df920ade535c891dcfc34893ae40cc3af2e2b78/wp-updates
curl -LJO https://gist.githubusercontent.com/dannygsmith/c8ce8b8f2831cc371929078ac0576f68/raw/5eb85b44de2b2c4c8578814114f4b9fac9c8f75f/valet-list
curl -LJO https://gist.githubusercontent.com/dannygsmith/592c7dc61615c665e3fb805fb79eb2b7/raw/29ce4ee8b503e7f40094bccad10c828b7c1fa04f/wp-create
curl -LJO https://gist.githubusercontent.com/dannygsmith/99a1dfd2806e7cc63bdb232053a157ae/raw/e2277513bf60b76f2a9fd0971c645344ec9c9c79/wp-drop
curl -LJO https://gist.githubusercontent.com/dannygsmith/13584c154ecfc14418983d892224407d/raw/7c3df39a1184eebc6012747a021fc2f10d80ab78/valetStop
curl -LJO https://gist.githubusercontent.com/dannygsmith/5b57479c87064fae8852b61d127675b0/raw/6368380d4a5f086d2ac9ce689124ba89e050621f/valetStart
curl -LJO https://gist.githubusercontent.com/dannygsmith/1bd89bbb10ed24e26e66fdabddb61651/raw/e206bedbf24415bed3365ec6a6a34d010222ea8b/valet-destroy
curl -LJO https://gist.githubusercontent.com/dannygsmith/dfe2b322e7a371949221a3a645288648/raw/8a8d22406356ba8821c4f0c52b868f9a40469bb1/crontab.txt
curl -LJO https://gist.githubusercontent.com/dannygsmith/dd468e0b2e88fd443318e5a08f05054f/raw/a1a469ed6c7b7a79c94493d734c9fd89fac731a6/wp-destroy
curl -LJO https://gist.githubusercontent.com/dannygsmith/1d51debe4c82d8ee6ec1107d88bae08e/raw/c7d8edff450aa2a20b074b7b0aced2f7b8957320/hosts.txt
curl -LJO https://gist.githubusercontent.com/dannygsmith/084b9b77ffe6ddeddb2d568b30278f96/raw/1a1e0a79f958801a2c1a81cb7bf8b6aa3ad984e3/wp-db-restore
curl -LJO https://gist.githubusercontent.com/dannygsmith/aff29d036ceabf24b8e2340f1fbf32c2/raw/e398bd847e55ce8350204bac517452bf82407a60/my.txt
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod 700 ${HOME}/${SCRIPTS}/*
chmod 700 ${HOME}/${SCRIPTS}/.*
# check to see if file exists
if [ -d "${HOME}/.bashrc" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mv ${HOME}/.bashrc ${HOME}/${SCRIPTS}/backup
fi
cp -p ${HOME}/${SCRIPTS}/.bashrc ${HOME}
# check to see if file exists
if [ -d "${HOME}/.bash_profile" ]; then
# Control will enter here if $DIRECTORY doesn't exist.
mv ${HOME}/.bash_profile ${HOME}/${SCRIPTS}/backup
fi
cp -p ${HOME}/${SCRIPTS}/.bash_profile ${HOME}
echo -e "${VP_GREEN}${VP_BOLD}Files have been installed${VP_NONE}"
export PATH="$HOME/$SCRIPTS:$PATH"
echo -e "${VP_GREEN}${VP_BOLD}Installing xcode${VP_NONE}"
# install xcode-command line tools
# You will need to answer yes to the prompts to continue
# xcode-select --install
# update Homebrew if present, otherwise install
which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
echo -e "${VP_GREEN}${VP_BOLD}Installing homebrew${VP_NONE}"
echo -e "${VP_GREEN}Installing brew${VP_NONE}"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
# upgrade homebrew formulas
echo -e "${VP_GREEN}Updating brew${VP_NONE}"
brew update
brew upgrade
# cleanup mess
brew doctor
brew cleanup
brew prune
fi
# check to see if expect is installed
which -s expect
if [[ $? != 0 ]] ; then
#install expect
brew install expect
elese
echo -e "${VP_GREEN}Expect was already installed${VP_NONE}"
fi
echo -e "${VP_GREEN}${VP_BOLD}Installing git${VP_NONE}"
# Now we are going to install a new copy of get
echo -e "${VP_GREEN}Installing git${VP_NONE}"
brew install git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment