# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.118 2009/12/09 10:21:49 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.119 2010/07/04 20:42:22 dirtyepic Exp $
#
# @ECLASS: x-modular.eclass
# @MAINTAINER:
# task right now is some cleanup for font packages.
x-modular_pkg_postrm() {
if [[ -n "${FONT}" ]]; then
- cleanup_fonts
font_pkg_postrm
fi
}
-# @FUNCTION: cleanup_fonts
-# @USAGE:
-# @DESCRIPTION:
-# Get rid of font directories that only contain generated files
-cleanup_fonts() {
- local ALLOWED_FILES="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
- for DIR in ${FONT_DIR}; do
- unset KEEP_FONTDIR
- REAL_DIR=${ROOT}usr/share/fonts/${DIR}
-
- ebegin "Checking ${REAL_DIR} for useless files"
- pushd ${REAL_DIR} &> /dev/null
- for FILE in *; do
- unset MATCH
- for ALLOWED_FILE in ${ALLOWED_FILES}; do
- if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
- # If it's allowed, then move on to the next file
- MATCH="yes"
- break
- fi
- done
- # If we found a match in allowed files, move on to the next file
- if [[ -n ${MATCH} ]]; then
- continue
- fi
- # If we get this far, there wasn't a match in the allowed files
- KEEP_FONTDIR="yes"
- # We don't need to check more files if we're already keeping it
- break
- done
- popd &> /dev/null
- # If there are no files worth keeping, then get rid of the dir
- if [[ -z "${KEEP_FONTDIR}" ]]; then
- rm -rf ${REAL_DIR}
- fi
- eend 0
- done
-}
-
# @FUNCTION: setup_fonts
# @USAGE:
# @DESCRIPTION:
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.4 2010/06/08 20:22:12 remi Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.5 2010/07/04 20:42:22 dirtyepic Exp $
#
# @ECLASS: xorg-2.eclass
# @MAINTAINER:
# task right now is some cleanup for font packages.
xorg-2_pkg_postrm() {
if [[ -n ${FONT} ]]; then
- cleanup_fonts
font_pkg_postrm
fi
}
-# @FUNCTION: cleanup_fonts
-# @USAGE:
-# @DESCRIPTION:
-# Get rid of font directories that only contain generated files
-cleanup_fonts() {
- local allowed_files="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
- local real_dir=${EROOT}usr/share/fonts/${FONT_DIR}
- local fle allowed_file
-
- unset KEEP_FONTDIR
-
- einfo "Checking ${real_dir} for useless files"
- pushd ${real_dir} &> /dev/null
- for fle in *; do
- unset MATCH
- for allowed_file in ${allowed_files}; do
- if [[ ${fle} = ${allowed_file} ]]; then
- # If it's allowed, then move on to the next file
- MATCH="yes"
- break
- fi
- done
- # If we found a match in allowed files, move on to the next file
- [[ -n ${MATCH} ]] && continue
- # If we get this far, there wasn't a match in the allowed files
- KEEP_FONTDIR="yes"
- # We don't need to check more files if we're already keeping it
- break
- done
- popd &> /dev/null
- # If there are no files worth keeping, then get rid of the dir
- [[ -z "${KEEP_FONTDIR}" ]] && rm -rf ${real_dir}
-}
-
# @FUNCTION: setup_fonts
# @USAGE:
# @DESCRIPTION: