PKGBUILDs/extra/words/words.install
2009-10-09 21:23:22 -05:00

67 lines
1.6 KiB
Text

post_install() {
# grab the first part of LANG
#
echo "==> Determining which 'words' file to use in /usr/share/dict"
ins_lchk=`/usr/bin/locale | /bin/grep ^LANG | /bin/sed -e 's/LANG=//' | /bin/awk -F. '{ print $1 }'`
# array of 'words' files
#
ins_langs=(british catalan finnish french german italian ngerman spanish usa)
# default to usa-english (index 9)
#
case "${ins_lchk}" in
en_GB|gb|british)
ins_indx=1
;;
ca_ES|ca|catalan)
ins_indx=2
;;
fi_FI|fi|finnish)
ins_indx=3
;;
fr_BE|fr_CA|fr_CH|fr_FR|fr_LU|fr|french)
ins_indx=4
;;
# neri tells me that ngerman should be the default
#
# de_XX)
# ins_indx=5
# ;;
it_CH|it_IT|it|italian)
ins_indx=6
;;
de_AT|de_BE|de_CH|de_DE|de_LU|de|deutsch)
ins_indx=7
;;
es_AR|es_BO|es_CL|es_CO|es_CR|es_DO|es_EC|es_ES|es_GT|es_HN|es_MX|es_NI|es_PA|es_PE|es_PR|es_PY|es_SV|es_US|es_UY|es_VE|es|spanish)
ins_indx=8
;;
en_AU|en_BW|en_CA|en_DK|en_HK|en_IE|en_IN|en_NZ|en_PH|en_SG|en_US|en_ZA|en_ZW|en|english|POSIX|C)
ins_indx=9
;;
*)
echo "==> Unable to determine locale, defaulting to American English"
ins_indx=9
;;
esac
ins_i=1
for ins_lang in ${ins_langs[@]}
do
if [ $ins_i -eq $ins_indx ]; then
pushd /usr/share/dict > /dev/null 2>&1
echo "==> Setting 'words' link to /usr/share/dict/$ins_lang"
/bin/rm -f words
/bin/ln -s ./$ins_lang words
popd > /dev/null 2>&1
fi
ins_i=`expr $ins_i + 1`
done
unset ins_lchk ins_i ins_indx ins_lang ins_langs
}
post_upgrade() {
post_install $1
}