[arch-general] [PATCH 38/48] Bashify locale setting.

Thomas Bächler thomas at archlinux.org
Fri Jul 16 08:03:51 EDT 2010


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20100716/df4a68e8/attachment.bin>


More information about the arch-general mailing list