add post/pre inst to preserve config file. Check for identical files. Fix IE delete

This commit is contained in:
hummypkg 2014-06-13 19:05:10 +00:00
parent d5319e6f0d
commit 5bda49c76d
5 changed files with 30 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Package: sweeper
Priority: optional
Section: misc
Version: 2.0.0
Version: 2.0.1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif(>=1.0.14-10)

7
CONTROL/postinst Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
f=/mod/etc/sweeper.conf
[ ! -f $f ] && [ -f $f~ ] && cp $f~ $f
exit 0

7
CONTROL/preinst Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
f=/mod/etc/sweeper.conf
[ -f $f ] && cp $f $f~
exit 0

View File

@ -69,6 +69,12 @@ proc ::sweeper::strcontains {ref val} {
>= 0]
}
proc ::sweeper::samefile {a b} {
if {![file exists $a] || ![file exists $b]} { return 0 }
if {[file stat $a] eq [file stat $b]} { return 1 }
return 0
}
proc ::sweeper::moveset {ts dst {op rename}} {
set file [$ts get file]
log "${op}set($file) -> $dst" 0
@ -93,6 +99,10 @@ proc ::sweeper::moveset {ts dst {op rename}} {
# successful.
foreach f $fset {
set tail [file tail $f]
if {[::sweeper::samefile $f "$dst/$tail"]} {
log " Destination is same as source." 0
return
}
if {[catch {file copy $f "$dst/$tail"} msg]} {
log " ....... $f: XFS copy failed, $msg." 0
file delete -force "$dst/$tail"
@ -121,6 +131,10 @@ proc ::sweeper::moveset {ts dst {op rename}} {
foreach f $fset {
set tail [file tail $f]
if {[::sweeper::samefile $f "$dst/$tail"]} {
log " Destination is same as source." 0
return
}
if {$op eq "copy" && [file exists "$dst/$tail"]} {
if {[file size "$dst/$tail"] == [file size $f]} {
log " ....... $f: Already copied." 2

View File

@ -232,7 +232,7 @@ var schema = {
desc: 'Unlock recordings',
continues: true
},
delete: {
'delete': {
'class': 'all',
argtype: 'none',
desc: 'Delete recordings',