From aec8c665d77aa5401d6c8d1188b6a6408a1a0a93 Mon Sep 17 00:00:00 2001 From: contradict Date: Sat, 30 Oct 2021 16:03:25 -0700 Subject: [PATCH] Handle missing apt lists On a newly imaged system, /var/lib/apt/lists may not exist. Check for this case before comparing dates to the sources. --- cdist/conf/type/__apt_update_index/gencode-remote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__apt_update_index/gencode-remote b/cdist/conf/type/__apt_update_index/gencode-remote index 2d7f9030..77970f2c 100755 --- a/cdist/conf/type/__apt_update_index/gencode-remote +++ b/cdist/conf/type/__apt_update_index/gencode-remote @@ -34,7 +34,7 @@ apt_opts="-o Acquire::AllowReleaseInfoChange::Suite=true -o Acquire::AllowReleas # run 'apt-get update' if anything in /etc/apt is newer then /var/lib/apt/lists # it will be run a second time on error as a redundancy messure to success cat << DONE -if find /etc/apt -mindepth 1 -cnewer /var/lib/apt/lists | grep . > /dev/null; then +if [ ! -d /var/lib/apt/lists ] || { find /etc/apt -mindepth 1 -cnewer /var/lib/apt/lists | grep . > /dev/null; }; then apt-get $apt_opts update || apt-get $apt_opts update fi DONE