freebsd-ports/chinese/reciteword/pkg-install
Clive Lin 6f9f428439 Add reciteword, an education software to help people to study English.
PR:		ports/73687
Submitted by:	hamigua <hamigua at cuc.cn>
2004-12-09 05:46:51 +00:00

43 lines
850 B
Bash

#!/bin/sh
cvitem()
{
(echo ${PWD_OLD} | ${GREP} -i "$*" 2>&1 > /dev/zero) && exit 0
BUF=$(${DIRNAME} "$*")/$(${BASENAME} "$*" | ${ICONV} -f EUC-CN -t utf-8 )
[ "$*" != "${BUF}" ] && {
${MV} "$*" "${BUF}"
}
}
cvdir()
{
for SUBITEM in "$*"/* ; do
if [ -d "${SUBITEM}" ] ; then
cvdir ${SUBITEM}
else
cvitem ${SUBITEM}
fi
done
cvitem $*
}
[ "$2" = "PRE-INSTALL" ] && exit 0
PREFIX=${PKG_PREFIX}
RECITE_DATADIR=${PREFIX}/share/gnome/reciteword
WORKDIR=${RECITE_DATADIR}/books
GREP=/usr/bin/grep
DIRNAME=/usr/bin/dirname
BASENAME=/usr/bin/basename
MV=/bin/mv
CP=/bin/cp
ICONV=/usr/local/bin/iconv
${CP} -rf ${WORKDIR}.EUC-CN ${WORKDIR}
PWD_OLD=`cd ${WORKDIR} && echo ${PWD}`/
for ITEM in ${WORKDIR} ; do
if [ -d ${ITEM} ] ; then
cvdir ${ITEM}
else
cvitem ${ITEM}
fi
done