From 35f8bdcd45cd4a8c00b2ab9b724e3c74238a9f59 Mon Sep 17 00:00:00 2001 From: neingeist Date: Fri, 20 Sep 2019 15:49:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20docker-check-updates:=20support?= =?UTF-8?q?=20alpine=20e.g.=20sh=20+=20no=20dnf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-check-updates | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-check-updates b/docker-check-updates index e3c7396..7b9a0f6 100755 --- a/docker-check-updates +++ b/docker-check-updates @@ -19,9 +19,11 @@ for container in c.containers(): output = subprocess.check_output([ 'docker', 'run', '-t', '--rm', image_id, - '/bin/bash', '-c', + '/bin/sh', '-c', - 'dnf -q check-update;' + - 'if [ $? == 100 ]; then echo "Updates available"; fi' + # Note the semicolons and the string concatenation here! + 'if [ ! -x /usr/bin/dnf ]; then echo "dnf not available"; exit 0; fi;' + + '/usr/bin/dnf -q check-update;' + + 'if [ $? == 100 ]; then echo "Updates available"; fi;' ]) print(output.decode())