find also takes a code ref directly, and the "wanted" name is a bit
non-ideal anyway, as it has no control over what find "wants" (i.e.,
descends into), but its return value is completely ignored.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
rmtree "$dirname/config/etc/pmg/master";
# remove current config, but keep directories for INotify
- File::Find::find({ wanted => sub {
- if ( ! -d $File::Find::name) {
- unlink($File::Find::name) || die "removing $File::Find::name failed: $!\n";
- }
- }}, '/etc/pmg');
+ File::Find::find(
+ sub {
+ my $file = $File::Find::name;
+ return if -d $file;
+ unlink($file) || die "removing $file failed: $!\n";
+ },
+ '/etc/pmg',
+ );
# copy files
system("cp -a $dirname/config/etc/pmg/* /etc/pmg/") == 0 ||