Commit 1eb02f90 authored by Darko Poljak's avatar Darko Poljak

Merge branch 'fix/__package_update_index' into 'master'

[__package_update_index] Fix maxage false-positives on brand-new installations

See merge request !858
parents b25939cd 358e04b2
Pipeline #1178 passed with stage
in 1 minute and 28 seconds
......@@ -24,18 +24,18 @@ case "$type" in
if [ -f "/var/cache/apt/pkgcache.bin" ]; then
echo $(($(date +"%s")-$(stat --format '%Y' /var/cache/apt/pkgcache.bin)))
else
echo 0
echo -1
fi
;;
pacman)
if [ -d "/var/lib/pacman/sync" ]; then
echo $(($(date +"%s")-$(stat --format '%Y' /var/lib/pacman/sync)))
else
echo 0
echo -1
fi
;;
alpine)
echo 0
echo -1
;;
*) echo "Your specified type ($type) is currently not supported." >&2
echo "Please contribute an implementation for it if you can." >&2
......
......@@ -31,7 +31,8 @@ if [ -n "$maxage" ]; then
if [ "$type" != "apt" ] && [ "$type" != "pacman" ]; then
echo "ERROR: \"--maxage\" only supported for \"apt\" or \"pacman\" pkg-manager." >&2
exit 1
elif [ "$currage" -lt "$maxage" ]; then
# do not exit if no value found (represented as -1)
elif [ "$currage" -ne -1 ] && [ "$currage" -lt "$maxage" ]; then
exit 0 # no need to update
fi
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment