summaryrefslogtreecommitdiff
path: root/debian/apt.cron.daily
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-09-06 16:35:10 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-09-06 16:35:10 +0000
commitd713e67d4bf668df8024aa9e3fa5875b6f056801 (patch)
treeafc5f703d58adb59424d4f9ae730e3bbd0c200c1 /debian/apt.cron.daily
parent5d4aff08accfd096d50d99a24df1437a2fa41c8d (diff)
parent8e29e348071f5d043e72c86a7c6d38e76a70c5ba (diff)
* cherry-pick a fix from apt--mvo--0 to check the ctime as well when packages are removed (because they are too old)
Patches applied: * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-53 * check ctime as well in cron.daily when cleaning up packages in apt.cron.daily
Diffstat (limited to 'debian/apt.cron.daily')
-rw-r--r--debian/apt.cron.daily14
1 files changed, 10 insertions, 4 deletions
diff --git a/debian/apt.cron.daily b/debian/apt.cron.daily
index 2d93a5ba4..e3aaccfb0 100644
--- a/debian/apt.cron.daily
+++ b/debian/apt.cron.daily
@@ -95,9 +95,9 @@ check_size_constraints()
# check age
if [ ! $MaxAge -eq 0 ] && [ ! $MinAge -eq 0 ]; then
- find $Cache -name "*.deb" -mtime +$MaxAge -and -not -mtime -$MinAge -print0 | xargs -r -0 rm -f
+ find $Cache -name "*.deb" \( -mtime +$MaxAge -and -ctime +$MaxAge \) -and -not \( -mtime -$MinAge -or -ctime -$MinAge \) -print0 | xargs -r -0 rm -f
elif [ ! $MaxAge -eq 0 ]; then
- find $Cache -name "*.deb" -mtime +$MaxAge -print0 | xargs -r -0 rm -f
+ find $Cache -name "*.deb" -ctime +$MaxAge -and -mtime +$MaxAge -print0 | xargs -r -0 rm -f
fi
# check size
@@ -120,8 +120,14 @@ check_size_constraints()
# check for MinAge of the file
if [ ! $MinAge -eq 0 ]; then
- mtime=$(date --date=$(date -r $file --iso-8601) +%s)
- delta=$(($now-$mtime))
+ # check both ctime and mtime
+ mtime=$(date -c %Y $file)
+ ctime=$(stat -c %Z $file)
+ if [ $mtime -gt $ctime ]; then
+ delta=$(($now-$mtime))
+ else
+ delta=$(($now-$ctime))
+ fi
#echo "$file ($delta), $MinAge"
if [ $delta -le $MinAge ]; then
#echo "Skiping $file (delta=$delta)"