[arch-projects] [PATCH 01/13] install/consolefont: cleanup and refactor

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sat Jul 23 08:51:50 EDT 2011


Kurt J. Bosch, 2011-07-23 14:43:
> Dave Reisner, 2011-07-23 02:21:
>> * Provide support for uncompressed font files as well as compressed
>> * Avoiding using an unnecessary temp file
>> * Support $BASEDIR
>> * Warn when no font is found
>> * Only add the runtime hook if a font is added
>>
>> Signed-off-by: Dave Reisner<dreisner at archlinux.org>
>> ---
>> install/consolefont | 52 ++++++++++++++++++++++++++------------------------
>> 1 files changed, 27 insertions(+), 25 deletions(-)
>>
>> diff --git a/install/consolefont b/install/consolefont
>> index 395387b..a0a5088 100644
>> --- a/install/consolefont
>> +++ b/install/consolefont
>> @@ -1,32 +1,34 @@
>> -# vim: set ft=sh:
>> +#!/bin/bash
>> +
>> +build() {
>> + local file ext
>>
>> -build()
>> -{
>> - MODULES=""
>> - BINARIES=""
>> - FILES=""
>> - SCRIPT="consolefont"
>> eval "$(grep -e "^CONSOLEFONT=" /etc/rc.conf)"
>> - if [ -n "$CONSOLEFONT" ]; then
>> - if [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz ]; then
>> - CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz"
>> - CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)"
>> - zcat ${CONSOLEFONT_FILE_GZ}> ${CONSOLEFONT_FILE}
>> - add_file ${CONSOLEFONT_FILE} /consolefont.psfu
>> - elif [ -e /usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz ]; then
>> - CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psf.gz"
>> - CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psf.XXXXXX)"
>> - zcat ${CONSOLEFONT_FILE_GZ}> ${CONSOLEFONT_FILE}
>> - add_file ${CONSOLEFONT_FILE} /consolefont.psf
>> - else
>> - echo "consolefont: Font file does not exist or does not end with .psf.gz or .psfu.gz."
>> - fi
>> + if [[ -n "$CONSOLEFONT" ]]; then
>> + for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do
> bash: syntax error near unexpected token `('
> Fix:
> for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf{,u}.gz; do
Or maybe even that was intended:
             for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT"{,.psf,.psfu}.gz; do

>
>> + if [[ -e $file ]]; then
>> + [[ $file =~ psfu? ]]&& ext=${BASH_REMATCH[0]}
>> + if [[ $file = *.gz ]]; then
>> + gzip -cd "$file"> "$BUILDROOT/consolefont.$ext"
>> + else
>> + add_file "${file#$BASEDIR}" "/consolefont.$ext"
>> + fi
>> + SCRIPT=consolefont
>> + return 0
>> + fi
>> + done
>> + error "consolefont: requested font not found: \`%s'" "$CONSOLEFONT"
>> + return 1
>> + else
>> + warning "consolefont: no font found in %s/etc/rc.conf" "${BASEDIR%/}"
>> + return 1
>> fi
>> }
>>
>> -help ()
>> -{
>> -cat<<HELPEOF
>> - This hook loads consolefont specified in rc.conf during early userspace.
>> +help() {
>> + cat<<HELPEOF
>> +This hook loads consolefont specified in rc.conf during early userspace.
>> HELPEOF
>> }
>> +
>> +# vim: set ft=sh ts=4 sw=4 et:
>
>


-- 
Kurt


More information about the arch-projects mailing list