# License: This file is licensed under the GPL v2.
################################################################################
-PN="$(basename $0)"
+PN="$(basename "$0")"
DIALOG=dialog
-CMDLINE=/proc/cmdline
LANGFUNC=/etc/grml/language-functions
# notice: Debian's locales.postinst has been modified to write
# so modifying it was a policy violation.
CONFFILE=/etc/default/locale
+# shellcheck disable=SC1091
+{
. /etc/grml/script-functions
. /etc/grml/lsb-functions
+}
check4root || exit 100
sed -i "s#^${1}.*#${1}${2}#" $CONFFILE
# is the new Debian style /etc/default/locale present?
elif grep -q "^# ${1}$" "$CONFFILE" ; then
+ # shellcheck disable=SC1117
sed -i "s#^\# ${1}#${1}${2}#" $CONFFILE
else
echo "$1${2}" >> $CONFFILE
fi
fi
+# shellcheck disable=SC1091
+{
[ -r /etc/environment ] && . /etc/environment
[ -r /etc/default/locale ] && . /etc/default/locale
+}
[ -n "$LANGUAGE" ] && DEFAULT_LANGUAGE="$LANGUAGE"
if [ -z "$DEFAULT_LANGUAGE" ] ; then
fi
if [ -z "$NONINTERACTIVE" ] ; then
+# shellcheck disable=SC1010
+{
LANGUAGE=$(LANG=C $DIALOG --stdout --title "$PN" --default-item $DEFAULT_LANGUAGE --radiolist \
"Which language do you want to use?
us 'american (unicode version)' off \
us-iso 'american (iso version)' off \
)
+}
retval=$?
case $retval in
# fallback to C if using an ISO system (which is latin1 for LC_CTYPE);
# this should prevent users from broken ctype settings if the set
# locale isn't available on a remote system
-if echo $LANGUAGE | grep -q -- '-iso' ; then
+if echo "$LANGUAGE" | grep -q -- '-iso' ; then
LC_CTYPE=C
-else
- LC_CTYPE=en_US.UTF-8
fi
# read in the file where all the $LANGUAGE stuff is defined
- . $LANGFUNC
+# shellcheck disable=SC1090
+. $LANGFUNC
# make sure the file exists
if ! [ -r $CONFFILE ] ; then
cat > $CONFFILE <<EOF
# File generated by $PN on $(date)
LANG=$LANG
-LC_CTYPE=$LC_CTYPE
+# LC_CTYPE=$LC_CTYPE
# LANGUAGE=$LANGUAGE
# TZ=$TZ
# other environment variables you might want to set:
EOF
fi
-setvalue 'LANG=' $LANG
-setvalue 'LC_CTYPE=' $LC_CTYPE
+setvalue 'LANG=' "$LANG"
retval=$?
case $retval in