mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-09 05:33:48 -05:00
minor updates
This commit is contained in:
@@ -84,9 +84,9 @@ function convertsecs() {
|
|||||||
# Credit: http://ryonsherman.blogspot.com/2012/10/shell-script-to-send-pushover.html
|
# Credit: http://ryonsherman.blogspot.com/2012/10/shell-script-to-send-pushover.html
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
function pushover() {
|
function pushover() {
|
||||||
# Check for config file
|
# Check for config file containing API Keys
|
||||||
if [ ! -f "../etc/pushover.cfg" ]; then
|
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
|
else
|
||||||
# Grab variables from the config file
|
# Grab variables from the config file
|
||||||
source "../etc/pushover.cfg"
|
source "../etc/pushover.cfg"
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ fi
|
|||||||
brew upgrade mackup >/dev/null 2>&1
|
brew upgrade mackup >/dev/null 2>&1
|
||||||
|
|
||||||
e_arrow "Checking for Mackup config files..."
|
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
|
ln -s "$MACKUPDIR"/.mackup "$HOME"/.mackup
|
||||||
fi
|
fi
|
||||||
if [ ! -L ""$HOME"/.mackup.cfg" ]; then
|
if is_not_symlink ""$HOME"/.mackup.cfg"; then
|
||||||
ln -s "$MACKUPDIR"/.mackup.cfg "$HOME"/.mackup.cfg
|
ln -s "$MACKUPDIR"/.mackup.cfg "$HOME"/.mackup.cfg
|
||||||
fi
|
fi
|
||||||
e_success "Mackup config files linked."
|
e_success "Mackup config files linked."
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#
|
#
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|
||||||
|
# Source global utilities
|
||||||
if [ -f "../lib/utils.sh" ]; then
|
if [ -f "../lib/utils.sh" ]; then
|
||||||
source "../lib/utils.sh"
|
source "../lib/utils.sh"
|
||||||
else
|
else
|
||||||
@@ -19,7 +20,7 @@ fi
|
|||||||
|
|
||||||
seek_confirmation "Do you want to run the Dropbox script to install it first?"
|
seek_confirmation "Do you want to run the Dropbox script to install it first?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
if [ -e ./dropbox.sh ]; then
|
if is_file "./dropbox.sh"; then
|
||||||
./dropbox.sh
|
./dropbox.sh
|
||||||
else
|
else
|
||||||
e_error "Can't find dropbox.sh"
|
e_error "Can't find dropbox.sh"
|
||||||
@@ -39,14 +40,13 @@ FILES="
|
|||||||
./mackup.sh
|
./mackup.sh
|
||||||
./osx.sh
|
./osx.sh
|
||||||
./ssh.sh
|
./ssh.sh
|
||||||
./ssd.sh
|
|
||||||
"
|
"
|
||||||
|
|
||||||
seek_confirmation "Do you want to run all the scripts at once?"
|
seek_confirmation "Do you want to run all the scripts at once?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
for file in $FILES
|
for file in $FILES
|
||||||
do
|
do
|
||||||
if [ -e "$file" ]; then
|
if is_file "$file"; then
|
||||||
$file
|
$file
|
||||||
else
|
else
|
||||||
e_error "$file does not exist. Exiting"
|
e_error "$file does not exist. Exiting"
|
||||||
@@ -58,7 +58,7 @@ for file in $FILES
|
|||||||
do
|
do
|
||||||
seek_confirmation "Do you want to run $file?"
|
seek_confirmation "Do you want to run $file?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
if [ -e "$file" ]; then
|
if is_file "$file"; then
|
||||||
$file
|
$file
|
||||||
else
|
else
|
||||||
e_error "$file does not exist."
|
e_error "$file does not exist."
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ fi
|
|||||||
seek_confirmation "Run General UI Tweaks?"
|
seek_confirmation "Run General UI Tweaks?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
|
|
||||||
|
|
||||||
e_success "Disabled Sound Effects on Boot"
|
e_success "Disabled Sound Effects on Boot"
|
||||||
sudo nvram SystemAudioVolume=" "
|
sudo nvram SystemAudioVolume=" "
|
||||||
|
|
||||||
@@ -685,6 +684,24 @@ if is_confirmed; then
|
|||||||
fi
|
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 #############################
|
########################## DONE #############################
|
||||||
|
|
||||||
|
|||||||
@@ -14,22 +14,24 @@ RUBYVERSION="2.1.2"
|
|||||||
|
|
||||||
|
|
||||||
# Check for RVM
|
# Check for RVM
|
||||||
if [[ ! "$(type -P rvm)" ]]; then
|
if type_not_exists "rvm"; then
|
||||||
seek_confirmation_head "Install RVM?"
|
seek_confirmation_head "Install RVM?"
|
||||||
if is_confirmed; then
|
if is_confirmed; then
|
||||||
e_warning "Installing RVM (Ruby Version Manager) and Ruby which becomes the default ..."
|
e_warning "Installing RVM (Ruby Version Manager) and Ruby which becomes the default ..."
|
||||||
curl -L https://get.rvm.io | bash -s stable
|
curl -L https://get.rvm.io | bash -s stable
|
||||||
source ~/.rvm/scripts/rvm
|
source "~/.rvm/scripts/rvm"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Install Ruby
|
#Install Ruby
|
||||||
if [[ "$(type -P rvm)" ]]; then
|
if type_exists "rvm"; then
|
||||||
#e_warning "Checking for newer Ruby Version"
|
seek_confirmation "You have RVM already. Check for a newer version?"
|
||||||
|
if is_confirmed; then
|
||||||
source $HOME/.bash_profile
|
source $HOME/.bash_profile
|
||||||
#rvm get stable --autolibs=enable
|
#rvm get stable --autolibs=enable
|
||||||
rvm install $RUBYVERSION
|
rvm install $RUBYVERSION
|
||||||
rvm use $RUBYVERSION --default
|
rvm use $RUBYVERSION --default
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RECIPES=(
|
RECIPES=(
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user