[arch-projects] [initscripts] [PATCH 02/13] Simplify timezone copying

Tom Gundersen teg at jklm.no
Fri Jun 24 05:35:12 EDT 2011


On Fri, Jun 24, 2011 at 11:14 AM, Kurt J. Bosch
<kjb-temp-2009 at alpenjodel.de> wrote:
> ---
>  rc.shutdown |    5 ++---
>  rc.sysinit  |    5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> index 637974f..4014df2 100755
> --- a/rc.shutdown
> +++ b/rc.shutdown
> @@ -35,10 +35,9 @@ fi
>  dd if=/dev/urandom of=$RANDOM_SEED count=1 bs=$POOL_SIZE &> /dev/null
>  stat_done
>
> -if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
> -       rm -f /etc/localtime
> +if [[ $TIMEZONE ]]; then
>        status "Saving Time Zone" \
> -               cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
> +               cp --remove-destination "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
>  fi
>
>  # Write to wtmp file before unmounting
> diff --git a/rc.sysinit b/rc.sysinit
> index e4c1c36..6c1fef9 100755
> --- a/rc.sysinit
> +++ b/rc.sysinit
> @@ -238,10 +238,9 @@ fi
>
>  status "Activating Swap" swapon -a
>
> -if [[ $TIMEZONE && -e /usr/share/zoneinfo/$TIMEZONE ]]; then
> -       rm -f /etc/localtime
> +if [[ $TIMEZONE ]]; then
>        status "Configuring Time Zone" \
> -               cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
> +               cp --remove-destination "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
>  fi
>
>  RANDOM_SEED=/var/lib/misc/random-seed
> --
> 1.7.1
>
>

Could you add a comment in the commit message saying what happens when
$TIMEZONE is empty or invalid? I haven't tried your code, but if it
does nothing (no error messages either) in the mentioned cases, then
it looks good.

-t


More information about the arch-projects mailing list