aboutsummaryrefslogtreecommitdiffstats
path: root/hook
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-09-07 13:56:36 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-09-07 13:56:36 +0200
commit97f275d5ce49de6ef9d6541ba31a4eeebc90697b (patch)
tree14006985ceafd78b9dfd3e2a96da8f8727697513 /hook
parent5e3f0394cab7ddb09f5da4298eabdd7c720be718 (diff)
downloadmkinitcpio-chkeymap-97f275d5ce49de6ef9d6541ba31a4eeebc90697b.tar.gz
mkinitcpio-chkeymap-97f275d5ce49de6ef9d6541ba31a4eeebc90697b.tar.zst
only update configuration if valid settings are available
Diffstat (limited to 'hook')
-rw-r--r--hook/chkeymap20
1 files changed, 13 insertions, 7 deletions
diff --git a/hook/chkeymap b/hook/chkeymap
index 0fde5ac..d1cdeb9 100644
--- a/hook/chkeymap
+++ b/hook/chkeymap
@@ -8,18 +8,24 @@ run_latehook() {
echo -n "Please give keymap to use: "
read keymap
fi
- msg ":: Setting keymap for main system to '${keymap}'..."
- sed -i "/^KEYMAP=/c KEYMAP=${keymap}" "${newroot}/etc/vconsole.conf"
- sed -i "/XkbLayout/c Option \"XkbLayout\" \"${keymap}\"" "${newroot}/etc/X11/xorg.conf.d/00-keyboard.conf"
+ if [[ -n "${keymap}" ]]; then
+ msg ":: Setting keymap for main system to '${keymap}'..."
+ sed -i "/^KEYMAP=/c KEYMAP=${keymap}" \
+ "${newroot}/etc/vconsole.conf"
+ sed -i "/XkbLayout/c Option \"XkbLayout\" \"${keymap}\"" \
+ "${newroot}/etc/X11/xorg.conf.d/00-keyboard.conf"
+ fi
if [[ "${timezone}" = "interactive" ]]; then
echo
echo -n "Please give timezone to use: "
read timezone
fi
- if [[ -z "${timezone}" ]] || [[ ! -e "${newroot}/usr/share/zoneinfo/${timezone}" ]]; then
- timezone="UTC"
+ if [[ -n "${timezone}" ]]; then
+ if [[ ! -e "${newroot}/usr/share/zoneinfo/${timezone}" ]]; then
+ timezone="UTC"
+ fi
+ msg ":: Setting timezone for main system to '${timezone}'..."
+ ln -sf "/usr/share/zoneinfo/${timezone}" "${newroot}/etc/localtime"
fi
- msg ":: Setting timezone for main system to '${timezone}'..."
- ln -sf "/usr/share/zoneinfo/${timezone}" "${newroot}/etc/localtime"
}