[PATCH 38/48] Bashify locale setting.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



---
 rc.sysinit |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 5842a57..c6ed35f 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -303,12 +303,12 @@ status "Updating Module Dependencies" /sbin/depmod -A
 : >| /etc/profile.d/locale.sh
 /bin/chmod 755 /etc/profile.d/locale.sh
 # Set user defined locale
-[ -z "$LOCALE" ] && LOCALE="en_US"
+[[ $LOCALE ]] || LOCALE="en_US"
 stat_busy "Setting Locale: $LOCALE"
 echo "export LANG=$LOCALE" >>/etc/profile.d/locale.sh
 stat_done
 
-if echo "$LOCALE" | /bin/grep -qi utf ; then
+if [[ $LOCALE =~ utf|UTF ]]; then
 	stat_busy "Setting Consoles to UTF-8 mode"
 	# UTF-8 consoles are default since 2.6.24 kernel
 	# this code is needed not only for older kernels,
@@ -318,9 +318,11 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then
 		printf "\033%%G" > ${i}
 	done
 	# the $CONSOLE check helps us avoid this when running scripts from cron
-	echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%G"; fi' >>/etc/profile.d/locale.sh
+	cat <<"EOF" >>/etc/profile.d/locale.sh
+if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%G"; fi
+EOF
 	stat_done
-	[ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u $KEYMAP
+	[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q -u "$KEYMAP"
 else
 	stat_busy "Setting Consoles to legacy mode"
 	# make non-UTF-8 consoles work on 2.6.24 and newer kernels
@@ -329,9 +331,11 @@ else
 		printf "\033%%@" > ${i}
 	done
 	# the $CONSOLE check helps us avoid this when running scripts from cron
-	echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%@"; fi' >>/etc/profile.d/locale.sh
+	cat <<"EOF" >>/etc/profile.d/locale.sh
+if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "\033%%@"; fi
+EOF
 	stat_done
-	[ -n "$KEYMAP" ] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
+	[[ $KEYMAP ]] && status "Loading Keyboard Map: $KEYMAP" /bin/loadkeys -q $KEYMAP
 fi
 
 # Set console font if required
-- 
1.7.1



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux