From 6a1f73c2b51e83381350806b72f1937b6a5ceaaf Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Thu, 19 Jul 2018 18:51:55 -0700 Subject: [PATCH] Run apt-get update before installing if required --- tljh/apt.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tljh/apt.py b/tljh/apt.py index b155124..49be946 100644 --- a/tljh/apt.py +++ b/tljh/apt.py @@ -39,6 +39,9 @@ def install_packages(packages): """ Install debian packages """ + # Check if an apt-get update is required + if len(os.listdir('/var/lib/apt/lists')) == 0: + subprocess.check_output(['apt-get', 'update', '--yes']) subprocess.check_output([ 'apt-get', 'install',