OSDN Git Service

update-eos.sh: changed v2.3.29p0214
authorTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Wed, 18 Nov 2015 12:36:12 +0000 (21:36 +0900)
committerTakuo Yasunaga <yasunaga@bio.kyutech.ac.jp>
Wed, 18 Nov 2015 12:36:12 +0000 (21:36 +0900)
modified:   env/update-eos.sh
modified: Display2
modified:   src/Tools/Integration/Display2/src/wish/Display2Init.wish

env/update-eos.sh
src/Tools/Integration/Display2/src/wish/Display2Init.wish

index 4032b71..55bcc7f 100755 (executable)
@@ -1,21 +1,55 @@
-#!/bin/sh
+#!/bin/bash
 WD=`pwd`
 
+for arg in $@; do
+       case "$arg" in
+       -h)
+                       echo "$0 [ EOS_HOME0 [ EOS_GITUSER0 ] ]";
+               echo "    EOS_HOME0    : directory name to be installed.";
+                       echo "    EOS_GITUSER0 : OSDN account.";
+                       exit 1;
+                       ;;
+               -*) echo "unsupported option $arg"; exit 1;;
+       esac
+done
+
+case $# in
+       0)
+               ;;
+       1)
+               EOS_HOME0=$1
+               ;;
+       2)
+               EOS_HOME0=$1
+               EOS_GITUSER0=$2
+               ;;
+       *)
+esac
+
 if [ -z $EOS_HOME0 ] ; then
        echo "Please set an environment for Eos."
        echo " $ export EOS_HOME0=InstalledDirOfEos"
-       exit 1
+       echo "      or   "
+       echo -n "Set EOS_HOME0 [$EOS_HOME] :" 
+       read EOS_HOME0
+fi
+
+if [ -z $EOS_GITUSER0 ] ; then
+       echo -n "If you want to set a gitacount on OSDN, Set EOS_GITUSER0 or just return:"
+       read EOS_GITUSER0
 fi
 
 echo "EOS_HOME0:    $EOS_HOME0"
 if [ -z $EOS_GITUSER0 ] ; then
-echo "EOS_GITUSER0: NoGitAccount"
+       echo "EOS_GITUSER0: NoGitAccount"
 else
-echo "EOS_GITUSER0: $EOS_GITUSER0"
-fi
+       echo "EOS_GITUSER0: $EOS_GITUSER0"
+fi     
 
 unset ANS
-echo "Is is OK ? [Y|y or N|n]"; read ANS
+echo -n "Is is OK ? [Y|y or N|n]"
+read ANS
+
 case $ANS in
        Y|y)
                ;;      
@@ -28,31 +62,13 @@ case $ANS in
                ;;
 esac
 
+unset FLAG_BASHPROFILE 
+echo -n "Do you want to modify .bash_profile automatically ? [Y|y or N|n]"
+read FLAG_BASHPROFILE 
+
 #
-# profile update
+# Start updating
 #
-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 
-## 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_HOME=$EOS_HOME0
-export EOS_GITUSER0=$EOS_GITUSER0
-
-test -r $HOME/.Eos_env  && . $HOME/.Eos_env
-
-##
-## Eos_env End 
-EOF
-
 
 EOS_HOME=$EOS_HOME0
 EOS_GITUSER=$EOS_GITUSER0
@@ -64,25 +80,26 @@ ROOT_EOS_OSDN_HTTPS=https://scm.osdn.jp/gitroot/eos/base.git
 
 if [ ! -d $EOS_HOME/.git ] ; then
        echo "Not installed"
-       echo "Use install-eos.sh for updating or make concern env of EOS_HOME. Current var is $EOS_HOME."
+       echo "Use install-eos.sh for updating or make concern env of EOS_HOME or EOS_HOME0. Current vars are $EOS_HOME and $EOS_HOME0."
 else
        if [ -z $EOS_GITUSER ] ; then
+               cd $EOS_HOME; echo "No EOS_GITUSER."; 
+               git pull $ROOT_EOS_OSDN_GIT  || \
+               git pull $ROOT_EOS_OSDN_HTTP || \
+               echo "A port for git (9418) or HTTP is not open, or something wrong."
                INSTALL_FLAG=
        else
                cd $EOS_HOME; echo "$EOS_GITUSER as EOS_GITUSER";  
                git pull $ROOT_EOS_OSDN_SSH || \
                git pull --depth 1 $ROOT_EOS_OSDN_HTTPS || \
                        echo "A port for SSH or HTTPS is not open, or something wrong for $EOS_GITUSER."
-                       INSTALL_FLAG=INSTALL
-       fi
-       if [ -z $NOT_INSTALL ] ; then
-               cd $EOS_HOME; echo "No EOS_GITUSER."; 
-               git pull $ROOT_EOS_OSDN_GIT  || \
-               git pull $ROOT_EOS_OSDN_HTTP || \
-               echo "A port for git (9418) or HTTP is not open, or something wrong."
+               INSTALL_FLAG=INSTALL
        fi
 fi
 
+
+test -r $EOS_HOME/env/Eos_env  && source $EOS_HOME/env/Eos_env || echo "Not found $EOS_HOME/env/Eos_env"
+
 if [ -z ${EOS_HOSTDIR} ] ; then
        echo "Set EOS_HOSTDIR. Current is $EOS_HOSTDIR";
        exit;
@@ -96,28 +113,62 @@ HOSTDEPEND_EOS_OSDN_SSH=${EOS_GITUSER}@git.osdn.jp:/gitroot/eos/hostdepend${EOS_
 HOSTDEPEND_EOS_OSDN_HTTPS=https://scm.osdn.jp/gitroot/eos/hostdepend${EOS_HOSTDIR}.git
 
 if [ -d $EOS_HOME/hostdepend ] ; then
-    cd $EOS_HOME/hostdepend/ 
+    cd $EOS_HOME/hostdepend/ 
     if [ ! -d ${EOS_HOSTDIR}/.git ] ; then
         echo "Not installed hostdepend/${EOS_HOSTDIR}"; 
         echo "Use install-eos.sh for updating or set a new directory for update"
     else 
+               cd ${EOS_HOSTDIR}
         if [ -z $EOS_GITUSER ] ; then
+            git pull ${HOSTDEPEND_EOS_OSDN_GIT}  || \
+            git pull ${HOSTDEPEND_EOS_OSDN_HTTP} || \
+            echo "A port for git (9418) or HTTP is not open, or something wrong."
             INSTALL_FLAG=
         else 
-                       cd ${EOS_HOSTDIR}
             git pull ${HOSTDEPEND_EOS_OSDN_SSH}   || \
             git pull ${HOSTDEPEND_EOS_OSDN_HTTPS} || \
             echo "A port for SSH or HTTPS is not open, or something wrong."
             INSTALL_FLAG=INSTALL
         fi  
-        if [ -z $NOT_INSTALL ] ; then
-            git pull ${HOSTDEPEND_EOS_OSDN_GIT}  || \
-            git pull ${HOSTDEPEND_EOS_OSDN_HTTP} || \
-            echo "A port for git (9418) or HTTP is not open, or something wrong."
-        fi  
     fi  
 else
     echo "No hostdepend dir"
 fi
 
 cd $WD
+
+#
+# automatic profile update
+#
+case $FLAG_BASHPROFILE 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/.bash_profile > $HOME/.bash_profile.org
+               cat $HOME/.bash_profile.org > $HOME/.bash_profile
+               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
+               ;;
+       *)
+               echo "Please set your preferable environment as you like."
+               echo "Or"
+               echo "$ source $EOS_HOME/env/Eos_env"
+               ;;
+esac
+
+
+cd $WD
index a1517be..837f7fe 100755 (executable)
@@ -237,9 +237,9 @@ proc display2InitVarSet  { filename } {
        #puts "display2InitVarSet Start"
 
        if [ file isdirectory "~/.Eos/" ] {
-               puts "Already dir"      
+               puts "Already dir ~/.Eos/"      
        } else {
-               #puts "mkdir"
+               puts "~/.Eos/ is created."
                file mkdir "~/.Eos"
        }
 
@@ -378,16 +378,20 @@ proc display2Init {} {
        
        global defaultFile
 
+       # Initial Variables
        display2InitVar 
 
+       # Load variables from defaultFile
        if [ info exists defaultFile ] {
-               puts "Already Exist $defaultFile"
+               #puts "Already Exist a variable, defaultFile"
        } else {
                set defaultFile "~/.Eos/Display2"
        }
        if [ file exists $defaultFile ] {
                #
+               #puts "Load parameters from $defaultFile"       
        } else {
+               # Create initial ~/.Eos/Display2 
                display2InitVarSet $defaultFile
        }
        source $defaultFile