#!/bin/sh -e # # 2011 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # # cdist is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # cdist is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with cdist. If not, see . # # There are special arguments to apt(8) to prevent aborts if apt woudn't been # updated after the 19th April 2021 till the bullseye release. The additional # arguments acknoledge the happend suite change (the apt(8) update does the # same by itself). # # Using '-o $config' instead of the --allow-releaseinfo-change-* parameter # allows backward compatablility to pre-buster Debian versions. # # See more: ticket #861 # https://code.ungleich.ch/ungleich-public/cdist/-/issues/861 apt_opts="-o Acquire::AllowReleaseInfoChange::Suite=true -o Acquire::AllowReleaseInfoChange::Version=true" # 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 apt-get $apt_opts update || apt-get $apt_opts update fi DONE