summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarchey329
1 files changed, 29 insertions, 0 deletions
diff --git a/archey3 b/archey3
index 3fe7436..536fb66 100755
--- a/archey3
+++ b/archey3
@@ -18,6 +18,7 @@ from optparse import OptionParser
from getpass import getuser
from time import ctime, sleep
from os import getenv
+from datetime import datetime
import re
import os.path
import multiprocessing
@@ -509,6 +510,34 @@ class mpdDisplay(display):
return ('{statname} in MPD database'.format(statname=self.stat.title()),
stats[self.stat])
+@module_register("system_upgrade")
+class systemUpgrade(display):
+
+ _upgrade_message = 'starting full system upgrade'
+
+ def render(self):
+ try:
+ datestr = None
+ for line in reversed(list(open('/var/log/pacman.log'))):
+ if line.rstrip().endswith(self._upgrade_message):
+ datestart = line.find('[')
+ dateend = line.find(']')
+ if datestart != -1 and dateend != -1:
+ datestr = line[datestart + 1 : dateend]
+ break
+ except Exception as err:
+ print(err)
+
+ if not datestr:
+ datestr = 'Unknown'
+ else:
+ currenttime = datetime.today()
+ updatetime = datetime.strptime(datestr, '%Y-%m-%d %H:%M')
+ numdays = (currenttime - updatetime).days
+ datestr = '{0} ({1} days ago)'.format(datestr, numdays)
+
+ return "Last Upgrade", datestr
+
#------------ Config -----------
class ArcheyConfigParser(configparser.SafeConfigParser):