webif/var/mongoose/cgi-bin/backup/delete.jim
hummypkg d7284ff3ef 0.9.9
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1016 2a923420-c742-0410-a762-8d5b09965624
2012-05-21 20:23:41 +00:00

32 lines
593 B
Plaintext
Executable File

#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
set dir /mod/var/backup
puts "Content-Type: text/html"
puts "Pragma: no-cache"
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
puts ""
cgi_input
#cgi_dump
if {![dict exists $_cgi restore_file]} {
puts "No filename supplied."
exit
}
set file [file tail [dict get $_cgi restore_file]]
set ffile "/$dir/$file.rbk"
if {![file exists $ffile]} {
puts "Backup file <i>$file</i> does not exist."
} elseif {[catch { file delete $ffile } msg]} {
puts "Deletion failed: $msg"
} else {
puts "Successfully deleted <i>$file</i>"
}