OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/eos/base
[eos/base.git] / env / install-eos.sh
1 #!/bin/bash
2 #### 
3 WD=`pwd`
4
5
6 if [ -z $EOS_HOME0 ] ; then
7         EOS_HOME0=$HOME/Eos
8 fi
9
10 echo "Set the directroy to be installed [$EOS_HOME0]: "; read ANS
11 if [ ! -z $ANS ] ; then 
12         EOS_HOME0=$ANS;
13 else 
14         EOS_HOME0=$HOME/Eos; 
15 fi
16 unset ANS
17 echo "Directory: $EOS_HOME0";
18
19 #### No Change
20 #ROOT_EOS_SOURCEFORGE=https://sourceforge.jp/projects/eos/scm/git/base/blobs/master/
21 ROOT_EOS_OSDN_GIT=git://git.osdn.jp/gitroot/eos/base.git
22 ROOT_EOS_OSDN_HTTP=http://scm.osdn.jp/gitroot/eos/base.git
23 ROOT_EOS_OSDN_SSH=${EOS_GITUSER}@git.osdn.jp:/gitroot/eos/base.git
24 ROOT_EOS_OSDN_HTTPS=https://scm.osdn.jp/gitroot/eos/base.git
25
26 if [ ! -d $EOS_HOME0 ] ; then
27         mkdir $EOS_HOME0
28 fi
29
30 #curl -L $ROOT_EOS_SOURCEFORGE/env/Eos_env?export=raw | sh - ; 
31
32 if [ -d $EOS_HOME0/.git ] ; then
33         echo "Already installed"
34         echo "Use update-eos.sh for updating or set a new directory for installation"
35 else
36         if [ -z $EOS_GITUSER ] ; then
37                 INSTALL_FLAG=
38         else 
39                 git clone --depth 1 $ROOT_EOS_OSDN_SSH $EOS_HOME0 || \
40                 git clone --depth 1 $ROOT_EOS_OSDN_HTTPS $EOS_HOME0 || \
41                 echo "A port for SSH or HTTPS is not open, or something wrong for $EOS_GITUSER."
42                 INSTALL_FLAG=INSTALL
43         fi
44         if [ -z $INSTALL_FLAG ] ; then
45                 git clone --depth 1 $ROOT_EOS_OSDN_GIT  $EOS_HOME0 || \
46                 git clone --depth 1 $ROOT_EOS_OSDN_HTTP $EOS_HOME0 || \
47                 echo "A port for git (9418) or HTTP is not open, or something wrong."
48         fi
49 fi
50
51
52 if [ -z $EOS_HOME0 ] ; then
53         export EOS_HOME0=$HOME/Eos
54 fi
55 cat >> $HOME/.bashrc << EOF
56
57 ##
58 ## Eos_env
59 ##
60
61 if [ ! -z $EOS_HOME0 ] ; then 
62 if [ -f $EOS_HOME0/env/Eos_env -a ! -f $HOME/.Eos_env ] ; then
63         ln -s $EOS_HOME0/env/Eos_env $HOME/.Eos_env
64 fi
65 fi
66
67 test -r $HOME/.Eos_env  && . $HOME/.Eos_env
68
69 EOF
70
71 #
72 # hostdepend
73 #
74
75 if [ ! -f $HOME/.Eos_env ] ; then
76         echo "No .Eos_env"
77         ln -sf $EOS_HOME0/env/Eos_env $HOME/.Eos_env 
78 fi
79
80 source ~/.Eos_env || echo "Prepare environment"
81 echo "hostdepend for ${EOS_HOSTDIR}"
82
83 HOSTDEPEND_EOS_OSDN_GIT=git://git.osdn.jp/gitroot/eos/hostdepend${EOS_HOSTDIR}.git
84 HOSTDEPEND_EOS_OSDN_HTTP=http://scm.osdn.jp/gitroot/eos/hostdepend${EOS_HOSTDIR}.git
85 HOSTDEPEND_EOS_OSDN_SSH=${EOS_GITUSER}@git.osdn.jp:/gitroot/eos/hostdepend${EOS_HOSTDIR}.git
86 HOSTDEPEND_EOS_OSDN_HTTPS=https://scm.osdn.jp/gitroot/eos/hostdepend${EOS_HOSTDIR}.git
87
88 if [ ! -d $EOS_HOME0/hostdepend ] ; then
89         mkdir $EOS_HOME0/hostdepend     
90 fi      
91
92 if [ -d $EOS_HOME0/hostdepend ] ; then
93         cd $EOS_HOME0/hostdepend/;  
94         if [ -d ${EOS_HOSTDIR}/.git ] ; then
95                 echo "Already installed hostdepend/${EOS_HOSTDIR}"; 
96                 echo "Use update-eos.sh for updating or set a new directory for installation"
97         else 
98                 if [ -z $EOS_GITUSER ] ; then
99                         INSTALL_FLAG=
100                 else 
101                         git clone --depth 1 ${HOSTDEPEND_EOS_OSDN_SSH} ${EOS_HOSTDIR} || \
102                         git clone --depth 1 ${HOSTDEPEND_EOS_OSDN_HTTPS} ${EOS_HOSTDIR} || \
103                         echo "A port for SSH or HTTPS is not open, or something wrong."
104                         INSTALL_FLAG=INSTALL
105                 fi
106                 if [ -z $INSTALL_FLAG ] ; then
107                         git clone --depth 1 ${HOSTDEPEND_EOS_OSDN_GIT} ${EOS_HOSTDIR} || \
108                         git clone --depth 1 ${HOSTDEPEND_EOS_OSDN_HTTP} ${EOS_HOSTDIR} || \
109                         echo "A port for git (9418) or HTTP is not open, or something wrong."
110                 fi
111         fi
112 else
113         echo "Cannot make hostdepend"
114 fi
115
116 cd $WD