Re: [PATCH 38/48] Bashify locale setting.

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



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 "\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

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 "\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


Attachment: signature.asc
Description: OpenPGP digital signature


[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