summaryrefslogtreecommitdiff
path: root/scripts/casper-bottom
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/casper-bottom')
-rw-r--r--scripts/casper-bottom/02etc_casper_conf10
-rwxr-xr-xscripts/casper-bottom/14locales20
-rwxr-xr-xscripts/casper-bottom/18hostname4
-rwxr-xr-xscripts/casper-bottom/19keyboard8
4 files changed, 31 insertions, 11 deletions
diff --git a/scripts/casper-bottom/02etc_casper_conf b/scripts/casper-bottom/02etc_casper_conf
index 7c4d08d..9e6deff 100644
--- a/scripts/casper-bottom/02etc_casper_conf
+++ b/scripts/casper-bottom/02etc_casper_conf
@@ -1,6 +1,9 @@
#!/bin/sh
PREREQ=""
+DESCRIPTION="Copying config on real root fs..."
+
+. /scripts/casper-functions
prereqs()
{
@@ -15,13 +18,14 @@ prereqs)
;;
esac
-
+log_begin_msg "$DESCRIPTION"
+
if [ -f /etc/casper.conf ] ; then
if [ ! -z "${CASPERCONF}" ]; then
# Updating casper.conf
sed -i -e 's/\(USERNAME="\).*"/\1'"${USERNAME}"'"/g' \
-e 's/\(USERFULLNAME="\).*"/\1'"${USERFULLNAME}"'"/g' \
- -e 's/\(HOST="\).*"/\1'"${HOST}"'"/g' /etc/casper.conf
+ -e 's/\(HOSTNAME="\).*"/\1'"${HOSTNAME}"'"/g' /etc/casper.conf
fi
cp -p /etc/casper.conf /root/etc/casper.conf
@@ -29,7 +33,7 @@ else
cat <<EOF >/root/etc/casper.conf
export USERNAME="$USERNAME"
export USERFULLNAME="$USERFULLNAME"
-export HOST="$HOST"
+export HOSTNAME="$HOSTNAME"
EOF
fi
diff --git a/scripts/casper-bottom/14locales b/scripts/casper-bottom/14locales
index 5080df6..12cfc4b 100755
--- a/scripts/casper-bottom/14locales
+++ b/scripts/casper-bottom/14locales
@@ -26,7 +26,7 @@ elif [ -e /root/etc/environment ]; then # Old locales policy
grep_file=/root/etc/environment
fi
-if [ ! -z "${grep_file}" ]; then
+if [ -n "${grep_file}" ]; then
locale=$(grep -s 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' )
else
grep_file=/root/etc/default/locale
@@ -45,11 +45,27 @@ if [ -z "${locale}" ]; then
fi
if [ "${set_locale}" ]; then
+ if echo "${locale}" | grep -sqE '^[[:lower:]]{2}$' ; then
+ # input is like "locale=it", so we will convert and setup also the keyboard
+ if [ -z "${KBD}" ]; then
+ # FIXME: look if this keyb is supported
+ KBD="${locale}"
+ fi
+ uploc=$(echo "${locale}" | tr '[a-z]' '[A-Z]')
+ locale="${locale}_${uploc}.UTF-8"
+ fi
LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 |sed -e 's, .*,,' -e q)
- printf 'LANG="%s"\n' "${LANG}" >> "${grep_file}"
+
+ if [ -z "${LANG}" ]; then
+ log_warning_message "Locale ${locale} is unsupported."
+ fi
+
if [ "${BUILD_SYSTEM}" == "Debian" ]; then
+ printf 'LANG=%s\n' "${LANG}" >> "${grep_file}"
+ printf '%s UTF-8\n' "${LANG}" >> /root/etc/locale.gen
chroot /root /usr/sbin/locale-gen
else
+ printf 'LANG="%s"\n' "${LANG}" > "${grep_file}"
chroot /root /usr/sbin/locale-gen "${LANG}"
fi
fi
diff --git a/scripts/casper-bottom/18hostname b/scripts/casper-bottom/18hostname
index 19ac61f..a616488 100755
--- a/scripts/casper-bottom/18hostname
+++ b/scripts/casper-bottom/18hostname
@@ -20,10 +20,10 @@ esac
log_begin_msg "$DESCRIPTION"
-echo "$HOST" > /root/etc/hostname
+echo "$HOSTNAME" > /root/etc/hostname
cat > /root/etc/hosts <<EOF
127.0.0.1 localhost
-127.0.1.1 $HOST
+127.0.1.1 $HOSTNAME
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
diff --git a/scripts/casper-bottom/19keyboard b/scripts/casper-bottom/19keyboard
index 7acc4e4..81cce72 100755
--- a/scripts/casper-bottom/19keyboard
+++ b/scripts/casper-bottom/19keyboard
@@ -26,16 +26,16 @@ csvariant=
csmodel=
# commandline
-if [ ! -z "${KBD}" ]; then
+if [ -n "${KBD}" ]; then
kbd="${KBD}"
fi
-if [ ! -z "${CSLAYOUT}" ]; then
+if [ -n "${CSLAYOUT}" ]; then
cslayout="${CSLAYOUT}"
fi
-if [ ! -z "${CSVARIANT}" ]; then
+if [ -n "${CSVARIANT}" ]; then
csvariant="${CSVARIANT}"
fi
-if [ ! -z "${CSMODEL}" ]; then
+if [ -n "${CSMODEL}" ]; then
csmodel="${CSMODEL}"
fi