source: SH_SHM/trunk/setup/SHM-install.csh @ 338

Revision 338, 7.7 KB checked in by marcus, 12 years ago (diff)

r177 | walther | 2011-03-03 14:31:05 +0100 (Do, 03 Mär 2011) | 1 line

Some updates for installation scripts.

  • Property svn:executable set to *
Line 
1#! /bin/csh
2#
3# file install.csh
4#      ===========
5#
6# version 5, 17-Feb-2011
7#
8# Installation script for SH/SHM package
9
10set ext="undefined"
11if  ("`uname`" == "Linux")  then
12        set ext="linux"
13else if  ("`uname`" == "SunOS")  then
14        set ext="sol2.5.1"
15endif
16
17if  ("$1" == "")  then
18        echo "To be only used from self-extracting setup process!"
19else
20        # get parameters
21        set dstpath=$1
22endif
23
24# check parameters
25if  (! -w $dstpath)  then
26        echo "$0 : cannot write to installation path $dstpath.  Abort."
27        exit
28endif
29
30# find input files
31set pack_fk=""
32set pack_locsat=""
33
34if  ("`uname`" == "Linux")  then
35        if  (-e $dstpath/fk-linux.tar.gz)  set pack_fk=$dstpath/fk-linux.tar.gz
36        if  (-e $dstpath/locsat-linux.tar.gz)  set pack_locsat=$dstpath/locsat-linux.tar.gz
37else if  ("`uname`" == "SunOS")  then
38        if  (-e $dstpath/fk-sol2.5.1.tar.gz)  set pack_fk=$dstpath/fk-sol2.5.1.tar.gz
39        if  (-e $dstpath/locsat-sol2.5.1.tar.gz)  set pack_locsat=$dstpath/locsat-sol2.5.1.tar.gz
40else
41endif
42
43if  (-e $dstpath/libahio.a.$ext)  then
44        set use_ah=1
45else
46        set use_ah=0
47endif
48
49
50# default values
51set displ_res="undef"
52set userroot='$HOME/shfiles'
53if  ("`uname`" == "Linux")  then
54        set linux_colors="yes"
55else
56        set linux_colors="no"
57endif
58
59# find text editor
60set editor=""
61foreach  ed  (kate gedit textedit nedit vuepad xedit)
62        set res=`which $ed`
63        if  (-e "$res")  then
64                set editor=$ed
65                break
66        endif
67end
68
69# check for some programs in search path
70set plist = ( gzip make makedepend gcc uil ar ranlib xterm )
71foreach p ($plist)
72        set res=`which $p`
73        if  (! -e "$res")  then
74                echo "Program $p not found in search path.  Please add."
75                exit
76        endif
77end
78
79# enter setup menu
80
81set cmd=""
82while  ("$cmd" != "i")
83
84        echo ""
85        echo "(u)  user root path:           $userroot"
86        echo "(e)  window based texteditor:  $editor"
87        echo "(c)  linux colors:             $linux_colors"
88        echo "(i)  Start Installation"
89        echo "(q)  Quit Installation"
90        echo ""
91        echo "if all settings are ok, enter 'i'"
92        echo ""
93        echo -n "cmd: "
94        set cmd="$<"
95
96        if  ("$cmd" == "q")  exit
97        if  ("$cmd" == "r")  then
98                if  ("$displ_res" == "xga")  then
99                        set displ_res="wxga"
100                else if  ("$displ_res" == "wxga")  then
101                        set displ_res="sxga"
102                else
103                        set displ_res="xga"
104                endif
105        endif
106        if  ("$cmd" == "c")  then
107                if  ("$linux_colors" == "yes")  then
108                        set linux_colors="no"
109                else
110                        set linux_colors="yes"
111                endif
112        endif
113        if  ("$cmd" == "e")  then
114                echo -n "window based texteditor: "
115                set editor="$<"
116                if  (! -e $editor)  then
117                        echo "$editor does not exist."
118                        echo -n "Enter <Return> ..."
119                        set x="$<"
120                        set editor=""
121                endif
122        endif
123        if  ("$cmd" == "u")  then
124                echo -n "user root path: "
125                set userroot="$<"
126                if  (! -e $userroot)  then
127                        mkdir $userroot
128                        if  (! -e $userroot)  then
129                                echo "cannot create $userroot. Reset to default."
130                                echo -n "Enter <Return> ..."
131                                set x="$<"
132                                set userroot=$HOME/shfiles
133                        endif
134                endif
135        endif
136        if  ("$cmd" == "i")  then
137                if  ("$editor" == "")   then
138                        echo "Please specify window based texteditor executable."
139                        echo -n "Enter <Return> ..."
140                        set x="$<"
141                        set cmd="."
142                endif
143        endif
144end
145
146cd $dstpath
147
148# create setup file from template
149echo "prepare setup file"
150cd sh/setup
151if  ("`uname`" == "Linux")  then
152        set remstr="#OS-linux "
153else if  ("`uname`" == "SunOS")  then
154        set remstr="#OS-sol2 "
155else
156        echo "$0 : sorry, this operating system is not supported"
157        exit
158endif
159set locsatpath=$dstpath/sh/util/locsat
160set plth=`echo $locsatpath | wc -c`
161if  ($plth > 25)  then
162        if  (-e $HOME/lcs)  \rm $HOME/lcs
163        ln -s $locsatpath $HOME/lcs
164        set locsatpath=$HOME/lcs
165        set plth=`echo $locsatpath | wc -c`
166        if  ($plth > 25)  then
167                echo "$0 : cannot find short locsat path.  Abort."
168                exit
169        endif
170endif
171if  (-e shsetup)  \rm shsetup
172sed "s/$remstr//" shsetup.template | sed "s@##ROOTPATH##@$dstpath/sh@" | \
173        sed "s@##LOCSATPATH##@$locsatpath@" | sed "s@##EDITOR##@$editor@" | \
174        sed 's/-DSH_SETUP_SZGRF//' | sed "s@##USERROOT##@$userroot@" >shsetup
175sed "s/$remstr//" shsetup.sh.template | sed "s@##ROOTPATH##@$dstpath/sh@" | \
176        sed "s@##LOCSATPATH##@$locsatpath@" | sed "s@##EDITOR##@$editor@" | \
177        sed 's/-DSH_SETUP_SZGRF//' | sed "s@##USERROOT##@$userroot@" >shsetup.sh
178
179if  ($use_ah == 0)  then
180        sed --in-place 's/-DSH_SETUP_AH//' shsetup
181        sed --in-place 's/-lahio//' shsetup
182endif
183if  ($?MACHTYPE == 1)  then
184        if  ("`echo $MACHTYPE | grep 64`" != "")  then
185                if  (-d /usr/X11R6/lib64)  then
186                        sed --in-place 's/\/usr\/X11R6\/lib/\/usr\/X11R6\/lib64/' shsetup
187                        sed --in-place 's/\/usr\/X11R6\/lib/\/usr\/X11R6\/lib64/' shsetup.sh
188                endif
189        endif
190endif
191source shsetup
192
193# create directories for evt files
194if (! -e $SH_USERROOT/evt/evid ) mkdir -p $SH_USERROOT/evt/evid
195if (! -e $SH_USERROOT/evt/evtout ) mkdir -p $SH_USERROOT/evt/evtout
196
197# find screen resolution
198set displ_res=`$dstpath/sh/util/get_screen_resolution.csh`
199if  ($#displ_res != 3)  then
200        echo "cannot find screen resolution, please set manually"
201        set displ_res="sxga"
202else
203        echo "found screen resolution $displ_res"
204        set displ_res=$displ_res[3]
205endif
206
207set origsetup=$dstpath/sh/inputs/shm-config-default.txt
208if  (! -e $origsetup)  then
209        echo "Installation program error.  Sorry."
210        exit
211endif
212set thissetup=$dstpath/sh/inputs/shm-config.txt
213if  (-e $thissetup)  \mv $thissetup $dstpath/sh/inputs/shm-config.txt.yours
214sed "s@##EDITOR##@$editor@" $origsetup > $thissetup
215
216# settings for small displays (laptops)
217if  ("$displ_res" != "" && "$displ_res" != "sxga")  then
218        sed --in-place "s/shm-cof-sxga-geometry/shm-conf-$displ_res-geometry/" $thissetup
219endif
220
221# linux colors
222if  ("$linux_colors" == "yes")  then
223        # do nothing, this is default
224else
225        sed --in-place 's/reverse_xors                 true/reverse_xors                 false/' $thissetup
226endif
227
228echo "compiling SHM"
229cd $SH_ROOT
230# remove all o's and a's
231find . -name '*.o' -print0 | xargs -0 rm
232cd $SH_LIB
233if  (-e libahio.a)  mv libahio.a libahio.ax
234\rm *.a
235if  (-e libahio.ax)  mv libahio.ax libahio.a
236cd $SH_ROOT
237make depend_shm
238make shm
239make world
240
241# install FK
242echo "extract FK package"
243cd $SH_UTIL
244if  (-e fk_src)  \rm -rf fk_src
245cp $pack_fk .
246set pack_fk=$pack_fk:t
247gzip -d $pack_fk
248set pack_fk=$pack_fk:r
249chmod +w $pack_fk
250tar xf $pack_fk
251\rm $pack_fk
252if  (-e fk)  \rm fk
253ln -s fk_src/fk fk
254
255# install LocSAT
256echo "extract LocSAT package"
257cd $SH_UTIL
258if  (-e locsat)  \rm -rf locsat
259mkdir locsat
260cp $pack_locsat .
261set pack_locsat=$pack_locsat:t
262gzip -d $pack_locsat
263set pack_locsat=$pack_locsat:r
264chmod +w $pack_locsat
265tar xf $pack_locsat
266\rm $pack_locsat
267if  (-e LocSAT)  \rm LocSAT
268ln -s locsat/bin/LocSAT LocSAT
269
270# add SHM resources to .Xdefaults
271set resrc=""
272if  (-e ~/.Xdefaults)  set resrc=~/.Xdefaults
273if  ("$resrc" == "")  then
274        if  (-e ~/.Xresources)  set resrc=~/.Xresources
275endif
276if  ("$resrc" == "")  then
277        set resrc="~/.Xdefaults"
278        touch $resrc
279endif
280set res=`grep "SHM*locsat_prefix_text" $resrc`
281if  ("$res" == "")  then
282        echo "SHM*locsat_prefix_text.value:       tab"  >>$resrc
283        echo "SHM*fk_frqlo_text.value:            0.4"  >>$resrc
284        echo "SHM*fk_frqhi_text.value:            3.0"  >>$resrc
285        echo "SHM*fk_slowness_text.value:         15"   >>$resrc
286        echo "SHM*fk_resol_text.value:            51"   >>$resrc
287        echo "SHM*fk_colnum_text.value:           10"   >>$resrc
288        echo "SHM*filter_butpar_hi_text.value:    1Hz"  >>$resrc
289        echo "SHM*filter_butpar_lo_text.value:    100s" >>$resrc
290        echo "SHM*filter_butpar_order_text.value: 4"    >>$resrc
291        echo "SHM*opick_thresh_text.value:        10.0" >>$resrc
292        echo "SHM*opick_duration_text.value:      1.0"  >>$resrc
293        echo "SHM*opick_break_text.value:         0.00" >>$resrc
294endif
295xrdb $resrc
296
297echo ""
298echo ""
299echo "Please update your environment before using SH or SHM!"
300echo ""
301echo "If you prefer csh or tcsh put this line into your ~/.cshrc file:"
302echo "source $dstpath/sh/setup/shsetup"
303echo ""
304echo "If you prefer bash put this line into your ~/.bashrc file:"
305echo "source $dstpath/sh/setup/shsetup.sh"
306echo ""
Note: See TracBrowser for help on using the repository browser.