[oe] [PATCH] init-scripts: fix save-rtc error with date formatting on uclibc

Petr Štetiar ynezz at true.cz
Sun Oct 3 14:54:19 UTC 2010


uClibc's date does support only SUSv3 strptime[1], so the date command in
save-rtc.sh fails with 'date: invalid date '%2m%2d%2H%2M2010'.

1. http://www.opengroup.org/onlinepubs/009695399/functions/strptime.html

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 recipes/initscripts/files/save-rtc-uclibc.sh |    5 +++++
 recipes/initscripts/initscripts_1.0.bb       |   14 ++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 recipes/initscripts/files/save-rtc-uclibc.sh

diff --git a/recipes/initscripts/files/save-rtc-uclibc.sh b/recipes/initscripts/files/save-rtc-uclibc.sh
new file mode 100644
index 0000000..8f4e587
--- /dev/null
+++ b/recipes/initscripts/files/save-rtc-uclibc.sh
@@ -0,0 +1,5 @@
+#! /bin/sh
+/etc/init.d/hwclock.sh stop
+
+# Update the timestamp
+date +%m%d%H%M%Y > /etc/timestamp
diff --git a/recipes/initscripts/initscripts_1.0.bb b/recipes/initscripts/initscripts_1.0.bb
index 8c38d7f..cc60624 100644
--- a/recipes/initscripts/initscripts_1.0.bb
+++ b/recipes/initscripts/initscripts_1.0.bb
@@ -4,7 +4,7 @@ PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS_${PN} = "makedevs"
 LICENSE = "GPL"
-PR = "r123"
+PR = "r124"
 
 SRC_URI = "file://functions \
            file://halt \
@@ -31,7 +31,8 @@ SRC_URI = "file://functions \
            file://device_table.txt \
            file://populate-volatile.sh \
            file://volatiles \
-           file://save-rtc.sh"
+           file://save-rtc.sh \
+           file://save-rtc-uclibc.sh"
 
 SRC_URI_append_arm = " file://alignment.sh"
 
@@ -137,3 +138,12 @@ do_install_append_angstrom () {
 do_install_append_hipox () {
 	ln -sf		../init.d/sysfs.sh	${D}${sysconfdir}/rc6.d/S80sysfs
 }
+
+# uclibc's date does support only SUSv3 strptime()
+do_install_append_linux-uclibc() {
+	install -m 0755    ${WORKDIR}/save-rtc-uclibc.sh ${D}${sysconfdir}/init.d/save-rtc.sh
+}
+
+do_install_append_linux-uclibceabi() {
+	install -m 0755    ${WORKDIR}/save-rtc-uclibc.sh ${D}${sysconfdir}/init.d/save-rtc.sh
+}
-- 
1.7.0.4





More information about the Openembedded-devel mailing list