if (my $fd2 = IO::File->new("/proc/net/dev", "r")) {
while (defined ($line = <$fd2>)) {
- if ($line =~ m/^\s*(eth[0-9]):.*/) {
+ if ($line =~ m/^\s*(eth\d+):.*/) {
$ifaces->{$1}->{exists} = 1;
}
}
$ifaces->{$1}->{exists} = 0;
$d->{exists} = 0;
}
- } elsif ($iface =~ m/^eth[0-9]$/) {
+ } elsif ($iface =~ m/^eth\d+$/) {
$d->{type} = 'eth';
} elsif ($iface =~ m/^lo$/) {
$d->{type} = 'loopback';
\&read_etc_network_interfaces,
\&write_etc_network_interfaces);
+
+sub read_iscsi_initiatorname {
+ my ($filename, $fd) = @_;
+
+ while (defined(my $line = <$fd>)) {
+ if ($line =~ m/^InitiatorName=(\S+)$/) {
+ return $1;
+ }
+ }
+
+ return 'undefined';
+}
+
+register_file('initiatorname', "/etc/iscsi/initiatorname.iscsi",
+ \&read_iscsi_initiatorname);
+
1;