| 3418 |
maechler |
1 |
#!/bin/sh
|
|
|
2 |
#
|
|
|
3 |
URL=http://www.cise.ufl.edu/research/sparse/CSparse
|
|
|
4 |
tarFile=CSparse.tar.gz
|
|
|
5 |
## subdirectory *inside* tar file:
|
|
|
6 |
sDir=CSparse/Source
|
|
|
7 |
# ----------------- a "full path" for the current directory:
|
|
|
8 |
MatrixDir=`dirname $0`; cd $MatrixDir; MatrixDir=`pwd`
|
|
|
9 |
if [ -d $MatrixDir ]
|
|
|
10 |
then echo "Downloading into directory '$MatrixDir' .."
|
|
|
11 |
else echo "no directory '$MatrixDir' .. exiting"; exit 3
|
|
|
12 |
fi
|
|
|
13 |
cd $MatrixDir
|
|
|
14 |
#
|
|
|
15 |
wget $URL/$tarFile
|
|
|
16 |
#
|
|
|
17 |
if [ ! -r $tarFile ]; then echo "no file $tarFile .. exiting"; exit 1 ; fi
|
|
|
18 |
## extract only the part we want
|
|
|
19 |
tar zxf $tarFile $sDir
|
|
|
20 |
if [ ! -d $sDir ]; then echo "no directory $sDir .. exiting"; exit 2 ; fi
|
|
|
21 |
echo -n "Moving and cat'ing files from $sDir .. "
|
|
|
22 |
cd $sDir
|
|
|
23 |
chmod a+r cs.h
|
|
|
24 |
mv cs.h $MatrixDir
|
|
|
25 |
cat cs_*.c | sed -e '1 p' -e '/^#include/d' > $MatrixDir/cs.c
|
|
|
26 |
echo '[Ok]'
|
|
|
27 |
echo -n "cleaning up $sDir .. "
|
|
|
28 |
## keep the [TAB]s here ^^
|
|
|
29 |
cd $MatrixDir
|
|
|
30 |
rm -rf $tarFile $sDir
|
|
|
31 |
rmdir `dirname $sDir`
|
|
|
32 |
echo '[Ok]'
|