/[gentoo-x86]/eclass/xorg-2.eclass
Gentoo

Diff of /eclass/xorg-2.eclass

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

Revision 1.4 Revision 1.5
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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/xorg-2.eclass,v 1.4 2010/06/08 20:22:12 remi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.5 2010/07/04 20:42:22 dirtyepic Exp $
4# 4#
5# @ECLASS: xorg-2.eclass 5# @ECLASS: xorg-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# x11@gentoo.org 7# x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 8# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
355# @DESCRIPTION: 355# @DESCRIPTION:
356# Run X-specific post-removal tasks on the live filesystem. The only 356# Run X-specific post-removal tasks on the live filesystem. The only
357# task right now is some cleanup for font packages. 357# task right now is some cleanup for font packages.
358xorg-2_pkg_postrm() { 358xorg-2_pkg_postrm() {
359 if [[ -n ${FONT} ]]; then 359 if [[ -n ${FONT} ]]; then
360 cleanup_fonts
361 font_pkg_postrm 360 font_pkg_postrm
362 fi 361 fi
363}
364
365# @FUNCTION: cleanup_fonts
366# @USAGE:
367# @DESCRIPTION:
368# Get rid of font directories that only contain generated files
369cleanup_fonts() {
370 local allowed_files="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
371 local real_dir=${EROOT}usr/share/fonts/${FONT_DIR}
372 local fle allowed_file
373
374 unset KEEP_FONTDIR
375
376 einfo "Checking ${real_dir} for useless files"
377 pushd ${real_dir} &> /dev/null
378 for fle in *; do
379 unset MATCH
380 for allowed_file in ${allowed_files}; do
381 if [[ ${fle} = ${allowed_file} ]]; then
382 # If it's allowed, then move on to the next file
383 MATCH="yes"
384 break
385 fi
386 done
387 # If we found a match in allowed files, move on to the next file
388 [[ -n ${MATCH} ]] && continue
389 # If we get this far, there wasn't a match in the allowed files
390 KEEP_FONTDIR="yes"
391 # We don't need to check more files if we're already keeping it
392 break
393 done
394 popd &> /dev/null
395 # If there are no files worth keeping, then get rid of the dir
396 [[ -z "${KEEP_FONTDIR}" ]] && rm -rf ${real_dir}
397} 362}
398 363
399# @FUNCTION: setup_fonts 364# @FUNCTION: setup_fonts
400# @USAGE: 365# @USAGE:
401# @DESCRIPTION: 366# @DESCRIPTION:

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20