diff options
author | Frederic Lepied <flepied@mandriva.com> | 2005-01-19 18:37:54 +0000 |
---|---|---|
committer | Frederic Lepied <flepied@mandriva.com> | 2005-01-19 18:37:54 +0000 |
commit | b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af (patch) | |
tree | efc0e62a2861637761c01ff29342edc838e6d808 /update-indexhtml | |
parent | b32447937ea92ce42fece5eba0c67feab9d1f356 (diff) | |
download | indexhtml-b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af.tar indexhtml-b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af.tar.gz indexhtml-b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af.tar.bz2 indexhtml-b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af.tar.xz indexhtml-b5d4b4e0a1b3cdecdee27d56bd7c376ad72cf2af.zip |
first version
Diffstat (limited to 'update-indexhtml')
-rwxr-xr-x | update-indexhtml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/update-indexhtml b/update-indexhtml new file mode 100755 index 0000000..cce08a4 --- /dev/null +++ b/update-indexhtml @@ -0,0 +1,58 @@ +#!/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 + +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 + cp -pf $docdir/index.html $docdir/index.tmp + for i in $LISTLANG en; do + wget -q -N -O $docdir/index.tmp $URL/index-$i.html && mv -f $docdir/index.tmp $docdir/index.html && exit 0 + lang=`echo $i | cut -b-2` + wget -q -N -O $docdir/index.tmp $URL/index-$lang.html && mv -f $docdir/index.tmp $docdir/index.html && exit 0 + done + rm -f $docdir/index.tmp +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 |