Merge pull request #193 from zackzachariah/master
Support for OS X .bash_profile + install logging
This commit is contained in:
29
install.sh
29
install.sh
@@ -10,11 +10,19 @@ fi
|
|||||||
# This loads SCM Breeze into the shell session.
|
# This loads SCM Breeze into the shell session.
|
||||||
exec_string="[ -s \"$HOME/.scm_breeze/scm_breeze.sh\" ] && source \"$HOME/.scm_breeze/scm_breeze.sh\""
|
exec_string="[ -s \"$HOME/.scm_breeze/scm_breeze.sh\" ] && source \"$HOME/.scm_breeze/scm_breeze.sh\""
|
||||||
|
|
||||||
# Add line to bashrc and zshrc if not already present.
|
# Add line to bashrc, zshrc, and bash_profile if not already present.
|
||||||
for rc in bashrc zshrc; do
|
added_to_profile=false
|
||||||
if [ -s "$HOME/.$rc" ] && ! grep -q "$exec_string" "$HOME/.$rc"; then
|
already_present=false
|
||||||
printf "\n$exec_string\n" >> "$HOME/.$rc"
|
for rc in bashrc zshrc bash_profile; do
|
||||||
printf "== Added SCM Breeze to '~/.$rc'\n"
|
if [ -s "$HOME/.$rc" ]; then
|
||||||
|
if grep -q "$exec_string" "$HOME/.$rc"; then
|
||||||
|
printf "== Already installed in '~/.$rc'\n"
|
||||||
|
already_present=true
|
||||||
|
else
|
||||||
|
printf "\n$exec_string\n" >> "$HOME/.$rc"
|
||||||
|
printf "== Added SCM Breeze to '~/.$rc'\n"
|
||||||
|
added_to_profile=true
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -23,5 +31,12 @@ source "$scmbDir/lib/scm_breeze.sh"
|
|||||||
# Create '~/.*.scmbrc' files from example files
|
# Create '~/.*.scmbrc' files from example files
|
||||||
_create_or_patch_scmbrc
|
_create_or_patch_scmbrc
|
||||||
|
|
||||||
|
if [ "$added_to_profile" = true ] || [ "$already_present" = true ]; then
|
||||||
echo "== Run 'source ~/.bashrc' or 'source ~/.zshrc' to load SCM Breeze into your current shell."
|
echo "== SCM Breeze Installed! Run 'source ~/.bashrc || source ~/.bash_profile' or 'source ~/.zshrc'"
|
||||||
|
echo " to load SCM Breeze into your current shell."
|
||||||
|
else
|
||||||
|
echo "== Error:"
|
||||||
|
echo " Found no profile to add SCM Breeze to."
|
||||||
|
echo " Add line to your shell profile and source it to install manually:"
|
||||||
|
printf " $exec_string\n"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user