diff --git a/lib/sharedFunctions.sh b/lib/sharedFunctions.sh index b1c6957..1bbc5d3 100755 --- a/lib/sharedFunctions.sh +++ b/lib/sharedFunctions.sh @@ -84,9 +84,9 @@ function convertsecs() { # Credit: http://ryonsherman.blogspot.com/2012/10/shell-script-to-send-pushover.html # ------------------------------------------------------ function pushover() { - # Check for config file + # Check for config file containing API Keys if [ ! -f "../etc/pushover.cfg" ]; then - e_error "Please locate the pushover.cfg to send notifications to Pushover" + e_error "Please locate the pushover.cfg to send notifications to Pushover." else # Grab variables from the config file source "../etc/pushover.cfg" diff --git a/setupScripts/mackup.sh b/setupScripts/mackup.sh index a330b9b..b7da8ed 100755 --- a/setupScripts/mackup.sh +++ b/setupScripts/mackup.sh @@ -77,10 +77,10 @@ fi brew upgrade mackup >/dev/null 2>&1 e_arrow "Checking for Mackup config files..." -if [ ! -L ""$HOME"/.mackup" ]; then +if is_not_symlink ""$HOME"/.mackup"; then ln -s "$MACKUPDIR"/.mackup "$HOME"/.mackup fi -if [ ! -L ""$HOME"/.mackup.cfg" ]; then +if is_not_symlink ""$HOME"/.mackup.cfg"; then ln -s "$MACKUPDIR"/.mackup.cfg "$HOME"/.mackup.cfg fi e_success "Mackup config files linked." diff --git a/setupScripts/newMacSetup.sh b/setupScripts/newMacSetup.sh index d8b0711..c36d1d3 100755 --- a/setupScripts/newMacSetup.sh +++ b/setupScripts/newMacSetup.sh @@ -10,6 +10,7 @@ # # ################################################## +# Source global utilities if [ -f "../lib/utils.sh" ]; then source "../lib/utils.sh" else @@ -19,7 +20,7 @@ fi seek_confirmation "Do you want to run the Dropbox script to install it first?" if is_confirmed; then - if [ -e ./dropbox.sh ]; then + if is_file "./dropbox.sh"; then ./dropbox.sh else e_error "Can't find dropbox.sh" @@ -39,14 +40,13 @@ FILES=" ./mackup.sh ./osx.sh ./ssh.sh - ./ssd.sh " seek_confirmation "Do you want to run all the scripts at once?" if is_confirmed; then for file in $FILES do - if [ -e "$file" ]; then + if is_file "$file"; then $file else e_error "$file does not exist. Exiting" @@ -58,7 +58,7 @@ for file in $FILES do seek_confirmation "Do you want to run $file?" if is_confirmed; then - if [ -e "$file" ]; then + if is_file "$file"; then $file else e_error "$file does not exist." diff --git a/setupScripts/osx.sh b/setupScripts/osx.sh index 233bb1c..5ceff1c 100755 --- a/setupScripts/osx.sh +++ b/setupScripts/osx.sh @@ -32,7 +32,6 @@ fi seek_confirmation "Run General UI Tweaks?" if is_confirmed; then - e_success "Disabled Sound Effects on Boot" sudo nvram SystemAudioVolume=" " @@ -685,6 +684,24 @@ if is_confirmed; then fi +############################################################################### +# 14. SSD-specific tweaks # +############################################################################### +e_header "Running SSD Specific OSX Tweaks" + +seek_confirmation "Confirm that you have an SSD Hard Drive and want to " +if is_confirmed; then + + # e_success "Remove the sleep image file to save disk space" + # sudo rm /Private/var/vm/sleepimage + # e_success "Create a zero-byte file instead…" + # sudo touch /Private/var/vm/sleepimage + # e_success "…and make sure it can’t be rewritten" + # sudo chflags uchg /Private/var/vm/sleepimage + + e_success "Disable the sudden motion sensor as it’s not useful for SSDs" + sudo pmset -a sms 0 +fi ########################## DONE ############################# diff --git a/setupScripts/ruby.sh b/setupScripts/ruby.sh index 15c76c9..603a367 100755 --- a/setupScripts/ruby.sh +++ b/setupScripts/ruby.sh @@ -14,22 +14,24 @@ RUBYVERSION="2.1.2" # Check for RVM -if [[ ! "$(type -P rvm)" ]]; then +if type_not_exists "rvm"; then seek_confirmation_head "Install RVM?" if is_confirmed; then e_warning "Installing RVM (Ruby Version Manager) and Ruby which becomes the default ..." curl -L https://get.rvm.io | bash -s stable - source ~/.rvm/scripts/rvm + source "~/.rvm/scripts/rvm" fi fi #Install Ruby -if [[ "$(type -P rvm)" ]]; then - #e_warning "Checking for newer Ruby Version" - source $HOME/.bash_profile - #rvm get stable --autolibs=enable - rvm install $RUBYVERSION - rvm use $RUBYVERSION --default +if type_exists "rvm"; then + seek_confirmation "You have RVM already. Check for a newer version?" + if is_confirmed; then + source $HOME/.bash_profile + #rvm get stable --autolibs=enable + rvm install $RUBYVERSION + rvm use $RUBYVERSION --default + fi fi RECIPES=( diff --git a/setupScripts/ssd.sh b/setupScripts/ssd.sh deleted file mode 100755 index a7afd9d..0000000 --- a/setupScripts/ssd.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -# Inspired by ~/.osx — http://mths.be/osx - -if [ -f "../lib/utils.sh" ]; then - source "../lib/utils.sh" -else - echo "You must have utils.sh to run. Exiting." - exit -fi - -# Update existing sudo time stamp if set, otherwise do nothing. -while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & - - - -############################################################################### -# SSD-specific tweaks # -############################################################################### -e_header "Running SSD Specific OSX Tweaks" - -seek_confirmation "Confirm that you have an SSD Hard Drive" -if is_confirmed; then - - e_success "Disable local Time Machine snapshots" - sudo tmutil disablelocal - - e_success "Disable hibernation (speeds up entering sleep mode)" - sudo pmset -a hibernatemode 0 - - e_success "Remove the sleep image file to save disk space" - sudo rm /Private/var/vm/sleepimage - e_success "Create a zero-byte file instead…" - sudo touch /Private/var/vm/sleepimage - e_success "…and make sure it can’t be rewritten" - sudo chflags uchg /Private/var/vm/sleepimage - - e_success "Disable the sudden motion sensor as it’s not useful for SSDs" - sudo pmset -a sms 0 - - e_note "DON'T FORGET TO RESTART FOR CHANGES TO TAKE EFFECT" - e_header "Completed SSD Specific OSX Tweaks" -fi \ No newline at end of file