| 1 |
#! /bin/sh |
| 2 |
# postinst script for mecab-@basename@ |
| 3 |
# |
| 4 |
# see: dh_installdeb(1) |
| 5 |
|
| 6 |
set -e |
| 7 |
|
| 8 |
srcdir=/usr/share/mecab/dic/ipadic |
| 9 |
dstdir=/var/lib/mecab/dic/@basename@ |
| 10 |
encoding=@encoding@ |
| 11 |
|
| 12 |
case "$1" in |
| 13 |
configure) |
| 14 |
echo "Compiling IPA dictionary for Mecab. This takes long time..." |
| 15 |
/usr/lib/mecab/mecab-dict-index -d ${srcdir} -o ${dstdir} -f EUC-JP -t ${encoding} |
| 16 |
test -f ${dstdir}/dicrc && rm ${dstdir}/dicrc |
| 17 |
if [ ${encoding} = 'EUC-JP' ]; then |
| 18 |
ln -s ${srcdir}/dicrc ${dstdir}/dicrc |
| 19 |
priority=70 |
| 20 |
else |
| 21 |
sed "s,EUC-JP,${encoding},g" ${srcdir}/dicrc > ${dstdir}/dicrc |
| 22 |
priority=80 |
| 23 |
fi |
| 24 |
update-alternatives --install /var/lib/mecab/dic/debian mecab-dictionary ${dstdir} ${priority} |
| 25 |
;; |
| 26 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 27 |
;; |
| 28 |
*) |
| 29 |
echo "postinst called with unknown argument \`$1'" >&2 |
| 30 |
exit 1 |
| 31 |
;; |
| 32 |
esac |
| 33 |
|
| 34 |
# dh_installdeb will replace this with shell code automatically |
| 35 |
# generated by other debhelper scripts. |
| 36 |
|
| 37 |
#DEBHELPER# |
| 38 |
|
| 39 |
exit 0 |