50 |
} |
} |
51 |
|
|
52 |
my $path = ip_path $ip; |
my $path = ip_path $ip; |
53 |
mkdir $path unless -d $path; |
mkdir $path unless -e $path; |
54 |
|
warn "WARNING: $path not directory" unless -d $path; |
55 |
$path .= '/' . $name; |
$path .= '/' . $name; |
56 |
|
|
57 |
if ( defined $value ) { |
if ( defined $value ) { |
81 |
foreach my $file ( glob("$path/*"), glob("$path/*/*") ) { |
foreach my $file ( glob("$path/*"), glob("$path/*/*") ) { |
82 |
my $name = $file; |
my $name = $file; |
83 |
$name =~ s{^$path/+}{} || die "can't remove $path from $name"; |
$name =~ s{^$path/+}{} || die "can't remove $path from $name"; |
84 |
|
next if -d $file; |
85 |
$conf->{ $name } = |
$conf->{ $name } = |
86 |
-l $file ? readlink $file : |
-l $file ? readlink $file : |
87 |
-f $file ? read_file $file : |
-f $file ? read_file $file : |
182 |
sub remove { |
sub remove { |
183 |
my $ip = shift; |
my $ip = shift; |
184 |
if ( my $mac = mac_from_ip $ip ) { |
if ( my $mac = mac_from_ip $ip ) { |
185 |
unlink "$server::conf/mac/$mac"; |
unlink mac_path($mac); |
186 |
} |
} |
187 |
rmtree "$server::conf/ip/$ip"; |
rmtree "$server::conf/ip/$ip"; |
188 |
} |
} |