diff options
author | jmmv <jmmv@pkgsrc.org> | 2010-04-23 12:47:14 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2010-04-23 12:47:14 +0000 |
commit | 7d9b037b039bff5ef359ad34878d43a4db18e774 (patch) | |
tree | 8fcd6b161251acf63e6b406ad69015ae0a659d43 /mk/pkginstall | |
parent | 0015240af045efa4ff1d3be69c7edce71654d94d (diff) | |
download | pkgsrc-7d9b037b039bff5ef359ad34878d43a4db18e774.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/fonts | 15 |
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 |