summaryrefslogtreecommitdiff
path: root/mk/pkginstall
diff options
context:
space:
mode:
authorjmmv <jmmv>2010-04-23 12:47:14 +0000
committerjmmv <jmmv>2010-04-23 12:47:14 +0000
commitb052ce6e4002df6064f79e8bd4777070b0f6130b (patch)
tree8fcd6b161251acf63e6b406ad69015ae0a659d43 /mk/pkginstall
parent2325b036364438d156214618e69f42e916277d9d (diff)
downloadpkgsrc-b052ce6e4002df6064f79e8bd4777070b0f6130b.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).
Diffstat (limited to 'mk/pkginstall')
-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