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> --- install/consolefont | 42 +++++++++++++++++++++++------------------- install/keymap | 24 ++++++++++++++---------- 2 files changed, 37 insertions(+), 29 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() { diff --git a/install/keymap b/install/keymap index 34b744a..2cf4d15 100644 --- a/install/keymap +++ b/install/keymap @@ -1,18 +1,22 @@ #!/bin/bash build() { - SCRIPT=keymap - eval "$(grep -E "^(LOCALE|KEYMAP)=" /etc/rc.conf)" - if [[ $KEYMAP ]]; then - if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then - printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" - else - printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" - /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + # subshell to avoid namespace pollution + ( + . "$BASEDIR/etc/rc.conf" + if [[ $KEYMAP ]]; then + if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then + printf '%s\n' "UTF8=yes" > "$BUILDROOT/keymap.utf8" + /bin/loadkeys -q -u $KEYMAP -b > "$BUILDROOT/keymap.bin" + else + printf '%s\n' "UTF8=no" > "$BUILDROOT/keymap.utf8" + /bin/loadkeys -q $KEYMAP -b > "$BUILDROOT/keymap.bin" + fi fi - fi + ) + + (( $? == 0 )) && SCRIPT=keymap } help() { -- 1.7.6.4