Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/system/installml
ViewVC logotype

Annotation of /sml/trunk/src/system/installml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 537 - (view) (download)

1 : blume 512 #!/bin/sh
2 :    
3 :     # The tmpfile is for pathconfig editing (see below).
4 :     tmpfile=pathconfig.tmp.$$
5 :    
6 :     trap 'rm -f $tmpfile; exit 1' 0 1 2 3 15
7 :    
8 :     MAIN_HEAP_DIR=../../bin/.heap
9 :     MAIN_LIB_DIR=../../lib
10 :    
11 :     if [ $# -gt 0 ] ; then
12 :     STEM=$1
13 :     else
14 :     STEM=sml
15 :     fi
16 :    
17 :     if [ -f ../../bin/.arch-n-opsys ]; then
18 :     ARCH_N_OPSYS=`../../bin/.arch-n-opsys`
19 :     if [ "$?" = "0" ]; then
20 :     eval $ARCH_N_OPSYS
21 :     else
22 :     echo "Cannot determine architecture/os."
23 :     exit 1
24 :     fi
25 :     fi
26 :    
27 :     HEAP_FILE=$STEM.$ARCH-$OPSYS
28 :     LIB_DIR=$STEM.lib
29 :    
30 :     if [ ! -f $HEAP_FILE ] ; then
31 :     echo "The heap file $HEAP_FILE is missing."
32 :     exit 1
33 :     fi
34 :    
35 :     if [ ! -d $LIB_DIR ] ; then
36 :     echo "The library directory $LIB_DIR is missing."
37 :     exit 1
38 :     fi
39 :    
40 :     # Moving the heap image to its place
41 :     mv $HEAP_FILE $MAIN_HEAP_DIR/sml.$ARCH-$OPSYS
42 :    
43 :     # Moving each individual library...
44 :     cd $LIB_DIR
45 :     list=`echo *.cm`
46 :     cd ..
47 : blume 537 for lib in init.cmi $list ; do
48 : blume 512 if [ -d $MAIN_LIB_DIR/$lib/CM/$ARCH-unix ] ; then
49 :     rm -r $MAIN_LIB_DIR/$lib/CM/$ARCH-unix
50 :     fi
51 :     # Be careful not to clobber libraries for other architectures...
52 :     if [ -d $MAIN_LIB_DIR/$lib ] ; then
53 :     if [ -d $MAIN_LIB_DIR/$lib/CM ] ; then
54 :     mv $LIB_DIR/$lib/CM/$ARCH-unix $MAIN_LIB_DIR/$lib/CM/$ARCH-unix
55 :     else
56 :     mv $LIB_DIR/$lib/CM $MAIN_LIB_DIR/$lib/CM
57 :     fi
58 :     else
59 :     mv $LIB_DIR/$lib $MAIN_LIB_DIR/$lib
60 :     fi
61 :     done
62 :    
63 :     # Update the pathconfig file in $MAIN_LIB_DIR
64 :     # The awk script below replaces the original binding in $pcfile
65 :     # with its fresh counterpart should there be one. Other bindings
66 :     # are retained and brand new ones are added.
67 :     pcfile=$MAIN_LIB_DIR/pathconfig
68 :     if [ -f $pcfile ] ; then
69 :     cp $pcfile $tmpfile
70 :     fi
71 :     rm -f $pcfile
72 :     cat $LIB_DIR/pathconfig >>$tmpfile
73 :     awk <$tmpfile >$pcfile 'NF == 2 { mapping[$1] = $2 }
74 :     NF != 2 { print $0 }
75 :     END { for (i in mapping) print i, mapping[i] }'
76 :    
77 :     rm -r $LIB_DIR

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0