Added Gentoo support to keybpard module

This commit is contained in:
shadowfax-chc 2013-01-04 19:51:03 +00:00
parent b83b9a6bf0
commit e8dae7ebac

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