Merge branch '__package_apt_updates_index' into 'master'
__package_apt: update index cache, on installation, when it is older than one day See merge request ungleich-public/cdist!842
This commit is contained in:
		
				commit
				
					
						c8dbd0718e
					
				
			
		
					 2 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -74,6 +74,14 @@ fi
 | 
			
		|||
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    present)
 | 
			
		||||
        # following is bit ugly, but important hack.
 | 
			
		||||
        # due to how cdist config run works, there isn't
 | 
			
		||||
        # currently better way to do it :(
 | 
			
		||||
        cat << EOF
 | 
			
		||||
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
 | 
			
		||||
fi
 | 
			
		||||
EOF
 | 
			
		||||
        if [ -n "$version" ]; then
 | 
			
		||||
            name="${name}=${version}"
 | 
			
		||||
        fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,9 @@ DESCRIPTION
 | 
			
		|||
apt-get is usually used on Debian and variants (like Ubuntu) to
 | 
			
		||||
manage packages.
 | 
			
		||||
 | 
			
		||||
This type will also update package index, if it is older
 | 
			
		||||
than one day, to avoid missing package error messages.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue