[SCM] live-config branch, debian, updated. debian/2.0_a1-1-6-gda517f4
Daniel Baumann
daniel at debian.org
Thu May 27 20:43:57 UTC 2010
The following commit has been merged in the debian branch:
commit 79f8a4c5eca01fd1a019421c9a3e795815e938d6
Author: Daniel Baumann <daniel at debian.org>
Date: Mon May 24 19:19:26 2010 +0200
Adding locales config script.
diff --git a/scripts/config.sh b/scripts/config.sh
index 833156b..28ef61d 100755
--- a/scripts/config.sh
+++ b/scripts/config.sh
@@ -45,6 +45,11 @@ Cmdline ()
USER_FULLNAME="${PARAMETER#live-config.user-fullname=}"
;;
+ # 005-locales
+ live-config.locales=*)
+ LOCALES="${PARAMETER#live-config.locales=}"
+ ;;
+
# 999-hook
live-config.hook=*)
HOOK="${PARAMETER#live-config.hook=}"
diff --git a/scripts/config/004-locales b/scripts/config/004-locales
new file mode 100755
index 0000000..1d9810c
--- /dev/null
+++ b/scripts/config/004-locales
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+Locales ()
+{
+ # Checking if package is installed
+ if [ ! -e /var/lib/dpkg/info/locales.list ]
+ then
+ return
+ fi
+
+ echo -n " locales"
+
+ Configure_locales
+}
+
+Configure_locales ()
+{
+ if [ -e /etc/default/locale ]
+ then
+ # use rootfs configured locale
+ LOCALE="$(grep -s 'LANG=' /etc/default/locale | sed s/'LANG='// | tr -d '"' )"
+ fi
+
+ if [ -n "${LOCALES}" ]
+ then
+ LOCALE="${LOCALES}"
+ SET_LOCALE="true"
+ fi
+
+ if [ -z "${LOCALE}" ]
+ then
+ # Set a default one
+ LOCALE="en_US.UTF-8"
+ SET_LOCALE="true"
+ fi
+
+ LANGUAGE="$(echo $locale | cut -d. -f1)"
+ export LANGUAGE
+
+ if [ -z "${SET_LOCALE}" ]
+ then
+ # Actually, we should check here if the locale is generated
+ return
+ fi
+
+ if echo "${LOCALE}" | grep -sqE '^[[:lower:]]{2}$'
+ then
+ # input is like "locale=it", so we will convert and setup also the keyboard if not already set
+ if [ -z "${KBD}" ]
+ then
+ # FIXME: look if this keyb is supported
+ KBD="${LOCALE}"
+ export KBD
+ fi
+
+ LOCALE_UP=$(echo "${LOCALE}" | tr '[a-z]' '[A-Z]')
+ LOCALE="${LOCALE}_${LOCALE_UP}.UTF-8"
+ fi
+
+ LANG=
+ LANGUAGE="$(echo ${LOCALE} | cut -d. -f1)"
+ eval $(awk '/^'"${LOCALE}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /usr/share/i18n/SUPPORTED)
+
+ if [ -z "${LANG}" ]
+ then
+ # Try and fallback to another codepage for this language.
+ eval $(awk '/^'"${LANGUAGE}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /usr/share/i18n/SUPPORTED)
+
+ if [ -n "${LANG}" ]
+ then
+ echo "Choosing locale '${LANG}' as '${LOCALE}' is unsupported."
+ fi
+ fi
+
+ if [ -z "${LANG}" ]
+ then
+ echo "Locale '${LOCALE}' is unsupported."
+ CODEPAGE="UTF-8"
+ LANGUAGE="en_US"
+ LOCALE="${LANGUAGE}.${CODEPAGE}"
+ LANG="${LANGUAGE}.${CODEPAGE}"
+ fi
+
+ printf 'LANG="%s"\n' "${LANG}" > /etc/default/locale
+ sed -i -e "s|# ${LANG} ${CODEPAGE}|${LANG} ${CODEPAGE}|" /etc/locale.gen
+
+ locale-gen --keep-existing > /dev/null 2>&1
+}
+
+Locales
diff --git a/scripts/config/007-kdm b/scripts/config/007-kdm
index b225fdc..992a595 100755
--- a/scripts/config/007-kdm
+++ b/scripts/config/007-kdm
@@ -18,17 +18,35 @@ Configure_kdm ()
if [ -e /etc/kde4/kdm/kdmrc ]
then
# squeeze
+
+ # autologin
sed -i -r -e "s|^#?AutoLoginEnable=.*\$|AutoLoginEnable=true|" \
-e "s|^#?AutoLoginAgain=.*\$|AutoLoginAgain=true|" \
-e "s|^#?AutoLoginUser=.*\$|AutoLoginUser=${USERNAME}|" \
/etc/kde4/kdm/kdmrc
+
+ # language
+ if [ -n "${LANGUAGE}" ]
+ then
+ sed -i -r -e "s|^#?Language=.*\$|Language=${LANGUAGE}|" \
+ /etc/kde4/kdm/kdmrc
+ fi
elif [ -e /etc/kde3/kdm/kdmrc ]
then
# lenny
+
+ # autologin
sed -i -r -e "s|^#?AutoLoginEnable=.*\$|AutoLoginEnable=true|" \
-e "s|^#?AutoLoginAgain=.*\$|AutoLoginAgain=true|" \
-e "s|^#?AutoLoginUser=.*\$|AutoLoginUser=${USERNAME}|" \
/etc/kde3/kdm/kdmrc
+
+ # language
+ if [ -n "${LANGUAGE}" ]
+ then
+ sed -i -r -e "s|^#?Language=.*\$|Language=${LANGUAGE}|" \
+ /etc/kde3/kdm/kdmrc
+ fi
fi
}
--
live-config
More information about the debian-live-changes
mailing list