Changeset 331


Ignore:
Timestamp:
02/17/2011 06:14:08 PM (12 years ago)
Author:
marcus
Message:

r170 | walther | 2011-02-17 18:13:41 +0100 (Do, 17 Feb 2011) | 1 line

Working on installation procedure.

Location:
SH_SHM/trunk/setup
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • SH_SHM/trunk/setup/SHM-install.csh

    r329 r331  
    44#      =========== 
    55# 
    6 # version 4, 18-Jun-2006 
     6# version 5, 17-Feb-2011 
    77# 
    88# Installation script for SH/SHM package 
    9 # K. Stammler, 13-Nov-2003 
    109 
    1110set ext="undefined" 
     
    1716 
    1817if  ("$1" == "")  then 
    19         echo "Usage: $0 <installpath> [<sourcepath>]" 
    20         echo "" 
    21         echo "   Steps to install are:" 
    22         echo "   (i)   create installation directory (e.g. 'mkdir $PWD/shprog')" 
    23         echo "   (ii)  create tar file directory (e.g. 'mkdir $PWD/shtar')" 
    24         echo "   (iii) cd to tar file directory and get files:" 
    25    echo "         ftp://ftp.szgrf.bgr.de/pub/software/SH-SHM.tar.gz" 
    26    echo "         ftp://ftp.szgrf.bgr.de/pub/software/fk-$ext.tar.gz" 
    27    echo "         ftp://ftp.szgrf.bgr.de/pub/software/locsat-$ext.tar.gz" 
    28    echo "         ftp://ftp.szgrf.bgr.de/pub/software/SHM-install.csh" 
    29         echo "   (iv)  make SHM-install.csh executable 'chmod a+x ./SHM-install.csh'" 
    30         echo "   (v)   call e.g. './SHM-install.csh $PWD/shprog'" 
    31         echo "         Note that the parameter must be the absolute path to the" 
    32         echo "         installation directory" 
    33         echo "" 
    34         echo -n "Do you want run run the installation now ? [y/n] " 
    35         set reply="$<" 
    36         if  ("$reply" == "y" || "$reply" == "Y")  then 
    37                 set res=`which wget` 
    38                 if  (! -e $res)  then 
    39                         echo "need 'wget' to continue.  Please install" 
    40                         exit 
    41                 endif 
    42                 echo -n "Where should SH/SHM be installed? Enter full pathname: " 
    43                 set dstpath="$<" 
    44                 if  (! -d $dstpath)  mkdir $dstpath 
    45                 if  (! -w $dstpath)  then 
    46                         echo "Cannot write to $dstpath.  Abort." 
    47                         exit 
    48                 endif 
    49                 set srcpath=$HOME/shpackage 
    50                 if  (-d $srcpath)  then 
    51                         echo "SH package directory $srcpath already exists." 
    52                         echo "Please rename or delete it and restart the installation program." 
    53                         exit 
    54                 endif 
    55                 echo -n "Create SH package directory $srcpath ? [y/n] " 
    56                 set reply="$<" 
    57                 if  ("$reply" == "y" || "$reply" == "Y")  then 
    58                         mkdir $srcpath 
    59                 else 
    60                         exit 
    61                 endif 
    62                 echo "download SH/SHM package" 
    63                 (cd $srcpath; wget ftp://ftp.szgrf.bgr.de/pub/software/SH-SHM.tar.gz) 
    64                 echo "download FK package" 
    65                 (cd $srcpath; wget ftp://ftp.szgrf.bgr.de/pub/software/fk-$ext.tar.gz) 
    66                 echo "download LocSAT package" 
    67                 (cd $srcpath; wget ftp://ftp.szgrf.bgr.de/pub/software/locsat-$ext.tar.gz) 
    68         else 
    69                 exit 
    70         endif 
    71  
    72 else 
    73  
     18        echo "To be only used from self-extracting setup process!" 
     19else 
    7420        # get parameters 
    7521        set dstpath=$1 
    76         set srcpath=$2 
    77         if  ("$srcpath" == "")  set srcpath=$PWD 
    78  
    7922endif 
    8023 
    8124# check parameters 
    82 if  (! -d $srcpath)  then 
    83         echo "$0 : source path $srcpath not found.  Abort." 
    84         exit 
    85 endif 
    8625if  (! -w $dstpath)  then 
    8726        echo "$0 : cannot write to installation path $dstpath.  Abort." 
    8827        exit 
    8928endif 
    90 if  ("$srcpath" == "$dstpath")  then 
    91         echo "$0 : source path and installation path must not be equal.  Sorry." 
    92         exit 
    93 endif 
    9429 
    9530# find input files 
    96 set pack_shm="" 
    9731set pack_fk="" 
    9832set pack_locsat="" 
    9933 
    100 if  (-e $srcpath/SH-SHM.tar.gz)  then 
    101         set pack_shm=$srcpath/SH-SHM.tar.gz 
    102 else 
    103         set pack_shm=`ls $srcpath/SH-* | tail -1` 
    104 endif 
    10534if  ("`uname`" == "Linux")  then 
    106         if  (-e $srcpath/fk-linux.tar.gz)  set pack_fk=$srcpath/fk-linux.tar.gz 
    107         if  (-e $srcpath/locsat-linux.tar.gz)  set pack_locsat=$srcpath/locsat-linux.tar.gz 
     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 
    10837else if  ("`uname`" == "SunOS")  then 
    109         if  (-e $srcpath/fk-sol2.5.1.tar.gz)  set pack_fk=$srcpath/fk-sol2.5.1.tar.gz 
    110         if  (-e $srcpath/locsat-sol2.5.1.tar.gz)  set pack_locsat=$srcpath/locsat-sol2.5.1.tar.gz 
    111 else 
    112 endif 
    113  
    114 if  (-e $srcpath/libahio.a.$ext)  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 
    11544        set use_ah=1 
    11645else 
     
    12049 
    12150# default values 
    122 set compile_shm="yes" 
    123 set compile_fk="no" 
    124 set compile_locsat="no" 
    12551set displ_res="undef" 
    12652set userroot='$HOME/shfiles' 
     
    15783 
    15884        echo "" 
    159         echo "(p)  SHM-package:              $pack_shm" 
    160         echo "(f)  FK-package:               $pack_fk" 
    161         echo "(l)  LocSAT-package:           $pack_locsat" 
    16285        echo "(u)  user root path:           $userroot" 
    16386        echo "(e)  window based texteditor:  $editor" 
    164         echo "(cp) compile SHM:              $compile_shm" 
    165         echo "(cf) compile FK:               $compile_fk" 
    166         echo "(cl) compile LocSAT:           $compile_locsat" 
    167 #       echo "(r)  resolution:               $displ_res" 
    16887        echo "(c)  linux colors:             $linux_colors" 
    16988        echo "(i)  Start Installation" 
     
    17695 
    17796        if  ("$cmd" == "q")  exit 
    178         if  ("$cmd" == "p")  then 
    179                 echo -n "SHM-package: " 
    180                 set pack_shm="$<" 
    181         endif 
    182         if  ("$cmd" == "f")  then 
    183                 echo -n "FK-package: " 
    184                 set pack_fk="$<" 
    185         endif 
    186         if  ("$cmd" == "l")  then 
    187                 echo -n "LocSAT-package: " 
    188                 set pack_locsat="$<" 
    189         endif 
    190         if  ("$cmd" == "cp")  then 
    191                 if  ("$compile_shm" == "yes")  then 
    192                         set compile_shm="no" 
    193                 else 
    194                         set compile_shm="yes" 
    195                 endif 
    196         endif 
    197         if  ("$cmd" == "cf")  then 
    198                 if  ("$compile_fk" == "yes")  then 
    199                         set compile_fk="no" 
    200                 else 
    201                         set compile_fk="yes" 
    202                 endif 
    203         endif 
    204         if  ("$cmd" == "cl")  then 
    205                 if  ("$compile_locsat" == "yes")  then 
    206                         set compile_locsat="no" 
    207                 else 
    208                         set compile_locsat="yes" 
    209                 endif 
    210         endif 
    21197        if  ("$cmd" == "r")  then 
    21298                if  ("$displ_res" == "xga")  then 
     
    256142                endif 
    257143        endif 
    258  
    259144end 
    260  
    261  
    262 # check paths again 
    263 if  (! -e $pack_shm)  then 
    264         echo "$0 : echo SHM-package $pack_shm not found.  Abort." 
    265         exit 
    266 endif 
    267 if  (! -e $pack_fk)  then 
    268         echo "$0 : FK-package not found.  Abort." 
    269         exit 
    270 endif 
    271 if  (! -e $pack_locsat)  then 
    272         echo "$0 : LocSAT-package not found.  Abort." 
    273         exit 
    274 endif 
    275145 
    276146cd $dstpath 
     
    303173        sed "s@##LOCSATPATH##@$locsatpath@" | sed "s@##EDITOR##@$editor@" | \ 
    304174        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 
    305179if  ($use_ah == 0)  then 
    306         if  (-e shsetup.x)  \rm shsetup.x 
    307         sed 's/-DSH_SETUP_AH//' shsetup | sed 's/-lahio//' >shsetup.x 
    308         \rm shsetup 
    309         mv shsetup.x shsetup 
     180        sed --in-place 's/-DSH_SETUP_AH//' shsetup 
     181        sed --in-place 's/-lahio//' shsetup 
    310182endif 
    311183if  ($?MACHTYPE == 1)  then 
    312184        if  ("`echo $MACHTYPE | grep 64`" != "")  then 
    313185                if  (-d /usr/X11R6/lib64)  then 
    314                         if  (-e shsetup.x)  \rm shsetup.x 
    315                         sed 's/\/usr\/X11R6\/lib/\/usr\/X11R6\/lib64/' shsetup >shsetup.x 
    316                         \rm shsetup 
    317                         mv shsetup.x shsetup 
     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 
    318188                endif 
    319189        endif 
     
    322192 
    323193# create directories for evt files 
    324 mkdir $SH_USERROOT/evt 
    325 mkdir $SH_USERROOT/evt/evid 
    326 mkdir $SH_USERROOT/evt/evtout 
     194if (! -e $SH_USERROOT/evt/evid ) mkdir -p $SH_USERROOT/evt/evid 
     195if (! -e $SH_USERROOT/evt/evtout ) mkdir -p $SH_USERROOT/evt/evtout 
    327196 
    328197# find screen resolution 
     
    342211endif 
    343212set thissetup=$dstpath/sh/inputs/shm-config.txt 
    344 if  (-e $thissetup)  \rm $thissetup 
     213if  (-e $thissetup)  \mv $thissetup $dstpath/sh/inputs/shm-config.txt.yours 
    345214cp $origsetup $thissetup 
    346215 
    347216# settings for small displays (laptops) 
    348217if  ("$displ_res" != "" && "$displ_res" != "sxga")  then 
    349         if  (-e $thissetup.x)  \rm $thissetup.x 
    350         sed "s/shm-cof-sxga-geometry/shm-conf-$displ_res-geometry/" $thissetup >$thissetup.x 
    351         mv $thissetup.x $thissetup 
     218        sed --in-place "s/shm-cof-sxga-geometry/shm-conf-$displ_res-geometry/" $thissetup 
    352219endif 
    353220 
     
    356223        # do nothing, this is default 
    357224else 
    358         if  (-e $thissetup.x)  \rm $thissetup.x 
    359         sed 's/reverse_xors                 true/reverse_xors                 false/' $thissetup>$thisetup.x 
    360         mv $thissetup.x $thissetup 
    361 endif 
    362  
    363 # compile SHM 
    364 if  ("$compile_shm" == "yes")  then 
    365         echo "compiling SHM" 
    366         cd $SH_ROOT 
    367         # remove all o's and a's 
    368         set olist=`find . -name \*.o -print` 
    369         \rm $olist 
    370         cd $SH_LIB 
    371         if  (-e libahio.a)  mv libahio.a libahio.ax 
    372         \rm *.a 
    373         if  (-e libahio.ax)  mv libahio.ax libahio.a 
    374         cd $SH_ROOT 
    375         make depend_shm 
    376         make shm 
    377         make world 
    378 endif 
     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 
    379240 
    380241# install FK 
     
    391252if  (-e fk)  \rm fk 
    392253ln -s fk_src/fk fk 
    393  
    394 # compile FK 
    395 if  ("$compile_fk" == "yes")  then 
    396         echo "compile FK package" 
    397         cd fk_src 
    398         \rm *.o 
    399         make 
    400 endif 
    401254 
    402255# install LocSAT 
     
    415268ln -s locsat/bin/LocSAT LocSAT 
    416269 
    417 # compile LocSAT 
    418 if  ("$compile_locsat" == "yes")  then 
    419         echo "compile LocSAT package" 
    420         cd locsat 
    421         set olist=`find . -name \*.o -print` 
    422         \rm $olist 
    423         set olist=`find . -name \*.a -print` 
    424         \rm $olist 
    425         cd $SH_UTIL/locsat/libsrc 
    426         make 
    427         cd $SH_UTIL/locsat/bin/LocSAT 
    428         make 
    429 endif 
    430  
    431270# add SHM resources to .Xdefaults 
    432271set resrc="" 
     
    456295xrdb $resrc 
    457296 
    458  
    459297echo "" 
    460298echo "" 
  • SH_SHM/trunk/setup/setup.py

    r329 r331  
    3838    print "\n This piece of software will try to setup the included source code.\n" 
    3939 
    40 def download(pkg): 
    41     os.system("wget") 
     40def download(target, pkg): 
     41    os.system("echo wget -P %s %s" % (target, downloads[pkg])) 
    4242 
    4343def setup(**kwargs): 
     
    7878        break 
    7979 
    80     copy(os.path.join(data["pwd"], ".."), target, dbg) 
     80    copy(os.path.join(data["pwd"], ".."), os.path.join(target, "sh"), dbg) 
     81    download(target, "locsat") 
     82    download(target, "fk") 
     83 
     84    install(target) 
     85 
     86def install(target): 
     87    os.system(os.path.join(target, "setup/SHM-install.csh %s" % target)) 
    8188 
    8289def copy(src, trt, dbg=False): 
     
    98105    return raw_input(text) 
    99106 
    100  
    101107if __name__ == "__main__": 
    102108    from optparse import OptionParser 
  • SH_SHM/trunk/setup/shsetup.sh.template

    r327 r331  
    8888export SH_LIB=$shcroot/lib/ 
    8989[ -d $SH_USERROOT ] || mkdir $SH_USERROOT 
    90 if [ ! -d $SH_USERROOT/shscratch] ; then 
     90if [ ! -d $SH_USERROOT/shscratch ] ; then 
    9191   echo 'creating directory $SH_USERROOT/shscratch' 
    9292   mkdir $SH_USERROOT/shscratch  
    9393fi 
    94 if [ ! -d $SH_USERROOT/private] ; then 
     94if [ ! -d $SH_USERROOT/private ] ; then 
    9595   echo 'creating directory $SH_USERROOT/private' 
    9696   mkdir $SH_USERROOT/private 
Note: See TracChangeset for help on using the changeset viewer.