Comment 2 for bug 1623125

Revision history for this message
Oliver Grawert (ogra) wrote :

diff -Nru initramfs-tools-0.122ubuntu8.1/debian/changelog initramfs-tools-0.122ubuntu8.1+ppa1/debian/changelog
--- initramfs-tools-0.122ubuntu8.1/debian/changelog 2016-06-06 20:32:03.000000000 +0200
+++ initramfs-tools-0.122ubuntu8.1+ppa1/debian/changelog 2016-09-13 22:35:44.000000000 +0200
@@ -1,3 +1,10 @@
+initramfs-tools (0.122ubuntu8.1+ppa1) xenial; urgency=medium
+
+ * make fixrtc catch "n/a" string and fall back to a sane value for the date
+ command instead (LP: #1623125)
+
+ -- Oliver Grawert <email address hidden> Tue, 13 Sep 2016 22:31:46 +0200
+
 initramfs-tools (0.122ubuntu8.1) xenial; urgency=medium

   * hook-functions: include ehci-msm in auto_add_modules_list
diff -Nru initramfs-tools-0.122ubuntu8.1/scripts/local-premount/fixrtc initramfs-tools-0.122ubuntu8.1+ppa1/scripts/local-premount/fixrtc
--- initramfs-tools-0.122ubuntu8.1/scripts/local-premount/fixrtc 2016-02-03 18:07:11.000000000 +0100
+++ initramfs-tools-0.122ubuntu8.1+ppa1/scripts/local-premount/fixrtc 2016-09-13 22:31:43.000000000 +0200
@@ -96,6 +96,11 @@
         DATE="/bin/date -D%c"
         date -D%c 2>/dev/null || DATE=/bin/date

+ if [ "$MOUNTDATE" = "n/a" ]; then
+ # some versions of mkfs set n/a now, date is not happy with this so
+ # let us use some half way sane epoch instead
+ MOUNTDATE="Fri Jan 1 00:00:00 1999"
+ fi
         TIMESTR=$MOUNTDATE
         TIME=$(${DATE} --utc --date "${TIMESTR}" +%s)