summaryrefslogtreecommitdiffstats
path: root/update-indexhtml
blob: db485a32b4f5f2d99adde29492525b64acd90d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#---------------------------------------------------------------
# Project         : Mandrakelinux
# Module          : indexhtml
# File            : update-indexhtml
# Version         : $Id$
# Author          : Frederic Lepied
# Created On      : Wed Jan 19 16:48:08 2005
# Purpose         : create the index.html file which is opened
#                 by default by the web browsers.
#---------------------------------------------------------------

datadir=/usr/share
idxdir=$datadir/mdk/indexhtml
docdir=$datadir/doc/HTML

[ -d $idxdir ] || exit 1
[ -d $docdir ] || exit 1

function get() {
    wget -q -N -O $docdir/index.tmp $1 && \
	tar jxf $docdir/index.tmp -C $docdir && exit 0
}

if [ -r /etc/sysconfig/i18n ] ; then
    . /etc/sysconfig/i18n
    if [ -n "$LANGUAGE" ]; then
        LISTLANG="`echo $LANGUAGE | tr ':' ' '`" ;
    else
        if [ -n "$LANG" ]; then
            LISTLANG="$LANG"
        fi
    fi
fi

(
if [ "$1" != nonetwork ] && /sbin/ip route | grep -q default; then
    URL=http://www.mandrakelinux.com/dist/10.2
    if [ -r /etc/profile.d/proxy.sh ]; then
	. /etc/profile.d/proxy.sh
    fi
    for i in $LISTLANG; do
	get $URL/index-$i.tar.bz2
	
        lang=`echo $i | cut -b-2`
	if [ "$lang" != "$i" ]; then
	    get $URL/index-$lang.tar.bz2
	fi
    done
fi

for i in $LISTLANG en; do
    if [ -r $idxdir/index-$i.html ]; then
        cp -pf $idxdir/index-$i.html $docdir/index.html
        break
    else
        lang=`echo $i | cut -b-2`
        if [ -r $idxdir/index-$lang.html ]; then
            cp -pf $idxdir/index-$lang.html $docdir/index.html
            break;
        fi
    fi
done
) &

# update-indexhtml ends here