aboutsummaryrefslogtreecommitdiffstats
path: root/japanese/kanji18
diff options
context:
space:
mode:
authorsf <sf@FreeBSD.org>2004-11-10 06:20:56 +0800
committersf <sf@FreeBSD.org>2004-11-10 06:20:56 +0800
commit14b547e3de2f6851d333fe2e31107de2d4cf9b3a (patch)
tree5483b146b3793ca739fc3828a67c43359edd2890 /japanese/kanji18
parent06855431d1d61faee601240b8204b479fa5c35c3 (diff)
downloadfreebsd-ports-gnome-14b547e3de2f6851d333fe2e31107de2d4cf9b3a.tar.gz
freebsd-ports-gnome-14b547e3de2f6851d333fe2e31107de2d4cf9b3a.tar.zst
freebsd-ports-gnome-14b547e3de2f6851d333fe2e31107de2d4cf9b3a.zip
replace time-consuming grep -v with awk.
in example, deinstalling time of ja-shinonome is 332x faster than before.
Diffstat (limited to 'japanese/kanji18')
-rw-r--r--japanese/kanji18/pkg-req8
1 files changed, 6 insertions, 2 deletions
diff --git a/japanese/kanji18/pkg-req b/japanese/kanji18/pkg-req
index c9dab0d38cba..e43ec5265a30 100644
--- a/japanese/kanji18/pkg-req
+++ b/japanese/kanji18/pkg-req
@@ -19,6 +19,10 @@ if [ "$2x" = "INSTALLx" -a ! -d ${FONTDIR} ]; then
mkdir ${FONTDIR}
fi
+grepv() {
+ awk -v SRC=$1 'BEGIN{while (getline < SRC) {ENTRY[$0]=1}} (ENTRY[$0] != 1) {print}' $2
+}
+
# font alias entry here!
TMPFILE=/tmp/install-fonts-alias-$$
cat << EOF > ${TMPFILE}
@@ -45,10 +49,10 @@ cd ${FONTDIR}
touch fonts.alias
cp fonts.alias fonts.alias.orig
if [ "$2" = "INSTALL" ] ; then
- (grep -v -e "`cat ${TMPFILE}`" fonts.alias.orig ; \
+ (grepv ${TMPFILE} fonts.alias.orig ; \
cat ${TMPFILE}) > fonts.alias
elif [ "$2" = "DEINSTALL" ] ; then
- grep -v -- "`cat ${TMPFILE}`" fonts.alias.orig > fonts.alias
+ grepv ${TMPFILE} fonts.alias.orig > fonts.alias
fi
rm -f fonts.alias.orig ${TMPFILE}