Script to guess Red Hat machine's build date.
authorIain Patterson <me@iain.cx>
Mon, 27 Jan 2014 14:31:17 +0000 (14:31 +0000)
committerIain Patterson <me@iain.cx>
Mon, 27 Jan 2014 14:51:13 +0000 (14:51 +0000)
Querying RPM for the installation date of the basesystem package should
provide a decent approximation of the date the machine was (re)built.

opt/Linux/bin/redhat_build_date [new file with mode: 0755]

diff --git a/opt/Linux/bin/redhat_build_date b/opt/Linux/bin/redhat_build_date
new file mode 100755 (executable)
index 0000000..aa234b4
--- /dev/null
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+use POSIX qw(strftime);
+my $date = `rpm -q --queryformat='%{INSTALLTIME}\n' basesystem`;
+printf strftime("%Y-%m-%d\n", localtime $date);