-#!/bin/bash
+#RCRC!/bin/bash
####
WD=`pwd`
unset FLAG_BASHPROFILE
echo -n "Do you want to rewrite $HOME/.bash_prfile ? [Y|y or N|n] " ; read FLAG_BASHPROFILE
+unset FLAG_BASHRC
+echo -n "Do you want to rewrite $HOME/.bashrc ? [Y|y or N|n] " ; read FLAG_BASHRC
#### No Change
awk 'BEGIN {EOS="no"} {if($0=="## Eos_env Start") EOS="yes"; if(EOS!="yes") print $0;if($0=="## Eos_env End") EOS="no"; }' $HOME/.bash_profile > $HOME/.bash_profile.org
cat $HOME/.bash_profile.org > $HOME/.bash_profile
- cat >> $HOME/.bash_profile << EOF
+ if [ -f $EOS_HOME/env/template.bashrc ] ; then
+ cat $EOS_HOME/env/template.bashrc >> $HOME/.bash_profile
+ else
+ cat >> $HOME/.bash_profile << EOF
## Eos_env Start
##
##
## Eos_env End
EOF
+ fi
+ echo "Please check $HOME/.bash_profile."
+ ;;
+
+ *)
+ echo "Before you use Eos, "
+ echo 'source $EOS_HOME0/env/Eos_env'
+ echo " or "
+ echo "You should rewrite $HOME/.bash_profile by yourself to execute $EOS_HOME0/env/Eos_env."
+ ;;
+esac
+
+#
+# .bashrc
+#
+
+case $FLAG_BASHRC in
+ Y|y)
+ awk 'BEGIN {EOS="no"} {if($0=="## Eos_env Start") EOS="yes"; if(EOS!="yes") print $0;if($0=="## Eos_env End") EOS="no"; }' $HOME/.bashrc > $HOME/.bashrc.org
+
+ cat $HOME/.bashrc.org > $HOME/.bashrc
+ if [ -f $EOS_HOME/env/template.bashrc ] ; then
+ cat $EOS_HOME/env/template.bashrc >> $HOME/.bashrc
+ else
+ cat >> $HOME/.bashrc << EOF
+## Eos_env Start
+##
+
+if [ ! -z $EOS_HOME0 ] ; then
+ if [ -f $EOS_HOME0/env/Eos_env -a ! -f $HOME/.Eos_env ] ; then
+ ln -s $EOS_HOME0/env/Eos_env $HOME/.Eos_env
+ fi
+fi
+
+export EOS_HOME0=$EOS_HOME0
+export EOS_GITUSER0=$EOS_GITUSER0
+
+test -r $HOME/.Eos_env && . $HOME/.Eos_env
+
+##
+## Eos_env End
+EOF
+ fi
echo "Please check $HOME/.bash_profile."
;;
--- /dev/null
+## Eos_env Start
+##
+
+if [ ! -z $EOS_HOME0 ] ; then
+ if [ -f $EOS_HOME0/env/Eos_env -a ! -f $HOME/.Eos_env ] ; then
+ ln -s $EOS_HOME0/env/Eos_env $HOME/.Eos_env
+ fi
+fi
+
+export EOS_HOME0=$EOS_HOME0
+export EOS_GITUSER0=$EOS_GITUSER0
+
+test -r $HOME/.Eos_env && . $HOME/.Eos_env
+
+##
+## Eos_env End
echo " or "
echo -n "Set EOS_HOME0 [$EOS_HOME] :"
read EOS_HOME0
+ if [ -z $EOS_HOME0 ] ; then
+ export EOS_HOME0=$EOS_HOME
+ fi
fi
if [ -z $EOS_GITUSER0 ] ; then
esac
unset FLAG_BASHPROFILE
-echo -n "Do you want to modify .bash_profile automatically ? [ Y|y or N|n ] : "
-read FLAG_BASHPROFILE
+echo -n "Do you want to modify .bash_profile automatically ? [ Y|y or N|n ] : "; read FLAG_BASHPROFILE
+unset FLAG_BASHRC
+echo -n "Do you want to modify .bashrc automatically ? [ Y|y or N|n ] : "; read FLAG_BASHRC
#
# Start updating
Y|y)
awk 'BEGIN {EOS="no"} {if($0=="## Eos_env Start") EOS="yes"; if(EOS!="yes") print $0;if($0=="## Eos_env End") EOS="no"; }' $HOME/.bash_profile > $HOME/.bash_profile.org
cat $HOME/.bash_profile.org > $HOME/.bash_profile
- cat >> $HOME/.bash_profile << EOF
+ if [ -f $EOS_HOME/env/template.bashrc ] ; then
+ cat $EOS_HOME/env/template.bashrc >> $HOME/.bash_profile
+ else
+ cat >> $HOME/.bash_profile << EOF
+
+## Eos_env Start
+##
+
+if [ ! -z $EOS_HOME0 ] ; then
+ if [ -f $EOS_HOME0/env/Eos_env -a ! -f $HOME/.Eos_env ] ; then
+ ln -s $EOS_HOME0/env/Eos_env $HOME/.Eos_env
+ fi
+fi
+
+export EOS_HOME0=$EOS_HOME0
+export EOS_GITUSER0=$EOS_GITUSER0
+
+test -r $HOME/.Eos_env && . $HOME/.Eos_env
+
+##
+## Eos_env End
+EOF
+ fi
+ ;;
+ *)
+ echo "Please set your preferable environment as you like."
+ echo "Or"
+ echo "$ source $EOS_HOME/env/Eos_env"
+ ;;
+esac
+
+
+#
+#
+
+case $FLAG_BASHRC in
+ Y|y)
+ awk 'BEGIN {EOS="no"} {if($0=="## Eos_env Start") EOS="yes"; if(EOS!="yes") print $0;if($0=="## Eos_env End") EOS="no"; }' $HOME/.bashrc > $HOME/.bashrc.org
+ cat $HOME/.bashrc.org > $HOME/.bashrc
+ if [ -f $EOS_HOME/env/template.bashrc ] ; then
+ cat $EOS_HOME/env/template.bashrc >> $HOME/.bashrc
+ else
+ cat >> $HOME/.bashrc << EOF
## Eos_env Start
##
##
## Eos_env End
EOF
+ fi
;;
*)
echo "Please set your preferable environment as you like."