summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmmv <jmmv@pkgsrc.org>2010-04-23 12:47:14 +0000
committerjmmv <jmmv@pkgsrc.org>2010-04-23 12:47:14 +0000
commit704827e074f30ceaea09e55f6dcc27a23fac3817 (patch)
tree8fcd6b161251acf63e6b406ad69015ae0a659d43
parent8ca14b6dd2651cc1cd0988c156f0cc29ebd072d0 (diff)
downloadpkgsrc-704827e074f30ceaea09e55f6dcc27a23fac3817.tar.gz
pkgsrc now deletes empty directories automatically. Fix the fonts
deinstallation script to follow this convention and purge empty directories when there are no fonts left (and after their database has been removed).
-rw-r--r--mk/pkginstall/fonts15
1 files changed, 12 insertions, 3 deletions
diff --git a/mk/pkginstall/fonts b/mk/pkginstall/fonts
index 76b676711b5..0a3639f4791 100644
--- a/mk/pkginstall/fonts
+++ b/mk/pkginstall/fonts
@@ -1,4 +1,4 @@
-# $NetBSD: fonts,v 1.5 2007/07/12 19:41:46 jlam Exp $
+# $NetBSD: fonts,v 1.6 2010/04/23 12:47:14 jmmv Exp $
#
# Generate a +FONTS script that updates font databases for the package.
#
@@ -31,6 +31,7 @@ GREP="@GREP@"
MKFONTDIR="@MKFONTDIR@"
PWD_CMD="@PWD_CMD@"
RM="@RM@"
+RMDIR="@RMDIR@"
SED="@SED@"
SORT="@SORT@"
TEST="@TEST@"
@@ -92,9 +93,17 @@ while read dir font_type; do
#
# Remove fonts databases if there are no fonts in the directory.
# We filter out the encodings.dir, fonts.{dirs,scale}, and
- # Fontmap database files from the directory listing.
+ # Fontmap database files from the directory listing. Also remove
+ # the directory if it turns out to be empty.
#
- ${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\.scale" | ${GREP} -v "/fonts\.dir" | ${GREP} -v "/Fontmap" >/dev/null || ${RM} -f fonts.dir fonts.scale Fontmap* encodings.dir > /dev/null
+ if ${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\.scale" | \
+ ${GREP} -v "/fonts\.dir" | ${GREP} -v "/Fontmap" >/dev/null
+ then
+ : # Directory not empty; do nothing.
+ else
+ ${RM} -f fonts.dir fonts.scale Fontmap* encodings.dir
+ ${RMDIR} -p $dir 2>/dev/null
+ fi
)
done