@@ -2,9 +2,11 @@ |
||
| 2 | 2 |
|
| 3 | 3 |
# Functions ============================================== |
| 4 | 4 |
|
| 5 |
+DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
|
| 6 |
+LOG=$DIR/log.txt |
|
| 5 | 7 |
function app_is_installed {
|
| 6 | 8 |
local file1="/Applications/$1/" |
| 7 |
- local file2="/opt/homebrew-cask/Caskroom/atom/latest/$1/" |
|
| 9 |
+ local file2="/opt/homebrew-cask/Caskroom/$2/latest/$1/" |
|
| 8 | 10 |
if [ -d "$file1" ] || [ -d "$file2" ] |
| 9 | 11 |
then |
| 10 | 12 |
local return_=1 |
@@ -77,20 +79,74 @@ function install_app {
|
||
| 77 | 79 |
tput ed |
| 78 | 80 |
app_name_tabs "$1" |
| 79 | 81 |
echo "$1$tabs$(echo_if $(app_is_installed "$2")) " |
| 80 |
- if [ $(app_is_installed "$2") == 0 ]; then |
|
| 82 |
+ if [ $(app_is_installed "$1") == 0 ] && [ $(app_is_installed "$2") == 0 ]; then |
|
| 81 | 83 |
sleep 0.1 |
| 82 |
- tput rc |
|
| 84 |
+ tput cuu 1 |
|
| 83 | 85 |
tput ed |
| 84 |
- echo "$1$tabs$(echo_if $(app_is_installed "$2")) Installing... " |
|
| 85 | 86 |
sleep 0.2 |
| 86 |
- tput rc |
|
| 87 |
+ if [[ "$2" == *".app" ]] || [[ "$2" == *".pkg" ]]; then |
|
| 88 |
+ echo "$1$tabs$(echo_if $(app_is_installed "$1")) Cannot Install" |
|
| 89 |
+ sleep 0.1 |
|
| 90 |
+ tput ed |
|
| 91 |
+ else |
|
| 92 |
+ echo "$1$tabs$(echo_if $(app_is_installed "$1")) Installing... " |
|
| 93 |
+ echo "Installing $1" >> "$LOG" |
|
| 94 |
+ brew cask install "$2" >> "$LOG" |
|
| 95 |
+ echo "\n" >> "$LOG" |
|
| 96 |
+ tput cuu 1 |
|
| 97 |
+ tput ed |
|
| 98 |
+ if [ $(app_is_installed "$1") == 0 ] && [ $(app_is_installed "$2") == 0 ]; then |
|
| 99 |
+ echo "$1$tabs$(echo_if $(app_is_installed "$1")) Error " |
|
| 100 |
+ else |
|
| 101 |
+ echo "$1$tabs$(echo_if $(app_is_installed "$2")) Installed " |
|
| 102 |
+ fi |
|
| 103 |
+ sleep 0.1 |
|
| 104 |
+ tput ed |
|
| 105 |
+ fi |
|
| 106 |
+ fi |
|
| 107 |
+} |
|
| 108 |
+ |
|
| 109 |
+function install_program {
|
|
| 110 |
+ tput sc |
|
| 111 |
+ tput rc |
|
| 112 |
+ tput ed |
|
| 113 |
+ app_name_tabs "$1" |
|
| 114 |
+ echo "$1$tabs$(echo_if $(program_is_installed "$1")) " |
|
| 115 |
+ if [ $(program_is_installed "$1") == 0 ]; then |
|
| 116 |
+ sleep 0.1 |
|
| 117 |
+ tput cuu 1 |
|
| 118 |
+ tput ed |
|
| 119 |
+ echo "$1$tabs$(echo_if $(program_is_installed "$1")) Installing... " |
|
| 120 |
+ sleep 0.2 |
|
| 121 |
+ tput cuu 1 |
|
| 87 | 122 |
tput ed |
| 88 |
- echo "$1$tabs$(echo_if $(app_is_installed "$2")) " |
|
| 123 |
+ echo "$1$tabs$(echo_if $(program_is_installed "$1")) " |
|
| 89 | 124 |
sleep 0.1 |
| 90 |
- tput sc |
|
| 125 |
+ tput ed |
|
| 91 | 126 |
fi |
| 92 | 127 |
} |
| 93 | 128 |
|
| 129 |
+function install_npm_package {
|
|
| 130 |
+ tput sc |
|
| 131 |
+ tput rc |
|
| 132 |
+ tput ed |
|
| 133 |
+ app_name_tabs "$1" |
|
| 134 |
+ echo "$1$tabs$(echo_if $(npm_package_is_installed "$1")) " |
|
| 135 |
+ if [ $(npm_package_is_installed "$1") == 0 ]; then |
|
| 136 |
+ sleep 0.1 |
|
| 137 |
+ tput cuu 1 |
|
| 138 |
+ tput ed |
|
| 139 |
+ echo "$1$tabs$(echo_if $(npm_package_is_installed "$1")) Installing... " |
|
| 140 |
+ sleep 0.2 |
|
| 141 |
+ tput cuu 1 |
|
| 142 |
+ tput ed |
|
| 143 |
+ echo "$1$tabs$(echo_if $(npm_package_is_installed "$1")) " |
|
| 144 |
+ sleep 0.1 |
|
| 145 |
+ tput ed |
|
| 146 |
+ fi |
|
| 147 |
+} |
|
| 148 |
+ |
|
| 149 |
+ |
|
| 94 | 150 |
function app_name_tabs {
|
| 95 | 151 |
name="$1" |
| 96 | 152 |
size="${#name}"
|
@@ -3,21 +3,17 @@ tput rc |
||
| 3 | 3 |
tput ed |
| 4 | 4 |
echo "waiting 3" |
| 5 | 5 |
sleep 1 |
| 6 |
-tput rc |
|
| 6 |
+tput cuu 1 |
|
| 7 | 7 |
tput ed |
| 8 | 8 |
echo "waiting 2" |
| 9 | 9 |
sleep 1 |
| 10 |
-tput rc |
|
| 10 |
+tput cuu 1 |
|
| 11 | 11 |
tput ed |
| 12 | 12 |
echo "waiting 1" |
| 13 | 13 |
sleep 1 |
| 14 |
-tput rc |
|
| 15 |
-tput ed |
|
| 16 |
-echo "waiting 0" |
|
| 17 |
-sleep 1 |
|
| 18 |
-tput rc |
|
| 14 |
+tput cuu 1 |
|
| 19 | 15 |
tput ed |
| 20 |
-echo "Done " |
|
| 16 |
+echo "Done " |
|
| 21 | 17 |
|
| 22 | 18 |
tput sc |
| 23 | 19 |
printf "\n\n" |
@@ -6,27 +6,6 @@ printf "by James Peret - http://jamesperet.com\n\n" |
||
| 6 | 6 |
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
| 7 | 7 |
source $DIR/core.sh |
| 8 | 8 |
|
| 9 |
-install_command_line_tools |
|
| 10 |
-install_mac_osx_updates |
|
| 11 |
- |
|
| 12 |
- |
|
| 13 |
-# command line programs |
|
| 14 |
- |
|
| 15 |
-# Atom |
|
| 16 |
-tput civis -- invisible |
|
| 17 |
-install_app atom Atom.app |
|
| 18 |
-install_app craxxxp Crap.app |
|
| 19 |
- |
|
| 20 |
-echo "node$(echo_if $(program_is_installed node))" |
|
| 21 |
-echo "grunt$(echo_if $(program_is_installed grunt))" |
|
| 22 |
-echo "testacular$(echo_if $(program_is_installed testacular))" |
|
| 23 |
-echo "uglifyjs$(echo_if $(program_is_installed uglifyjs))" |
|
| 24 |
-echo "requirejs$(echo_if $(program_is_installed r.js))" |
|
| 25 |
- |
|
| 26 |
-# local npm packages |
|
| 27 |
-echo "grunt\t\t\t\t$(echo_if $(npm_package_is_installed grunt))" |
|
| 28 |
-echo "serve\t\t\t\t$(echo_if $(npm_package_is_installed serve))" |
|
| 29 |
- |
|
| 30 | 9 |
function install_command_line_tools {
|
| 31 | 10 |
echo "- Intalling command line tools" |
| 32 | 11 |
xcode-select --install |
@@ -38,3 +17,97 @@ function install_mac_osx_updates {
|
||
| 38 | 17 |
sudo softwareupdate -i -a |
| 39 | 18 |
sw_vers |grep ProductVersion |
| 40 | 19 |
} |
| 20 |
+ |
|
| 21 |
+function install_git {
|
|
| 22 |
+ echo "- Installing git" |
|
| 23 |
+ sudo port install git-core +svn +doc +bash_completion +gitweb |
|
| 24 |
+} |
|
| 25 |
+ |
|
| 26 |
+function install_homebrew {
|
|
| 27 |
+ echo "- Installing homebrew" |
|
| 28 |
+ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" |
|
| 29 |
+} |
|
| 30 |
+ |
|
| 31 |
+function install_cask {
|
|
| 32 |
+ echo "- Installing brew cask" |
|
| 33 |
+ brew tap phinze/cask |
|
| 34 |
+ brew install brew-cask |
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+function install_rvm {
|
|
| 38 |
+ echo "- Installing RVM - Ruby Version Manager" |
|
| 39 |
+ \curl -L https://get.rvm.io | bash -s stable |
|
| 40 |
+} |
|
| 41 |
+ |
|
| 42 |
+function install_node {
|
|
| 43 |
+ echo "- Installing node.js" |
|
| 44 |
+ brew cask install --caskroom="/opt/homebrew-cask/Caskroom" node |
|
| 45 |
+} |
|
| 46 |
+ |
|
| 47 |
+function install_nvm {
|
|
| 48 |
+ echo "Installing NVM - Node Version Manager" |
|
| 49 |
+ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash |
|
| 50 |
+} |
|
| 51 |
+ |
|
| 52 |
+function install_zShell {
|
|
| 53 |
+ echo "- Installing zShell with dotfiles" |
|
| 54 |
+ |
|
| 55 |
+} |
|
| 56 |
+ |
|
| 57 |
+ |
|
| 58 |
+function install_youtube_dl {
|
|
| 59 |
+ echo "- Installing youtube-dl" |
|
| 60 |
+ sudo curl https://yt-dl.org/downloads/2013.09.24.2/youtube-dl -o /usr/local/bin/youtube-dl |
|
| 61 |
+ sudo chmod a+x /usr/local/bin/youtube-dl |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+ |
|
| 65 |
+function install_ImageMagik {
|
|
| 66 |
+ echo "- Installing ImageMagik" |
|
| 67 |
+ brew install pkgconfig |
|
| 68 |
+ brew install imagemagick |
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+function install_tmux {
|
|
| 72 |
+ echo "- Installing tmux" |
|
| 73 |
+ brew install tmux |
|
| 74 |
+} |
|
| 75 |
+ |
|
| 76 |
+function install_teamocil {
|
|
| 77 |
+ echo "- Installing teamocil" |
|
| 78 |
+ gem install teamocil |
|
| 79 |
+ mkdir $HOME/.teamocil |
|
| 80 |
+ cp teamocil/avalanche.yml $HOME/.teamocil/avalanche.yml |
|
| 81 |
+} |
|
| 82 |
+ |
|
| 83 |
+echo "Installing brew cask apps" |
|
| 84 |
+brewCaskApps=(atom dropbox google-chrome firefox iterm2 evernote rescuetime transmit dash postgres mou monodraw sketch-toolbox unity unity-web-player bfxr sonic-pi xact slack skype vlc transmission sitesucker the-unarchiver appcleaner hyperswitch) |
|
| 85 |
+ |
|
| 86 |
+brew cask install ${brewCaskApps[@]}
|
|
| 87 |
+ |
|
| 88 |
+ |
|
| 89 |
+# Run Functions |
|
| 90 |
+install_command_line_tools |
|
| 91 |
+install_mac_osx_updates |
|
| 92 |
+install_git |
|
| 93 |
+install_homebrew |
|
| 94 |
+install_cask |
|
| 95 |
+install_rvm |
|
| 96 |
+install_node |
|
| 97 |
+install_nvm |
|
| 98 |
+ |
|
| 99 |
+install_youtube_dl |
|
| 100 |
+install_ImageMagik |
|
| 101 |
+install_tmux |
|
| 102 |
+install_teamocil |
|
| 103 |
+ |
|
| 104 |
+tput civis -- invisible |
|
| 105 |
+install_app atom Atom.app |
|
| 106 |
+install_app craxxxp Crap.app |
|
| 107 |
+install_program "node" |
|
| 108 |
+install_npm_package "grunt" |
|
| 109 |
+install_npm_package "serve" |
|
| 110 |
+install_npm_package "testacular" |
|
| 111 |
+install_npm_package "uglifyjs" |
|
| 112 |
+install_npm_package "requirejs" |
|
| 113 |
+tput cnorm |
@@ -6,7 +6,6 @@ sudo chown -R $(whoami) /usr/local/lib/node_modules/ |
||
| 6 | 6 |
npm install -g grunt-cli |
| 7 | 7 |
npm install -g serve |
| 8 | 8 |
|
| 9 |
- |
|
| 10 | 9 |
# Ruby configured |
| 11 | 10 |
brew install redis |
| 12 | 11 |
brew install pgcli |
@@ -0,0 +1,27 @@ |
||
| 1 |
+# Mac Automation Scripts |
|
| 2 |
+ |
|
| 3 |
+*by [James Peret](http://jamesperet.com)* |
|
| 4 |
+ |
|
| 5 |
+Scripts for migrating and installing software on a fresh OSX install. |
|
| 6 |
+ |
|
| 7 |
+### Scripts |
|
| 8 |
+ |
|
| 9 |
+On a fresh install, run the scripts in this order: |
|
| 10 |
+ |
|
| 11 |
+1. ``install.sh`` - Upgrades the system and installs dependecies like xCode command line tools and git. |
|
| 12 |
+2. ``configs.sh`` - Configures several Mac OS X settings like the dock, timezone and wallpaper. |
|
| 13 |
+3. ``node-config.sh`` - Installs and configures node with NVM and installs a list of packages thru NPM. |
|
| 14 |
+4. ``atom-installer.sh`` - Install the Atom IDE, installs a plugin list and sets up several configuration files. |
|
| 15 |
+5. ``scripts.sh`` - Reads a list of apps and checks if each one is installed. If the app is not installed, it trys to install it using Cask, Homebrew or NPM. |
|
| 16 |
+ |
|
| 17 |
+To run one of the scripts: |
|
| 18 |
+ |
|
| 19 |
+```bash |
|
| 20 |
+sh install.sh |
|
| 21 |
+``` |
|
| 22 |
+ |
|
| 23 |
+### Dependecies |
|
| 24 |
+ |
|
| 25 |
+Install all dependecies before runing these scripts! |
|
| 26 |
+ |
|
| 27 |
+- xCode |
@@ -68,16 +68,19 @@ install_app "xAct" "xAct.app" |
||
| 68 | 68 |
|
| 69 | 69 |
# Game Design/ 3D |
| 70 | 70 |
install_app "Cinema 4D" "Cinema 4D.app" |
| 71 |
-install_app "Unity 3D" "Unity/Unity 3D.app" |
|
| 71 |
+install_app "Unity 3D" "Unity/Unity.app" |
|
| 72 |
+install_app "Unity Web Player" "unity-web-player" "unity-web-player" |
|
| 72 | 73 |
install_app "Substance Designer" "Substance Designer.app" |
| 73 | 74 |
install_app "Z-Brush" "zBrush.app" |
| 74 | 75 |
install_app "Hexels" "Hexels.app" |
| 76 |
+install_app "Twine" "Twine.app" |
|
| 75 | 77 |
|
| 76 | 78 |
# Utilities |
| 77 | 79 |
install_app "1Password" "1Password.app" |
| 78 | 80 |
install_app "Alfred 2" "Alfred 2.app" |
| 79 | 81 |
install_app "AppCleaner" "AppCleaner.app" |
| 80 | 82 |
install_app "Dropbox" "Dropbox.app" |
| 83 |
+install_app "Nylas N1" "Nylas N1.app" |
|
| 81 | 84 |
install_app "HyperSwitch" "HyperSwitch.app" |
| 82 | 85 |
install_app "iScrobbler" "iScrobbler.app" |
| 83 | 86 |
install_app "iStat Menus" "iStat Menus.app" |
@@ -93,6 +96,6 @@ install_app "Network Radar" "Network Radar.app" |
||
| 93 | 96 |
install_app "OmniPlan" "OmniPlan.app" |
| 94 | 97 |
install_app "SiteSucker" "SiteSucker.app" |
| 95 | 98 |
install_app "OmniFocus" "OmniFocus.app" |
| 96 |
-install_app "Popcorn-Time" "Popcorn-Time.app" |
|
| 97 |
-install_app "RescueTime" "RescueTime.app" |
|
| 99 |
+install_app "PopcornTime" "PopcornTime.app" |
|
| 100 |
+install_app "RescueTime" "RescueTime.app" "rescuetime" |
|
| 98 | 101 |
install_app "SleepDisplay" "SleepDisplay.app" |