From 3e9de2a05aae39a912447a321628ba19cb02176a Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Tue, 11 Nov 2014 14:59:30 +0100 Subject: [PATCH] keyboard: Allow absolute paths for the xOrgConfFileName setting. This should ensure it works on all distributions. --- src/modules/keyboard/SetKeyboardLayoutJob.cpp | 31 +++++++++++++------ src/modules/keyboard/keyboard.conf | 5 +-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/modules/keyboard/SetKeyboardLayoutJob.cpp b/src/modules/keyboard/SetKeyboardLayoutJob.cpp index 1160759d1..162b97f54 100644 --- a/src/modules/keyboard/SetKeyboardLayoutJob.cpp +++ b/src/modules/keyboard/SetKeyboardLayoutJob.cpp @@ -30,6 +30,7 @@ #include "utils/CalamaresUtilsSystem.h" #include +#include #include #include #include @@ -245,19 +246,31 @@ SetKeyboardLayoutJob::exec() QString vconsoleConfPath = destDir.absoluteFilePath( "etc/vconsole.conf" ); // Get the path to the destination's /etc/X11/xorg.conf.d/00-keyboard.conf - QString xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" ); - destDir.mkpath( xorgConfDPath ); - QString keyboardConfPath = QDir( xorgConfDPath ) + QString xorgConfDPath; + QString keyboardConfPath; + if ( QDir::isAbsolutePath( m_xOrgConfFileName ) ) + { + keyboardConfPath = m_xOrgConfFileName; + while ( keyboardConfPath.startsWith( '/' ) ) + keyboardConfPath.remove( 0, 1 ); + keyboardConfPath = destDir.absoluteFilePath( keyboardConfPath ); + xorgConfDPath = QFileInfo( keyboardConfPath ).path(); + } + else + { + xorgConfDPath = destDir.absoluteFilePath( "etc/X11/xorg.conf.d" ); + keyboardConfPath = QDir( xorgConfDPath ) .absoluteFilePath( m_xOrgConfFileName ); + } + destDir.mkpath( xorgConfDPath ); // Get the path to the destination's path to the converted key mappings - QString convertedKeymapPath; - QString convertedKeymapPathSetting = m_convertedKeymapPath; - if ( !convertedKeymapPathSetting.isEmpty() ) + QString convertedKeymapPath = m_convertedKeymapPath; + if ( !convertedKeymapPath.isEmpty() ) { - while ( convertedKeymapPathSetting.startsWith( '/' ) ) - convertedKeymapPathSetting.remove( 0, 1 ); - convertedKeymapPath = destDir.absoluteFilePath( convertedKeymapPathSetting ); + while ( convertedKeymapPath.startsWith( '/' ) ) + convertedKeymapPath.remove( 0, 1 ); + convertedKeymapPath = destDir.absoluteFilePath( convertedKeymapPath ); } if ( !writeVConsoleData( vconsoleConfPath, convertedKeymapPath ) ) diff --git a/src/modules/keyboard/keyboard.conf b/src/modules/keyboard/keyboard.conf index 244639bd3..a2606b94e 100644 --- a/src/modules/keyboard/keyboard.conf +++ b/src/modules/keyboard/keyboard.conf @@ -1,7 +1,8 @@ --- -# The name of the file to write to /etc/X11/xorg.conf.d +# The name of the file to write X11 keyboard settings to # The default value is the name used by upstream systemd-localed. -xOrgConfFileName: "00-keyboard.conf" +# Relative paths are assumed to be relative to /etc/X11/xorg.conf.d +xOrgConfFileName: "/etc/X11/xorg.conf.d/00-keyboard.conf" # The path to search for keymaps converted from X11 to kbd format # Leave this empty if the setting does not make sense on your distribution. convertedKeymapPath: "/lib/kbd/keymaps/xkb"