1 krisbash 1.1 #!/bin/bash
2
3 if [ "$#" != 1 -a "$#" != 2 ]; then
4 echo "Usage: $0 OMIZIPFILE [--dev]"
5 exit 1
6 fi
7
8 if [ ! -f "$1" ]
9 then
10 echo "$1 does not exists!"
11 exit 1
12 fi
13
14 if [ "$#" = 2 ];
15 then
16 if [ "$2" = "--dev" ]; then
17 run_dev=1
18 else
19 echo "Usage: $0 OMIZIPFILE [--dev]"
20 exit 1
21 fi
22 krisbash 1.1 fi
23
24 # Create directories for validation purpose
25 CURTIMESTAMPE=`date +'%s'`
26 ROOTDIR=/OMI
27 WORKDIR=$ROOTDIR/$CURTIMESTAMPE
28 UNZIPDIR=$WORKDIR/UNZIP
29 SRCDIR=$WORKDIR/SRC
30 TMPDIR=$WORKDIR/TMP
31
32 if [ ! -d "$SRCDIR" ]
33 then
34 mkdir --parents $SRCDIR
35 fi
36
37 if [ ! -d "$TMPDIR" ]
38 then
39 mkdir --parents $TMPDIR
40 fi
41
42 if [ ! -d "$UNZIPDIR" ]
43 krisbash 1.1 then
44 mkdir --parents $UNZIPDIR
45 fi
46
47 unzip $1 -d $UNZIPDIR >unzip.txt
48
49 if [ $? = 0 ]
50 then
51 echo "$1 was unziped to $UNZIPDIR."
52 else
53 echo "$1 is not a valid zip file!"
54 exit 1
55 fi
56 #############################################################
57 # Clean up source code under $UNZIPDIR and copy to $SRCDIR #
58 #############################################################
59
60 cd $UNZIPDIR
61
62 # (1) Remove all sources/dirs files
63 find ./ -iname "sources" -type f > $TMPDIR/sourceslist
64 krisbash 1.1 find ./ -iname "sources" -type f -print | xargs /bin/rm -f
65 find ./ -iname "dirs" -type f > $TMPDIR/dirslist
66 find ./ -iname "dirs" -type f -print | xargs /bin/rm -f
67
68 # (2) Remove all win directories
69 find ./ -not -iname "win" -type d > $TMPDIR/dirlist
70
71 echo '=================' > $TMPDIR/cplog
72 echo "$WORKDIR" >> $TMPDIR/cplog
73 echo '=================' >> $TMPDIR/cplog
74
75 DIRS=`cat $TMPDIR/dirlist`
76 for i in $DIRS
77 do
78 echo "=start to copy $i=" >> $TMPDIR/cplog
79
80 if [ ! -d "$SRCDIR/$i" ]
81 then
82 mkdir --parents $SRCDIR/$i >> $TMPDIR/cplog 2>&1
83 fi
84 cp $i/*.* $SRCDIR/$i >> $TMPDIR/cplog 2>&1
85 krisbash 1.1 cp $i/* $SRCDIR/$i >> $TMPDIR/cplog 2>&1
86
87 echo "_" >> $TMPDIR/cplog
88 done
89
90 #rm -f $TMPDIR/dirlist
91
92 #############################################################
93 # Enable scripts #
94 #############################################################
95
96 cd $SRCDIR
97 chmod 777 $SRCDIR/scripts/fixdist
98 $SRCDIR/scripts/fixdist
99 chmod 777 $SRCDIR/configure
100 chmod 777 $SRCDIR/configure-optimize
101 chmod 777 $SRCDIR/configure-size
102 chmod 777 $SRCDIR/configure-wchar
103 chmod 777 $SRCDIR/configure-world
104 chmod 777 $SRCDIR/buildtool
105 chmod 777 $SRCDIR/regress
106 krisbash 1.1
107 #############################################################
108 # Run regression tests #
109 #############################################################
110 $SRCDIR/configure
111 if [ "$run_dev" = "1" ]; then
112 $SRCDIR/regress --runs=char
113 else
114 $SRCDIR/regress
115 fi
|