root/tags/solaris_20011018/arb_install.sh

Revision 313, 10.6 KB (checked in by anonymous, 11 years ago)

This commit was manufactured by cvs2svn to create tag
'solaris_20011018'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/bin/sh
2
3# error message function
4err() {
5        echo
6        echo "********************************* ERROR ***********************" 1>&2
7        echo "`basename $0`: $@" 1>&2
8        echo "***************************** END OF ERROR ********************" 1>&2
9        echo "  Please rerun script !!!" 1>&2
10        exit 1
11}
12
13untar() {
14        #remove old DEPOT BUG
15        rm -f DEPOT/gde/bin
16
17        if [ ! -x $cwd/zcat ]; then
18                if chmod 755 $cwd/zcat; then
19                        echo ">>> chmod 755  $cwd/zcat succesfull"
20                else
21                        err "Cannot chmod of $cwd/zcat"
22                fi
23        fi
24        if [ ! -r $cwd/$1 ]; then
25                err "Cannot find or read file  $cwd/$1"
26        fi
27        if $cwd/zcat $cwd/$1 |tar xfv -; then
28                echo ">>> $1 uncompressed and untared"
29        else
30                err "Error in uncompressing or untaring $1"
31        fi
32}
33
34seperator() {
35        echo ''
36        echo '*******************************************'
37}
38
39seperator
40echo 'Welcome to the ARB Package'
41echo ''
42echo 'Please answer some questions:'
43echo '  Note:   - You may abort this scipt with ctrl-"C"'
44echo '          - You can rerun this script as often as you like'
45echo '          - Old ARB data will be kept if requested (in this case'
46echo '            you can simply change some options)'
47echo '          - Pressing <return> will select the value in brackets'
48seperator
49echo 'Enter path where to install ARB ?'
50echo '  ARB is not a single programm but a set of programs, datafiles ...'
51echo '  To install ARB correctly all files are stored in a single '
52echo '  directory. This script creates such a directory and copies all'
53echo '  data into it, sets the correct permissions and optionally installs'
54echo '  some X11 stuff. Please enter the path of the directory where you want'
55echo '  to install ARB.'
56echo '  Notes:  This script optionally creates the destination directory.'
57echo '          You should have write permission at the destination location.'
58echo '                  1. To install ARB in your home directory: Enter "arb"'
59echo '                  2. Otherwise become root and rerun script.'
60echo '                  3. On Linux computers this script should be run under root'
61echo ''
62echo '  Example: If there is enough space (40 MB) at your /usr partition and'
63echo '  you want to install arb at /usr/arb, enter "/usr/arb"'
64
65if [ "$ARBHOME" != "" ]; then
66        if test -f $ARBHOME/lib/arb_tcp.dat; then
67                echo "  Note:   I found an old arb program at $ARBHOME"
68        fi
69fi
70
71echo "PATH ? [${ARBHOME:-/usr/arb}]"
72read ARBHOMEI
73echo
74echo
75echo
76
77if [ "$ARBHOMEI" = "" ]; then
78        ARBHOME="${ARBHOME:-/usr/arb}";
79else
80        ARBHOME="${ARBHOMEI}";
81fi
82
83
84cwd=`pwd`
85if test -d $ARBHOME; then
86        if test -w $ARBHOME; then
87                seperator
88                echo 'The destination directory already exists'
89                echo '  You can delete the old directory before installing ARB'
90                echo '  or only update/change options of the old version.'
91                echo 'Delete old directory (y/n)[n]?'
92                read delete_dir
93                echo
94                case "$delete_dir" in
95                        y)
96                                if rm -r $ARBHOME/* ;then
97                                        echo ">>> all data in $ARBHOME deleted"
98                                else
99                                        err "cannot delete all data in $ARBHOME"
100                                fi;;
101                        *)
102                                if test -f $ARBHOME/lib/arb_tcp.dat; then
103                                        bckup=$ARBHOME/lib/arb_tcp.dat.`date +%y%m%d%H%M%S`
104                                        echo ">>>old $ARBHOME/lib/arb_tcp.dat found"
105                                        echo ">>>backup to $bckup"
106                                        cp $ARBHOME/lib/arb_tcp.dat $bckup
107                                fi
108                                echo ">>> old data not deleted";;
109                esac
110        else
111                err "directory exists and is not writable";
112        fi
113else
114        if mkdir -p $ARBHOME; then
115                echo ">>> $ARBHOME created"
116        else
117                err "cannot create directory $ARBHOME";
118        fi
119fi
120
121cd $ARBHOME
122ARBHOME=`pwd`
123
124if test -d lib/pictures; then
125        seperator
126        echo "Old ARB package found (type n to change only some options)."
127        echo "  Do you want to update the old package: (y/n)[y]"
128        read var;
129        case "$var" in
130                n)
131                        echo "Old version unchanged";;
132                *)
133                        echo "updating ARB"
134                        untar arb.tgz;;
135        esac
136else   
137        untar arb.tgz;
138fi
139
140if test -f $cwd/arb_ale.tgz; then
141        if test -f DEPOT2/emacs; then
142                seperator
143                echo "Old ARB_ALE package found"
144                echo "ARB_ALE is a sophisticated alignment editor written by RDP"
145                echo "  Do you want to update the old package: (y/n)[y]"
146                read var;
147                case "$var" in
148                        n)
149                                echo "Old ARB_ALE version unchanged";;
150                        *)
151                                echo "updating ARB_ALE"
152                                untar arb_ale.tgz;;
153                esac
154        else   
155                untar arb_ale.tgz;
156        fi
157fi
158
159seperator
160echo 'Specify PT_SERVER files location'
161echo '  ARB needs a writeable directory to store the pt_server files. '
162echo '  Those files are needed for fast database search'
163echo '  (by probe_design, probe_match and the automatic aligner)'
164echo '  and need a lot of disc space (up to several 100 mega bytes,'
165echo '  e.g. 4000 16S RNA sequences require about 40 MB).'
166echo '  This files are not created now, but later on by all users '
167echo '          <ARB_NT/etc/PT_SERVER admin/update server>'
168echo '  You may define a special directory as the pt_server files location.'
169echo '  This prevents any loss of data installing a new version of '
170echo '  ARB. '
171
172echo 'Where do you want to put your pt_server data'
173echo '          1. <CR> - (new installation of ARB)'
174echo '                    for placing pt_server data within ARB directory tree'
175echo '                    (Default location).'
176echo '                  - (updating ARB)'
177echo '                    using the previous location'
178echo '          2. "Path" to link pt_server data directory to'
179echo 'Enter path:'
180read pt_dir
181echo
182case "$pt_dir" in
183        "")
184                echo "installing the pt_server data in $ARBHOME/lib/pts"
185                if test -h lib/pts; then
186                        echo ">>> pt_server files at non default location:"
187                        ls -ld ${ARBHOME}/lib/pts
188                else
189                        if test -d lib/pts; then
190                                echo ">>> pt_server files at default location: unchanged"
191                        else
192                                (cd lib;rm -f pts;mkdir pts;)
193                        fi
194                fi;;
195        *)
196                echo "changing your pt_server file location"
197                if test -h lib/pts; then
198                        echo ">>> non default location found: removing old link"
199                        rm lib/pts
200                else
201                        if test -d lib/pts; then
202                                echo ">>> data in default location found: removing old data"
203                                rm      -r lib/pts
204                        fi
205                fi
206                if test ! -d $pt_dir; then
207                        echo ">>> Creating special PT_SERVER directory $pt_dir"
208                        if mkdir -p $pt_dir; then
209                                echo ">>> $pt_dir created"
210                        else
211                                err "Couldn't create $pt_dir"
212                        fi
213                fi
214                (cd lib;ln -s $pt_dir pts;)
215esac
216
217seperator
218echo 'Who is responsible for the PT_SERVER index files ?'
219echo '  Answer  y: if you trust your users'
220echo '          n: if YOU want to administrate all PT_SERVER files'
221echo '  or simply press return to keep the settings of an old installation.'
222echo 'Should everybody may update PT_SERVER files (y/n/dont_change)[dont_change]?'
223read var
224echo
225case "$var" in
226        y)
227                echo ">>> all users are allowed to update the PT_SERVER";
228                chmod 777 lib/pts
229                chmod 666 lib/pts/* 2>/dev/null ;;
230        n)
231                echo ">>> only `whoami` is allowed to update the pt_server";
232                chmod 755 lib/pts
233                chmod 644 lib/pts/* 2>/dev/null ;;
234        *)
235                echo ">>> flags unchanged";;
236esac
237
238seperator
239echo 'NameServer installation'
240echo '  The NameServer is a programm, that synchronizes all species names'
241echo '  of the databases of different users.'
242echo '  Users that import foreign data into their database and want to'
243echo '  export those data to other ARB users should be allowed to change'
244echo '  the names file in $ARBHOME/lib/nas/names.dat'
245echo '  Answer  y: if all users may import foreign databases'
246echo '          n: if there are some mean untrusty users'
247echo '  or simply press return to keep the old settings'
248echo 'Do you trust your users (y/n/dont_change)[dont_change]?'
249read var
250echo
251case "$var" in
252        y)
253                echo ">>> all user are allowed to change the names file";
254                chmod 777 lib/nas
255                chmod 666 lib/nas/*;;
256        n)
257                echo ">>> only `whoami` is allowed to change the names file ${ARBHOME}/lib/nas/names.dat"
258                chmod 755 lib/nas
259                chmod 644 lib/nas/*;;
260        *)
261                echo ">>> flags unchanged";;
262esac
263
264seperator
265echo 'Networking'
266echo '  To speed up calculation one special host can be assigned as'
267echo '  the PT_SERVER host. That means that all database search is done'
268echo '  on that host. This saves computer resources as different users'
269echo '  may share one server.'
270echo '  To get the best results this host "H" should:'
271echo '                  1.      be fast,'
272echo '                  2.      have a lot of real memory (>=64 meg),'
273echo '                  3.      have a lot of swap space (>=400 meg),'
274echo '                  4.      allow all users to run "rsh H ...",'
275echo '                  5.      contain the discs with the PT_SERVER files.'
276
277echo '  n       You want to assign a special *N*etwork host'
278echo '  s       You have a *S*tand alone computer'
279if test "X$bckup" != "X"; then
280  echo '        o       Use information of already installed ARB'
281  echo 'Choose (s/n/o)[s]?'
282else
283  echo 'Choose (s/n)[s]?'
284
285fi
286read var
287echo
288
289
290
291case "$var" in
292  o)
293     mv $bckup lib/arb_tcp.dat;
294     echo ">>> old lib/arb_tcp.dat restored";;
295  n)
296     seperator
297     echo "Enter the name of your host for the pt_server"
298       read host
299       echo "Checking connection to $host"
300       if rsh $host ls >/dev/zero; then
301         echo ">>> rsh $host ok"
302       else
303         err ">>> cannot run 'rsh $host'";
304       fi
305       rm -f lib/arb_tcp.dat;
306       cat lib/arb_tcp_org.dat |sed -e "/localhost\:/$host\:/g" >lib/arb_tcp.dat
307       echo ">>> server installed";;
308  *)
309     cp lib/arb_tcp_org.dat lib/arb_tcp.dat
310     echo ">>> server installed";;
311esac
312
313if test -r /vmunix -a \( ! -r /usr/lib/X11/XKeysymDB \); then
314
315  seperator
316  echo "/usr/lib/X11/XKeysymDB not found: Should I install it now (y/n)[y]"
317  read var
318  echo
319  case "$var" in
320    n)
321       echo ">>> XKeysymDB not installed";;
322    *)
323       install -d /usr/lib/X11
324       install Xlib/XKeysymDB Xlib/XErrorDB /usr/lib/X11
325       echo ">>> XKeysymDB XErrorDB installed";;
326  esac
327fi
328
329seperator
330echo ">>> Installation Complete"
331
332seperator
333echo "Finally, we have to tell your system where to find arb:"
334echo ""
335echo "You may either:"
336echo "    1. Change your local .profile (if you are using ksh/bash)"
337  echo "    2. Change your local .cshrc file (if you are using csh/tcsh)"
338    echo "    3. Create an alias:   alias arb=$ARBHOME/bin/arb"
339
340        read var
341
342        case "$var" in
343          1)
344             echo "add the following lines to your ~/.profile";
345             echo '******************************************';
346             echo "     ARBHOME=$ARBHOME;export ARBHOME";
347             echo '     LD_LIBRARY_PATH=${ARBHOME}/lib:${LD_LIBRARY_PATH}';
348             echo '     export LD_LIBRARY_PATH';
349             echo '     PATH=${ARBHOME}/bin:${PATH}';
350             echo '     export PATH';
351             echo ' '
352             echo 'enter the following command:';
353             echo '     . ~/.profile';;
354          2)
355             echo "add the following lines to your ~/.cshrc";
356             echo '******************************************';
357             echo "     setenv ARBHOME $ARBHOME";
358             if test "X${LD_LIBRARY_PATH:}" != "X"; then
359               echo '   setenv LD_LIBRARY_PATH $ARBHOME/lib\:$LD_LIBRARY_PATH';
360             else
361               echo '        setenv LD_LIBRARY_PATH $ARBHOME/lib';
362             fi
363             echo '     setenv PATH $ARBHOME/bin\:$PATH';
364             echo ' '
365             echo 'enter the following command:';
366             echo '     source ~/.cshrc';;
367          *)
368             rm -f /usr/lib/libAW.so;;
369        esac
370
371        echo ""
372        echo ""
373        echo "to start arb type 'arb'"
374        echo ""
375        echo "Have much fun using ARB"
376
377        unset host
378        unset cwd
379        unset ARBHOME
380        unset delete_dir
381        unset keep_debug
382        unset pt_dir
383        unset var
Note: See TracBrowser for help on using the browser.