Skip to content

Instantly share code, notes, and snippets.

@Twoody
Last active November 4, 2019 19:27
Show Gist options
  • Save Twoody/1a782e99615182e819879932bed418e9 to your computer and use it in GitHub Desktop.
Save Twoody/1a782e99615182e819879932bed418e9 to your computer and use it in GitHub Desktop.
First day installation for a phabricator, docker, and all the important stuff 🤘
#!/bin/sh
#***************************************************************************#
#***************************************************************************#
# FIRST DAY INSTALLS #
#***************************************************************************#
#***************************************************************************#
pprint (){
printf "############ ############ ############ ############ ############ ############\n"
true
}
#TODO: Check if git is a command; If not, probably install xcode via mac...
ad=/usr/local/bin/arcanist
ld=/usr/local/bin/libphutil
td=~/some_random_dir
pd=~/workspace/precoaDependencies
_pp="~/workspace/precoaProjects"
pp=~/workspace/precoaProjects
_pd="~/workspace/precoaDependencies"
clear
pprint
printf "\nSTARTING first-day-install PROCESS\n"
# Package Manager of Choice
if brew --version > /dev/null 2>&1;
then
printf "\tbrew already installed\n"
else
printf "\tINSTALLING HOMEBREW\n"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
printf "\tINSTALLED HOMEBREW\n"
fi
if [ -d $td ]; then
#TODO: Just make a function to append a hash at init;
printf "ERROR: ~/some_random_dir/ MUST NOT BE A DIRECTORY..."
exit 1
fi
# Terminal Config
if [ ! -f ~/.bashrc ];
then
printf "\tWriting over ~/.bashrc from gist.github.com/twoody/\n"
mkdir $td
git clone https://gist.github.com/799277ca2fef6461e02aa94f2c3a6d5b.git $td
mv $td/.bashrc ~/
rm -rf $td
source ~/.bashrc
else
printf "\t~/.bashrc already exists\n"
fi
if [ ! -d ~/.vim/ ];
then
printf "\tMaking a ~/.vim/ directory\n"
mkdir ~/.vim/
else
printf "\t.vim already exists\n"
fi
if [ ! -d ~/.vim/bundle ];
then
printf "\tMaking a ~/.vim/bundle/ directory\n"
mkdir ~/.vim/bundle/
else
printf "\t.vim/bundle already exists\n"
fi
if [ ! -d ~/.vim/bundle/Vundle.vim/ ];
then
printf "\tMaking a ~/.vim/bundle/VundleVim directory\n"
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
else
printf "\t.vim/bundle/Vundle.vim already exists\n"
fi
if [ ! -d ~/.vim/bundle/vim-vue/ ];
then
printf "\tMaking a ~/.vim/bundle/vim-vue directory\n"
git clone https://github.com/posva/vim-vue.git ~/.vim/bundle/vim-vue
else
printf "\t.vim/bundle/vim-vue already exists\n"
fi
if [ ! -f ~/.vimrc ];
then
printf "\tWriting over ~/.vimrc from gist.github.com/twoody/\n"
mkdir $td
git clone https://gist.github.com/Twoody/12c3cd21c178c0025d41c3bbe3859b63 $td
mv $td/.vimrc ~/
rm -rf $td
else
printf "\t~/.vimrc already exists\n"
fi
if [ ! -f ~/.bash_profile ];
then
printf "\tWriting over ~/.bash_profile from gist.github.com/twoody/\n"
mkdir $td
git clone https://gist.github.com/4cff66d92ca89324cdfb5858540c4296.git $td
mv $td/.bash_profile ~/
rm -rf $td
printf "\tWrote over ~/.bash_profile from gist.github.com/twoody/\n"
else
printf "\t~/.bash_profile already exists\n"
fi
# Directory Setup + Precoa Dependencies
if [ ! -d ~/.attic/ ];
then
printf "\tMaking a ~/.attic/ directory for all things precoa\n"
mkdir ~/.attic/
else
printf "\t.attic already exists\n"
fi
if [ ! -d ~/workspace/ ];
then
printf "\tMaking a ~/workspace/ directory for all things precoa\n"
mkdir ~/workspace/
else
printf "\t~/workspace already exists\n"
fi
if [ ! -d $pp ];
then
printf "\tMaking a $_pp directory for all git controlled work you will do\n"
mkdir $pp
else
printf "\t$_pp already exists\n"
fi
if [ ! -d $pp/grandpapi ];
then
printf "\tCloning over PAPI\n"
git clone https://git.precoa.com/devs/grandpapi.git $pp/grandpapi
else
printf "\tPAPI already exists\n"
fi
if [ ! -d $pp/afp-pwa ];
then
printf "\tCloning over AFP app\n"
git clone https://git.precoa.com/devs/afp-pwa.git $pp/afp-pwa
else
printf "\tAFP-PWA (andoird app) already exists\n"
fi
if [ ! -d $pp/PrecoaPrototypeApp ];
then
printf "\tCloning over iOS Mobile App\n"
git clone https://git.precoa.com/tbrady/PrecoaPrototypeApp.git $pp/PrecoaPrototypeApp
else
printf "\t iOS mobile app already exists\n"
fi
if [ ! -d $pp/plannerapp ];
then
printf "\tCloning over Planner App\n"
git clone https://git.precoa.com/devs/plannerapp.git $pp/plannerapp
else
printf "\t planner app already exists\n"
fi
if [ ! -d $pd ];
then
printf "\tMaking a $_pd directory for all git controlled work you will do\n"
mkdir $pd
else
printf "\t$_pd already exists\n"
fi
if [ ! -d $ad ];
then
printf "\tarcanist not found; Cloning repo; Changing branch\n"
prevdir=$PWD
# IF CHANGING `$ad` CHANGE THIS TOO...
cd /usr/local/bin/
git clone https://github.com/phacility/arcanist.git
cd $ad
git checkout b4a3026
cd ..
#TODO: PRobably break this up :/
printf "\tALSO INSTALLING phabricator CLI...\n"
git clone https://github.com/phacility/libphutil.git
cd $ld
git checkout 813a26
export PATH="$PATH:$ad/bin/"
cd $prevdir
arc install-certificate
else
printf "\tarcanist dependency exists\n"
fi
# Executables Setup
if php -v > /dev/null 2>&1 ;
then
printf "\tphp exists\n"
else
printf "\tINSTALLING php\n"
brew install php
fi
if python3 --version > /dev/null 2>&1 ;
then
printf "\tpython3 exists\n"
else
printf "\tINSTALLING python3\n"
brew install python3
fi
if [ -d /Applications/Docker.app ];
then
printf "\tdocker APP exists\n"
else
printf "\tINSTALLING docker APP \n"
#Note that we are doing the app, which is docker officical vs. `brew install docker` (not official)
brew cask install docker
fi
if docker-compose -v > /dev/null 2>&1 ;
then
printf "\tdocker BIN exists\n"
else
printf "\tINSTALLING docker VIN\n"
#Note that we are doing the BINARIES, which is NOT docker officical
brew install docker
brew install docker-compose
fi
if npm -v > /dev/null 2>&1 ;
then
printf "\tnpm exists\n"
else
printf "\tINSTALLING npm\n"
brew install npm
fi
if vue -V > /dev/null 2>&1 ;
then
printf "\tvue exists\n"
else
printf "\tINSTALLING vue\n"
npm i -g vue-cli
fi
if ttab --version > /dev/null 2>&1 ;
then
printf "\tttab exists\n"
else
printf "\tINSTALLING ttab\n"
npm install -g ttab
fi
# Applications
if [ -d /Applications/Slack.app ];
then
printf "\tslack exists\n"
else
printf "\tINSTALLING slack\n"
brew cask install slack
printf "\tINSTALLED slack\n"
fi
if [ -d /Applications/zoom.us.app ];
then
printf "\tzoom exists\n"
else
printf "\tINSTALLING zoom\n"
brew cask install zoomus
printf "\tINSTALLED zoom\n"
fi
if [ -d /Applications/Spotify.app ];
then
printf "\tspotify exists\n"
else
printf "\tINSTALLING spotify\n"
brew cask install spotify
printf "\tINSTALLED spotify\n"
fi
if subl -v > /dev/null 2>&1 ;
then
printf "\tsublime exists\n"
else
printf "\tINSTALLING sublime\n"
brew cask install sublime-text
printf "\tINSTALLED sublime\n"
fi
if [ -d /Applications/Microsoft\ Outlook.app ];
then
printf "\toutlook exists\n"
else
printf "\tINSTALLING outlook\n"
brew cask install microsoft-office
printf "\tINSTALLED outlook and other microstuff \n"
fi
while true; do
read -p "Overwrite /etc/hosts/? (Y/N): " confirm
case $confirm in
[yY]*)
printf "\tOverwriting /etc/hosts:\n"
git clone https://gist.github.com/a97b644d6c497ddcb072d7a044b5bd26.git $td
# Preserve any other existing /etc/hosts/ files in .attic
sudo cp -n /etc/hosts ~/.attic/
sudo mv $td/hosts /etc/hosts
rm -rf $td
printf "\tOverwrote /etc/hosts\n"
break
;;
[nN]*)
printf "\tMaintaining original\n"
break
;;
*)
printf "\tBAD INPUT\n"
esac
done
printf "\nSUCCESSFUL INSTALL\n"
pprint
printf "\n"
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment