summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhiunhan Mamut (aka V3n3RiX) <venerix@rogentos.ro>2016-03-18 19:36:37 +0000
committerGhiunhan Mamut (aka V3n3RiX) <venerix@rogentos.ro>2016-03-18 19:36:37 +0000
commit45d6fb705520a7ea915f31f750d75eaf24e6b552 (patch)
tree5154c0bb8a527d2605a315397c504edde9c72e79
parent8f1616f093e759aee34ae5b8c80c1559e77c9530 (diff)
parent9c1f33c81fb3cb233d59b2dac0f72d089c7f20ab (diff)
Merge branch 'master' into 'master'
add locale switching add locale switching in lives-scripts, primary form kindly review See merge request !1
-rwxr-xr-xkogaionlive.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/kogaionlive.sh b/kogaionlive.sh
index 7550e4a..aa97526 100755
--- a/kogaionlive.sh
+++ b/kogaionlive.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
export local liveuser="kogaion"
+CMDLINE=$(cat /proc/cmdline 2> /dev/null)
checkroot () {
if [[ "$(whoami)" != root ]] ; then
@@ -25,8 +26,36 @@ kogaion_live_user_password () {
/usr/bin/passwd --delete "$liveuser" > /dev/null 2>&1
}
+kogaion_locale_switch () {
+ local lang_toset=
+ local keymap_toset=
+ local k_env_update=false
+ for boot_param in ${CMDLINE}; do
+ case ${boot_param} in
+ rd.locale.LANG=*)
+ lang_toset="${boot_param/*=}"
+ ;;
+ vconsole.keymap=*)
+ keymap_toset="${boot_param/*=}"
+ ;;
+ esac
+ done
+ if [[ "${lang_toset}" != "en_US.utf8" ]] ; then
+ localectl set-locale LANG=${lang_toset} > /dev/null 2>&1
+ k_env_update=true
+ fi
+ if [[ "${lang_toset}" != "us" ]] ; then
+ localectl set-keymap ${keymap_toset} > /dev/null 2>&1
+ fi
+ if [ k_env_update ] ; then
+ /usr/sbin/env-update --no-ldconfig > /dev/null 2>&1
+ fi
+}
+
+
main () {
if checkroot ; then
+ kogaion_locale_switch
kogaion_add_live_user
kogaion_live_user_groups
kogaion_live_user_password