Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6ce0e3b16 | ||
|
|
a189b524ab |
@@ -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
|
||||
|
||||
17
CONTROL/postinst
Executable file
17
CONTROL/postinst
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
# Add anacron jobs
|
||||
|
||||
ana=$PKG_ROOT/etc/anacrontab
|
||||
grep -v 'backup/backup.jim' $ana > $tmpf
|
||||
(
|
||||
cat $tmpf
|
||||
echo "1 30 /mod/var/mongoose/cgi-bin/backup/backup.jim"
|
||||
) > $ana
|
||||
|
||||
$PKG_ROOT/etc/init.d/S02anacron start < /dev/null > /dev/null 2>&1 &
|
||||
|
||||
exit 0
|
||||
|
||||
10
CONTROL/prerm
Executable file
10
CONTROL/prerm
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
export tmpf=/tmp/cronf.$$
|
||||
|
||||
ana=/mod/etc/anacrontab
|
||||
grep -v 'backup/backup.jim' $ana > $tmpf
|
||||
cp $tmpf $ana
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -13,12 +13,23 @@ puts ""
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
if {![dict exists $_cgi file]} {
|
||||
puts "No filename supplied."
|
||||
exit
|
||||
set now [clock seconds]
|
||||
set file [file tail [cgi_get file \
|
||||
[clock format $now -format "auto-%Y-%b-%d-%H:%M"]]]
|
||||
|
||||
if {[string match {auto-*} $file]} {
|
||||
# Delete any automatic backups over 7 days old.
|
||||
set mt $(7 * 3600)
|
||||
foreach af [glob -nocomplain "$dir/auto-*"] {
|
||||
set aft [file mtime $af]
|
||||
set diff $($now - $aft)
|
||||
if {$diff > $mt} {
|
||||
puts "Removing $af"
|
||||
file delete $af
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set file [file tail [dict get $_cgi file]]
|
||||
set ffile "/$dir/$file.rbk"
|
||||
|
||||
if {[file exists $ffile]} {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user