forked from ungleich-public/cdist
		
	Merge branch 'fix/__package_apt/allow-releaseinfo-change' into 'master'
__package_apt: fix complain about suite change See merge request ungleich-public/cdist!1023
This commit is contained in:
		
				commit
				
					
						433399d4dc
					
				
			
		
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -81,12 +81,24 @@ aptget="DEBIAN_FRONTEND=noninteractive apt-get --quiet --yes -o Dpkg::Options::=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    present)
 | 
					    present)
 | 
				
			||||||
 | 
					        # 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"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # following is bit ugly, but important hack.
 | 
					        # following is bit ugly, but important hack.
 | 
				
			||||||
        # due to how cdist config run works, there isn't
 | 
					        # due to how cdist config run works, there isn't
 | 
				
			||||||
        # currently better way to do it :(
 | 
					        # currently better way to do it :(
 | 
				
			||||||
        cat << EOF
 | 
					        cat << EOF
 | 
				
			||||||
if [ ! -f /var/cache/apt/pkgcache.bin ] || [ "\$( stat --format %Y /var/cache/apt/pkgcache.bin )" -lt "\$( date +%s -d '-1 day' )" ]
 | 
					if [ ! -f /var/cache/apt/pkgcache.bin ] || [ "\$( stat --format %Y /var/cache/apt/pkgcache.bin )" -lt "\$( date +%s -d '-1 day' )" ]
 | 
				
			||||||
then echo apt-get update > /dev/null 2>&1 || true
 | 
					then echo apt-get $apt_opts update > /dev/null 2>&1 || true
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
        if [ -n "$version" ]; then
 | 
					        if [ -n "$version" ]; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue