FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-30-2010, 09:47 PM
Victor Lowther
 
Default Bashify locale setting.

---
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 "33%%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 "33%%G"; fi' >>/etc/profile.d/locale.sh
+ cat <<"EOF" >>/etc/profile.d/locale.sh
+if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "33%%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 "33%%@" > ${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 "33%%@"; fi' >>/etc/profile.d/locale.sh
+ cat <<"EOF" >>/etc/profile.d/locale.sh
+if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "33%%@"; 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
 
Old 07-16-2010, 12:03 PM
Thomas Bächler
 
Default Bashify locale setting.

This patch should be split into two:

Am 30.06.2010 23:47, schrieb Victor Lowther:
> 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,

Simple bashification.

> @@ -318,9 +318,11 @@ if echo "$LOCALE" | /bin/grep -qi utf ; then
> printf "33%%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 "33%%G"; fi' >>/etc/profile.d/locale.sh
> + cat <<"EOF" >>/etc/profile.d/locale.sh
> +if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "33%%G"; fi
> +EOF

This has nothing to do with bashification, this is a readability
improvement. Same applies below. Either merge the bashifications into
the "big one" and apply the readability changes separately, or leave it
like this, but adjust the commit message.

Same applies below.

> 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 "33%%@" > ${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 "33%%@"; fi' >>/etc/profile.d/locale.sh
> + cat <<"EOF" >>/etc/profile.d/locale.sh
> +if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then printf "33%%@"; 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
 

Thread Tools




All times are GMT. The time now is 07:27 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org