/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Diff of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.118 Revision 1.119
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.118 2009/12/09 10:21:49 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.119 2010/07/04 20:42:22 dirtyepic Exp $
4# 4#
5# @ECLASS: x-modular.eclass 5# @ECLASS: x-modular.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org 7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 8# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
496# @DESCRIPTION: 496# @DESCRIPTION:
497# Run X-specific post-removal tasks on the live filesystem. The only 497# Run X-specific post-removal tasks on the live filesystem. The only
498# task right now is some cleanup for font packages. 498# task right now is some cleanup for font packages.
499x-modular_pkg_postrm() { 499x-modular_pkg_postrm() {
500 if [[ -n "${FONT}" ]]; then 500 if [[ -n "${FONT}" ]]; then
501 cleanup_fonts
502 font_pkg_postrm 501 font_pkg_postrm
503 fi 502 fi
504}
505
506# @FUNCTION: cleanup_fonts
507# @USAGE:
508# @DESCRIPTION:
509# Get rid of font directories that only contain generated files
510cleanup_fonts() {
511 local ALLOWED_FILES="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
512 for DIR in ${FONT_DIR}; do
513 unset KEEP_FONTDIR
514 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
515
516 ebegin "Checking ${REAL_DIR} for useless files"
517 pushd ${REAL_DIR} &> /dev/null
518 for FILE in *; do
519 unset MATCH
520 for ALLOWED_FILE in ${ALLOWED_FILES}; do
521 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
522 # If it's allowed, then move on to the next file
523 MATCH="yes"
524 break
525 fi
526 done
527 # If we found a match in allowed files, move on to the next file
528 if [[ -n ${MATCH} ]]; then
529 continue
530 fi
531 # If we get this far, there wasn't a match in the allowed files
532 KEEP_FONTDIR="yes"
533 # We don't need to check more files if we're already keeping it
534 break
535 done
536 popd &> /dev/null
537 # If there are no files worth keeping, then get rid of the dir
538 if [[ -z "${KEEP_FONTDIR}" ]]; then
539 rm -rf ${REAL_DIR}
540 fi
541 eend 0
542 done
543} 503}
544 504
545# @FUNCTION: setup_fonts 505# @FUNCTION: setup_fonts
546# @USAGE: 506# @USAGE:
547# @DESCRIPTION: 507# @DESCRIPTION:

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.119

  ViewVC Help
Powered by ViewVC 1.1.20