Merge pull request #3152 from shadowfax-chc/keymap

Added Gentoo support to keyboard module
This commit is contained in:
Joseph Hall 2013-01-04 12:40:22 -08:00
commit 69580572e9

View File

@ -36,6 +36,8 @@ def get_sys():
cmd = 'grep LAYOUT /etc/sysconfig/keyboard | grep -vE "^#"'
elif 'Debian' in __grains__['os_family']:
cmd = 'grep XKBLAYOUT /etc/default/keyboard | grep -vE "^#"'
elif 'Gentoo' in __grains__['os_family']:
cmd = 'grep "^keymap" /etc/conf.d/keymaps | grep -vE "^#"'
out = __salt__['cmd.run'](cmd).split('=')
ret = out[1].replace('"', '')
return ret
@ -55,6 +57,8 @@ def set_sys(layout):
__salt__['file.sed']('/etc/sysconfig/keyboard', '^LAYOUT=.*', 'LAYOUT={0}'.format(layout))
elif 'Debian' in __grains__['os_family']:
__salt__['file.sed']('/etc/default/keyboard', '^XKBLAYOUT=.*', 'XKBLAYOUT={0}'.format(layout))
elif 'Gentoo' in __grains__['os_family']:
__salt__['file.sed']('/etc/conf.d/keymaps', '^keymap=.*', 'keymap={0}'.format(layout))
return layout