Compare commits

...

2 Commits

Author SHA1 Message Date
contradict ca4848b759 Make date condition easier to read. 2021-11-01 11:04:08 -07:00
contradict aec8c665d7 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.
2021-11-01 11:03:19 -07:00
1 changed files with 2 additions and 1 deletions

View File

@ -34,7 +34,8 @@ 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
newer_sources=\$(find /etc/apt -mindepth 1 -cnewer /var/lib/apt/lists)
if [ ! -d /var/lib/apt/lists ] || [ -n "${newer_sources}" ]; then
apt-get $apt_opts update || apt-get $apt_opts update
fi
DONE