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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
#!/bin/sh
#
# Install dict, dictd, and dict-de-en and check that german-english
# and english-german dictionaries are available.
#
# (c) 2018-2020 Roland Rosenfeld <roland@debian.org>
VERSION=$(sed 's/^.*:: //;1q' de-en.txt)
if [ -z "$AUTOPKGTEST_TMP" ]; then
AUTOPKGTEST_TMP=$(mktemp -d)
fi
trap 'rm -rf $AUTOPKGTEST_TMP' EXIT
PORT=2629
DICTDCONF=$AUTOPKGTEST_TMP/dictd.conf
DICTCONF=$AUTOPKGTEST_TMP/dict.conf
DICTDPID=$AUTOPKGTEST_TMP/dictd.pid
cat <<EOF > "$DICTDCONF"
global {
listen_to 127.0.0.1
port $PORT
pid_file $DICTDPID
}
access {
allow localhost
allow 127.0.0.1
}
include /var/lib/dictd/db.list
EOF
cat <<EOF > "$DICTCONF"
server localhost { port $PORT }
EOF
/usr/sbin/dictd -c "$DICTDCONF"
trap 'kill $(cat "$DICTDPID"); rm -rf $AUTOPKGTEST_TMP' EXIT
sleep 1 # wait until dictd is started up
EXIT=0
######################################################################
DICTD=0
OUTPUT=$AUTOPKGTEST_TMP/dict-D.out
dict -c "$DICTCONF" -D > "$OUTPUT"
if ! grep -q "german-english German - English Dictionary $VERSION" "$OUTPUT"
then
echo "missing: german-english German - English Dictionary $VERSION"
EXIT=1
DICTD=1
fi
if ! grep -q "english-german English - German Dictionary $VERSION" "$OUTPUT"
then
echo "missing: english-german English - German Dictionary $VERSION"
EXIT=1
DICTD=1
fi
if [ "$DICTD" = 0 ]
then
echo "PASS: english-german and german-english dictd dictionaries found"
else
echo "found:"
cat "$OUTPUT"
fi
######################################################################
DE_EN=0
OUTPUT=$AUTOPKGTEST_TMP/dict-de-en.out
dict -c "$DICTCONF" -d german-english Straße -C > "$OUTPUT"
if ! grep -q "street" "$OUTPUT"
then
echo "lookup Straße => missing: street"
DE_EN=1
EXIT=1
fi
if ! grep -q "road" "$OUTPUT"
then
echo "lookup Straße => missing: road"
DE_EN=1
EXIT=1
fi
if [ "$DE_EN" = 0 ]
then
echo "PASS: translation from Straße to street/road found"
else
echo "found:"
cat "$OUTPUT"
fi
######################################################################
EN_DE=0
OUTPUT=$AUTOPKGTEST_TMP/dict-de-en.out
dict -c "$DICTCONF" -d english-german bowl -C > "$OUTPUT"
if ! grep -q "Schüssel" "$OUTPUT"
then
echo "lookup bowl => missing: Schüssel"
EN_DE=1
EXIT=1
fi
if ! grep -q "kegeln" "$OUTPUT"
then
echo "lookup bowl => missing: kegeln"
EN_DE=1
EXIT=1
fi
if [ "$EN_DE" = 0 ]
then
echo "PASS: translation from bowl to Schüssel/kegeln found"
else
echo "found:"
cat "$OUTPUT"
fi
######################################################################
exit $EXIT
|