forked from hummypkg/sweeper
add post/pre inst to preserve config file. Check for identical files. Fix IE delete
This commit is contained in:
parent
d5319e6f0d
commit
5bda49c76d
@ -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
7
CONTROL/postinst
Executable 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
7
CONTROL/preinst
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
f=/mod/etc/sweeper.conf
|
||||
[ -f $f ] && cp $f $f~
|
||||
|
||||
exit 0
|
||||
|
@ -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
|
||||
|
@ -232,7 +232,7 @@ var schema = {
|
||||
desc: 'Unlock recordings',
|
||||
continues: true
|
||||
},
|
||||
delete: {
|
||||
'delete': {
|
||||
'class': 'all',
|
||||
argtype: 'none',
|
||||
desc: 'Delete recordings',
|
||||
|
Loading…
Reference in New Issue
Block a user