busybox: add ts72xx hwclock-default file and modify hwclock.sh
authorPetr Štetiar <ynezz@true.cz>
Tue, 19 Oct 2010 12:04:07 +0000 (12:04 +0000)
committerKhem Raj <raj.khem@gmail.com>
Thu, 21 Oct 2010 01:30:23 +0000 (18:30 -0700)
This patch simplifies the hwclock.sh init script and adds a possibility to
fallback to default RTC device even if the device specified in HWCLOCKDEVICE
doesn't exist.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
recipes/busybox/busybox.inc
recipes/busybox/files/hwclock.sh [changed mode: 0644->0755]
recipes/busybox/files/ts72xx/hwclock-default [new file with mode: 0644]

index 401f6ad..362ab9c 100644 (file)
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r35"
+INC_PR = "r36"
 
 SRC_URI = "\
   file://busybox-cron \
old mode 100644 (file)
new mode 100755 (executable)
index 1bc9de3..b55da2e
 
 [ "$UTC" = yes ] && UTC=-u || UTC=-l
 
+if  [ ! -z "$HWCLOCKDEVICE" ]; then
+       if [ -e $HWCLOCKDEVICE ]; then
+               DEVICE="-f $HWCLOCKDEVICE"
+       fi
+fi
+
 case "$1" in
         start)
                 if [ "$VERBOSE" != no ]
@@ -30,19 +36,9 @@ case "$1" in
                then
                        if [ -z "$TZ" ]
                        then
-                               if [ -z "$HWCLOCKDEVICE" ]
-                               then
-                                       hwclock -s $UTC
-                               else
-                                       hwclock -s $UTC -f $HWCLOCKDEVICE
-                               fi
+                               hwclock -s $UTC $DEVICE
                        else
-                               if [ -z "$HWCLOCKDEVICE" ]
-                               then
-                                       TZ="$TZ" hwclock -s $UTC
-                               else
-                                       TZ="$TZ" hwclock -s $UTC -f $HWCLOCKDEVICE
-                               fi
+                               TZ="$TZ" hwclock -s $UTC $DEVICE
                        fi
                fi
 
@@ -65,12 +61,7 @@ case "$1" in
                fi
                if [ "$HWCLOCKACCESS" != no ]
                then
-                       if [ -z "$HWCLOCKDEVICE" ]
-                       then
-                               hwclock -w $UTC
-                       else
-                               hwclock -w $UTC -f $HWCLOCKDEVICE
-                       fi
+                       hwclock -w $UTC $DEVICE
                fi
                if [ "$VERBOSE" != no ]
                then
@@ -81,12 +72,7 @@ case "$1" in
        show)
                if [ "$HWCLOCKACCESS" != no ]
                then
-                       if [ -z "$HWCLOCKDEVICE" ]
-                       then
-                               hwclock -r $UTC
-                       else
-                               hwclock -r $UTC -f $HWCLOCKDEVICE
-                       fi
+                       hwclock -r $UTC $DEVICE
                fi
                ;;
         *)
diff --git a/recipes/busybox/files/ts72xx/hwclock-default b/recipes/busybox/files/ts72xx/hwclock-default
new file mode 100644 (file)
index 0000000..8ab3fd4
--- /dev/null
@@ -0,0 +1,2 @@
+HWCLOCKACCESS=yes
+HWCLOCKDEVICE=/dev/rtc1