~ubuntu-branches/ubuntu/natty/kadu/natty

« back to all changes in this revision

Viewing changes to varia/scripts/autodownload-source

  • Committer: Package Import Robot
  • Author(s): Kiszel Kristóf
  • Date: 2010-07-21 15:24:54 UTC
  • mfrom: (0.6.1) (0.5.1) (1.4.1) (22.1.2 maverick)
  • Revision ID: package-import@ubuntu.com-20100721152454-vttqle18lovfudni
Tags: 0.6.5.4.ds1-3ubuntu2
Remove libqt4-webkit-dev from build-depends and add
libqtwebkit-dev for qtwebkit transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
if test $# -lt 2; then
 
4
        echo
 
5
        echo "Prints source adress of Kadu module, icon theme, sound theme or other."
 
6
        echo "Usage: $0 <item_type> <item_names>"
 
7
        echo
 
8
        exit 1
 
9
fi
 
10
 
 
11
if test -f ../VERSION; then
 
12
        KADU_VERSION=`cat ../VERSION`
 
13
elif test -f ../../VERSION; then
 
14
        KADU_VERSION=`cat ../../VERSION`
 
15
else
 
16
        KADU_VERSION=`cat ../../../VERSION`
 
17
fi
 
18
 
 
19
KADU_VERSION=`echo $KADU_VERSION | sed s/-.*//`
 
20
 
 
21
type=$1
 
22
shift
 
23
 
 
24
KADU_VERSIONS="$3 $4 $5 $6 $7 $8"
 
25
# calculate the list of previous kadu versions
 
26
# will be used to try downloading modules for older releases
 
27
# when href for current release does not exist
 
28
if [ ${#KADU_VERSIONS} -ne 0 ]; then
 
29
        if [ ${#KADU_VERSION} == 7 ]; then
 
30
                MINOR=${KADU_VERSION:6:1}
 
31
                MAJOR=${KADU_VERSION:0:5}
 
32
                while [ $MINOR -gt 1 ]; do
 
33
                        MINOR=`expr $MINOR - 1`
 
34
                        KADU_VERSIONS+=" $MAJOR.$MINOR"
 
35
                done
 
36
        fi
 
37
fi
 
38
 
 
39
function autodownload()
 
40
{
 
41
        if [ ! -f $1.web ]; then
 
42
                return;
 
43
        fi
 
44
 
 
45
        ITEM_WEBSITES=`cat $1.web`
 
46
        if [ -z "$ITEM_WEBSITES" ]; then
 
47
                echo -e "\033[31m!!!\033[0m ERROR: Homepage for $1 $2 is unknown"
 
48
#               echo
 
49
                exit 1
 
50
        fi
 
51
 
 
52
        ITEM_HREFS=
 
53
        for ITEM_WEBSITE in $ITEM_WEBSITES; do
 
54
                if wget -q -T 20 -t 2 -N $ITEM_WEBSITE/kadu-$KADU_VERSION-$1.href; then
 
55
                        ITEM_HREFS=`cat kadu-$KADU_VERSION-$1.href`
 
56
                        break           
 
57
                fi
 
58
        done
 
59
 
 
60
        if test -z "$ITEM_HREFS"; then
 
61
                #downloading packages for other versions of Kadu
 
62
                if [ ${#KADU_VERSIONS} -ne 0 ]; then
 
63
                        for VER in $KADU_VERSIONS; do
 
64
                                for ITEM_WEBSITE in $ITEM_WEBSITES; do
 
65
                                        if wget -q -T 20 -t 2 -N $ITEM_WEBSITE/kadu-$VER-$1.href; then
 
66
                                                ITEM_HREFS=`cat kadu-$VER-$1.href`
 
67
                                                break
 
68
                                        fi
 
69
                                done
 
70
                                if ! test -z "$ITEM_HREFS"; then
 
71
                                        break
 
72
                                fi
 
73
                        done
 
74
                fi
 
75
 
 
76
                if test -z "$ITEM_HREFS"; then
 
77
                        echo -e "\033[31m!!!\033[0m ERROR: Downloading of $1 $2 href-file failed"
 
78
#                       echo
 
79
                        exit 1
 
80
                fi
 
81
        fi
 
82
 
 
83
#       echo
 
84
        echo -e "$ITEM_HREFS"
 
85
#       echo
 
86
 
 
87
        rm -rf $1
 
88
}
 
89
 
 
90
for name in $*;
 
91
do
 
92
        autodownload `basename $name .web` $type
 
93
done