#!/bin/sh

# indexhtml-update creates index.html as symlink to index-$lang.htm in $INDEXHTML directory
# at least index-en.html is required
# $lang is taken from: /etc/sysconfig/i18n, $LANG, en

# default indexhtmldir
INDEXHTMLDIR=/usr/share/doc/alt-docs/indexhtml

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

lang=`echo "$LANG" |cut -b-2`
cd $INDEXHTMLDIR

if [ -f index-$lang.html ]; then
  ln -sf "index-$lang.html" "index.html"
elif [ -f index-en.html ]; then
  ln -sf "index-en.html" "index.html"
else
  echo "indexhtml-update: no index.html created. at least "index-en.html" should be present in $INDEXHTMLDIR/"
  exit 1
fi

exit 0

