File SuSEconfig.xjdic of Package xjdic

#! /bin/sh
# Copyright (c) 2001 SuSE Gmbh Nuernberg, Germany.  All rights reserved.
#
# Author: Mike Fabian <mfabian@suse.de>, 2001

if test "$UID" != 0 -a "$USER" != root; then
    echo "You must be root to start $0."
    exit 1
fi

test -n "$ROOT" && exit 0

EDIR=/usr/share/edict
DICTS="
       4jwords aviation classical compdic compverb concrete ediclsd3 edict edicth 
       enamdict engscidic findic geodic j_places jddict.v02 kanjd212 kanjidic 
       lawgledt lingdic mktdic pandpdic stardict
       gdict wadokujt buddhdic
"

######################################################################
# convert from UTF-8 to EUC-JP

for dict in $DICTS
do
    if [ -f $EDIR/$dict ]; then
        if [ ! -f $EDIR/${dict}-euc -o $EDIR/${dict} -nt $EDIR/${dict}-euc ]; then
        echo converting ${dict} to EUC-JP
	    /usr/bin/xjdic-utf-8-to-euc-jp < $EDIR/${dict} > $EDIR/${dict}-euc
        fi
    fi
done


######################################################################
# generate indices:

if [ -x /usr/bin/xjdxgen ]; then
    PROGRAM=/usr/bin/xjdxgen
else
    if [ -x /opt/gnome/bin/genxjdx ]; then
        PROGRAM=/opt/gnome/bin/genxjdx
    else
        echo "no index generating program found."
        exit 1
    fi
fi

for dict in $DICTS
do
    dict=${dict}-euc
    if [ -f $EDIR/$dict ]; then
        if [ ! -f $EDIR/${dict}.xjdx -o $EDIR/${dict} -nt $EDIR/${dict}.xjdx ]; then
        echo creating ${dict}.xjdx ...
            $PROGRAM $EDIR/${dict} >/dev/null
        fi
    fi
done