summaryrefslogtreecommitdiffstats
path: root/install/consolefont
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-11 04:12:23 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-24 00:43:13 +0200
commit7143433a883287b3dc74288e92100f78443f386f (patch)
tree3b207dc256ecf7767262ab38a1d1a70c9f478131 /install/consolefont
parentd8505d4a4b646083ccdc959713951cb8174bbf47 (diff)
downloadmkinitcpio-7143433a883287b3dc74288e92100f78443f386f.tar.gz
mkinitcpio-7143433a883287b3dc74288e92100f78443f386f.tar.xz
keymap/consolefont: source rc.conf properly from $BASEDIR
This is partially in response to FS#24685, which should hopefully cut back on configuration duplication on non-sysvinit systems. This does, however, also fix a bug with keymap/consolefont pulling the wrong rc.conf when BASEDIR is not '/' or unset. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install/consolefont')
-rw-r--r--install/consolefont42
1 files changed, 23 insertions, 19 deletions
diff --git a/install/consolefont b/install/consolefont
index 271fc2f..7110c3c 100644
--- a/install/consolefont
+++ b/install/consolefont
@@ -3,26 +3,30 @@
build() {
local file ext
- eval "$(grep -e "^CONSOLEFONT=" /etc/rc.conf)"
- if [[ -n "$CONSOLEFONT" ]]; then
- for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do
- if [[ -e $file ]]; then
- [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]}
- if [[ $file = *.gz ]]; then
- gzip -cd "$file" > "$BUILDROOT/consolefont.$ext"
- else
- add_file "${file#$BASEDIR}" "/consolefont.$ext"
+ # subshell to avoid namespace pollution
+ (
+ . "$BASEDIR/etc/rc.conf"
+ if [[ -n "$CONSOLEFONT" ]]; then
+ for file in "$BASEDIR/usr/share/kbd/consolefonts/$CONSOLEFONT".psf?(u)?(.gz); do
+ if [[ -e $file ]]; then
+ [[ $file =~ \.(psfu?)(\.gz)?$ ]] && ext=${BASH_REMATCH[1]}
+ if [[ $file = *.gz ]]; then
+ gzip -cd "$file" > "$BUILDROOT/consolefont.$ext"
+ else
+ add_file "${file#$BASEDIR}" "/consolefont.$ext"
+ fi
+ exit 0
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
+ done
+ error "consolefont: requested font not found: \`%s'" "$CONSOLEFONT"
+ exit 1
+ else
+ warning "consolefont: no font found in %s/etc/rc.conf" "${BASEDIR%/}"
+ exit 1
+ fi
+ )
+
+ (( $? == 0 )) && SCRIPT=consolefont
}
help() {