author | Jon Tibble <meths@btinternet.com> |
Thu, 15 Mar 2012 09:58:35 +0000 | |
branch | s11express-2010-11 |
changeset 22104 | cde243cbe3f6 |
parent 6297 | 325024482887 |
permissions | -rwxr-xr-x |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
1 |
#!/bin/bash |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
2 |
|
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
3 |
if [ -z $1 ]; then |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
4 |
echo "usage: $0 <specfile1> [specfile2 ...]" |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
5 |
exit 1 |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
6 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
7 |
|
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
8 |
export http_proxy="webcache.uk.sun.com:8080" |
6079 | 9 |
export ftp_proxy=${http_proxy} |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
10 |
PULL_NEW_TARBALLS=1 |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
11 |
|
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
12 |
while [ $# -ne 0 ] |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
13 |
do |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
14 |
specfile=$1 |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
15 |
|
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
16 |
if [ -f $specfile ]; then |
6079 | 17 |
NAME=$(grep "^Name:" $specfile | sed -e "s/Name: *//" ) |
18 |
NAME=$( echo $NAME ) # Gets rid of spaces and tabs that sed didn't. |
|
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
19 |
CURRENT=$(grep "^Version:" $specfile | sed -e "s/Version:[\t ]*//") |
6079 | 20 |
CURRENT=$( echo $CURRENT ) |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
21 |
SOURCE=$(grep "^Source:" $specfile | sed -e "s/Source:[\t ]*//") |
6079 | 22 |
SOURCE=$( echo $SOURCE ) |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
23 |
# Replace '%{Name}' with $NAME. |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
24 |
SOURCE=$(echo $SOURCE | sed -e "s/\%{*[Nn]ame}*/${NAME}/g") |
6079 | 25 |
#SOURCE=$(echo $SOURCE | sed -e "s/\%{*[Vv]ersion}*/${CURRENT}/g") |
26 |
SOURCEDIR=$(dirname $SOURCE) |
|
27 |
# Substitute '%version' if present in directory. |
|
28 |
SOURCEDIR=$(echo $SOURCEDIR | sed -e "s/\%{*[Vv]ersion}*/${CURRENT}/g") |
|
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
29 |
|
6079 | 30 |
proto=$(echo $SOURCEDIR | cut -d ":" -f 1) |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
31 |
if [ $proto != "http" -a $proto != "ftp" ]; then |
6079 | 32 |
echo "Not fetching latest version for $NAME - can't use \"$SOURCEDIR\"" |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
33 |
else |
6079 | 34 |
LATEST=$(wget $SOURCEDIR -O - 2>/dev/null | grep "LATEST-IS" | sed -e "s/.*LATEST-IS-\([0-9][0-9\.]*\).*/\1/") |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
35 |
if [ -z $LATEST ]; then |
6079 | 36 |
echo "Cannot get latest version of $NAME from \"$SOURCEDIR/LATEST-IS*\"" |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
37 |
else |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
38 |
if [ $LATEST = $CURRENT ]; then |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
39 |
echo "Okay with $NAME-$LATEST" |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
40 |
else if [ -z $PULL_NEW_TARBALLS ]; then |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
41 |
echo "Need to update to $NAME-$LATEST from $CURRENT" |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
42 |
else |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
43 |
# TODO: It may not be bz2! |
6079 | 44 |
# TODO: Use original $SOURCE with %{Version} replaced. |
45 |
SOURCE=$(echo $SOURCE | sed -e "s/\%{*[Vv]ersion}*/${LATEST}/g") |
|
6297
325024482887
* eel.spec eog.spec evolution.spec evolution-data-server.spec
dc144907
parents:
6079
diff
changeset
|
46 |
wget -nv --no-clobber $SOURCE |
5732
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
47 |
if [ $? -eq 0 ]; then |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
48 |
echo "Update $specfile to $LATEST" |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
49 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
50 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
51 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
52 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
53 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
54 |
else |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
55 |
echo "WARNING: $specfile does not exist." |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
56 |
fi |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
57 |
|
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
58 |
shift |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
59 |
done |
bba2b9ac5af9
* scripts/dl-latest-src.sh: Added. Looks for newer ver of source tarball
dc144907
parents:
diff
changeset
|
60 |