From b6ce0e3b1607acf6f1ee9c430315565786fd9a00 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 9 Dec 2011 10:57:13 +0000 Subject: [PATCH] fix sorting of backups git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@553 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/backup/files.jim | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index afc21e3..29e3f53 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.4 +Version: 0.8.4-1 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp,anacron diff --git a/var/mongoose/cgi-bin/backup/files.jim b/var/mongoose/cgi-bin/backup/files.jim index 3b0a2a0..bc6ab95 100755 --- a/var/mongoose/cgi-bin/backup/files.jim +++ b/var/mongoose/cgi-bin/backup/files.jim @@ -20,7 +20,18 @@ if {![file isdirectory $dir]} { exit } -set backups [glob -nocomplain "$dir/*.rbk"] +proc s_time {a b} { + file stat $a l + set at $l(ctime) + file stat $b l + set bt $l(ctime) + + if {$at < $bt} { return -1 } + if {$at > $bt} { return 1 } + return 0 +} + +set backups [lsort -command s_time [glob -nocomplain "$dir/*.rbk"]] if {![llength $backups]} { empty