forked from ungleich-public/cdist
Compare commits
5 commits
master
...
ander/__pa
Author | SHA1 | Date | |
---|---|---|---|
50186d13c9 | |||
4ddbf1e411 | |||
e7d8fb874d | |||
e24165304c | |||
f74a06a257 |
2 changed files with 14 additions and 9 deletions
9
cdist/conf/type/__package_apt/explorer/index
Normal file
9
cdist/conf/type/__package_apt/explorer/index
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
if [ ! -d /var/lib/apt/lists ] \
|
||||||
|
|| [ -n "$( find /etc/apt -newer /var/lib/apt/lists )" ] \
|
||||||
|
|| [ ! -f /var/cache/apt/pkgcache.bin ] \
|
||||||
|
|| [ "$( stat --format %Y /var/cache/apt/pkgcache.bin )" -lt "$( date +%s -d '-1 day' )" ]
|
||||||
|
then
|
||||||
|
echo 'update'
|
||||||
|
fi
|
|
@ -92,15 +92,11 @@ case "$state_should" in
|
||||||
# See more: ticket #861
|
# See more: ticket #861
|
||||||
# https://code.ungleich.ch/ungleich-public/cdist/-/issues/861
|
# https://code.ungleich.ch/ungleich-public/cdist/-/issues/861
|
||||||
apt_opts="-o Acquire::AllowReleaseInfoChange::Suite=true -o Acquire::AllowReleaseInfoChange::Version=true"
|
apt_opts="-o Acquire::AllowReleaseInfoChange::Suite=true -o Acquire::AllowReleaseInfoChange::Version=true"
|
||||||
|
if [ "$(cat "$__object/explorer/index")" = 'update' ]; then
|
||||||
# following is bit ugly, but important hack.
|
# make /var/lib/apt/lists newer because apt-get update might not always do this
|
||||||
# due to how cdist config run works, there isn't
|
echo 'if [ -d /var/lib/apt/lists ]; then touch /var/lib/apt/lists; fi'
|
||||||
# currently better way to do it :(
|
echo "apt-get $apt_opts update || true"
|
||||||
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 $apt_opts update > /dev/null 2>&1 || true
|
|
||||||
fi
|
fi
|
||||||
EOF
|
|
||||||
if [ -n "$version" ]; then
|
if [ -n "$version" ]; then
|
||||||
name="${name}=${version}"
|
name="${name}=${version}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue