upgrades: Handle upgrade interval other than 1 day properly

- We must assume that apart from Plinth there will be user or user-agent
  changes to the configuration files.  In this case the value may be set
  something other than '1' day.
This commit is contained in:
Sunil Mohan Adapa 2015-02-10 14:46:37 +05:30 committed by James Valleroy
parent d33e60c74a
commit 82fbbe1fec

View File

@ -73,7 +73,13 @@ def subcommand_check_auto(_):
arguments = ['apt-config', 'shell', 'UpdateInterval',
'APT::Periodic::Update-Package-Lists']
output = subprocess.check_output(arguments).decode()
print(bool(output and "1" in output))
update_interval = 0
match = re.match(r"UpdateInterval='(.*)'", output)
if match:
update_interval = int(match.group(1))
print(bool(update_interval))
def subcommand_enable_auto(_):