On Sat, Sep 5, 2009 at 11:00:54 +0700, Theppitak Karoonboonyanan wrote: > Index: xfonts-utils-7.4+2.1/debian/local/update-fonts-alias > =================================================================== > --- xfonts-utils-7.4+2.1.orig/debian/local/update-fonts-alias 2009-09-02 > 22:11:23.000000000 +0700 > +++ xfonts-utils-7.4+2.1/debian/local/update-fonts-alias 2009-09-05 > 10:09:11.000000000 +0700 > @@ -43,7 +43,7 @@ > message "usage error: $*" > fi > cat <<EOF > -Usage: $PROGNAME DIRECTORY ... > +Usage: $PROGNAME [OPTIONS] DIRECTORY ... > $PROGNAME { -h | --help } > This program combines X font alias information from several packages into a > single file that is placed in each specified X font directory DIRECTORY. > This > @@ -51,35 +51,68 @@ > update-fonts-alias(8) for more information. > Options: > -h, --help display this usage message and exit > + -i, --include ALIAS-FILE drop ALIAS-FILE from exlude list if any > + -x, --exclude ALIAS-FILE add ALIAS-FILE to exclude list > EOF > } > > X11R7_LAYOUT= > - > -# Validate arguments. > -case "$1" in > - -h|--help) > - usage > - exit 0 > - ;; > - -7|--x11r7-layout) > - X11R7_LAYOUT=true > - shift > - ;; > -esac > - > -case "$1" in > - -*) > - usage "unrecognized option" >&2 > - exit 2 > - ;; > -esac > +INCLUDE_ALIAS= > +EXCLUDE_ALIAS= > +EXCLUDE_CONF=/etc/fonts/excluded-aliases
Should this one be somewhere in /etc/X11 instead? /etc/fonts has the fontconfig stuff, I'd rather not hijack it. [...] > > +# Remove aliases to be included from exclude list > +for f in $INCLUDE_ALIAS; do > + sed -i "\\,$f,d" $EXCLUDE_CONF > +done > +# Add aliases to be excluded to exclude list > +for f in $EXCLUDE_ALIAS; do > + sed -i "\\,$f,d" $EXCLUDE_CONF > + echo "$f" >> $EXCLUDE_CONF > +done > + If possible, I think it'd be better if we didn't modify a configuration file. Can we keep this file for the admin (read-only for update-fonts-alias), and have something under /var/lib/ for package bookkeeping? (that's assuming we do need a config file for this; if not, we can just move the exclude list to /var/lib/xfonts) ... and now I wonder if the foo.alias files really need to stay in /etc, or if we can move them somewhere else where they'll be removed with the corresponding package. oh well... In any case the sed regexps should be anchored here. > while [ -n "$1" ]; do > # Try to be clever about the argument; were we given an absolute path? > if expr "$1" : "/.*" >/dev/null 2>&1; then > @@ -129,30 +162,33 @@ > continue > fi > > - # Are there any files to process? > - if [ "$(echo "$ETCDIR"/*.alias "$ETC7DIR"/*.alias)" != "$ETCDIR/*.alias > $ETC7DIR/*.alias" ] > - then > - if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then > - # Write the new alias file in a temporary location in case we are > - # interrupted. > - cat >"$X11R7DIR/fonts.alias.update-new" <<EOF > + if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then > + # Write the new alias file in a temporary location in case we are > + # interrupted. > + cat >"$X11R7DIR/fonts.alias.update-new" <<EOF > !! fonts.alias -- automatically generated file. DO NOT EDIT. > !! To modify, see update-fonts-alias(8). > EOF > - for FILE in "$ETCDIR"/*.alias "$ETC7DIR"/*.alias; do > - [ -e "$FILE" ] || continue > - echo "!! $FILE" >>"$X11R7DIR/fonts.alias.update-new" > - cat "$FILE" >>"$X11R7DIR/fonts.alias.update-new" > - done > - mv "$X11R7DIR/fonts.alias.update-new" "$X11R7DIR/fonts.alias" > - fi > - else > - if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then > - # There are no files to process; remove any alias file already in > - # the font directory. > - rm -f "$X11R7DIR/fonts.alias" > - # Remove the font directory if it is empty. > - rmdir "$X11R7DIR" >/dev/null 2>&1 || true > + has_data=0 > + for FILE in "$ETCDIR"/*.alias "$ETC7DIR"/*.alias; do > + [ -e "$FILE" ] || continue > + > + # Skip excluded aliases > + grep -v '^!!' /etc/fonts/excluded-aliases | grep $FILE > >/dev/null 2>&1 && continue grep -q ^"$FILE"$ $EXCLUDE_CONF && continue > + > + echo "!! $FILE" >>"$X11R7DIR/fonts.alias.update-new" > + cat "$FILE" >>"$X11R7DIR/fonts.alias.update-new" > + has_data=1 > + done > + if [ $has_data -eq 1 ]; then > + mv "$X11R7DIR/fonts.alias.update-new" "$X11R7DIR/fonts.alias" > + else > + rm -f "$X11R7DIR/fonts.alias.update-new" > + # There are no files to process; remove any alias file already in > + # the font directory. > + rm -f "$X11R7DIR/fonts.alias" > + # Remove the font directory if it is empty. > + rmdir "$X11R7DIR" >/dev/null 2>&1 || true > fi > fi > done Cheers, Julien -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org