Easily 'enter' the installation process

* install.sh
- Added a Choice to add existing .bash_profile to bash-it version.
- Also it is possible to only 'enter' the installaion process.
- Improved yes/no query for funtion load_some()
pull/171/head
sebokopter 2012-11-18 13:48:58 +01:00
parent 4261f3d8ec
commit 1d533193c6
1 changed files with 31 additions and 23 deletions

View File

@ -1,32 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BASH_IT="$HOME/.bash_it" BASH_IT="$HOME/.bash_it"
cp $HOME/.bash_profile $HOME/.bash_profile.bak if [ -e $HOME/.bash_profile ]; then
cp $HOME/.bash_profile $HOME/.bash_profile.orig
echo "Your original .bash_profile has been backed up to .bash_profile.bak" echo "Your original .bash_profile has been backed up to .bash_profile.orig"
fi
cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile
echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it" echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it"
while true if [ -e $HOME/.bash_profile.orig ]; then
do while true
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP do
echo ""
case $RESP echo "Would you like to append your original .bash_profile (currently .bash_profile.orig) to the bash-it configuration?"
in echo "Be advised that therefore you maybe overwrite existing bash-it configurations"
[yY]) read -p "Append? [y/N]" RESP
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig case $RESP
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins" in
break [yY])
;; echo -e "# Load original .bash_profile\nsource $HOME/.bash_profile.orig" >> $HOME/.bash_profile
[nN]) echo "Appended .bash_profile.orig (your former .bash_profile) to .bash_profile (the current bash-it one)"
break break
;; ;;
*) "")
echo "Please enter Y or N" ;&
esac [nN])
done break
;;
*)
echo "Please enter Y or N"
esac
done
fi
function load_all() { function load_all() {
file_type=$1 file_type=$1
@ -54,8 +60,10 @@ function load_some() {
file_name=$(basename "$path") file_name=$(basename "$path")
while true while true
do do
read -p "Would you like to enable the ${file_name%%.*} $file_type? [Y/N] " RESP read -p "Would you like to enable the ${file_name%%.*} $file_type? [Y/n] " RESP
case $RESP in case $RESP in
"")
;&
[yY]) [yY])
ln -s "$path" "$BASH_IT/$file_type/enabled" ln -s "$path" "$BASH_IT/$file_type/enabled"
break break