aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2008-06-11 19:52:49 +0000
committerPetter Reinholdtsen <pere@hungry.com>2008-06-11 19:52:49 +0000
commit6c7beec7b53211366189c0b2e4b4d8aa4640ff87 (patch)
tree1c19f29a6254f5d97ee5a10f45e76bc898879520 /SiteSummary.pm
parentfe66a3c40d852c0ad397f0fc54208ca50007e264 (diff)
downloadsitesummary-6c7beec7b53211366189c0b2e4b4d8aa4640ff87.tar.gz
sitesummary-6c7beec7b53211366189c0b2e4b4d8aa4640ff87.tar.bz2
sitesummary-6c7beec7b53211366189c0b2e4b4d8aa4640ff87.tar.xz
* New argument -w to sitesummary-nodes, to list DNS name and MAC address,
for use with wakeonlan packages.
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm26
1 files changed, 25 insertions, 1 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index 630c003..f5a1db4 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -15,6 +15,7 @@ our @EXPORT = qw(
get_sitegroup
get_hostname
get_dns_address
+ get_primary_macaddress
get_linux_kernel_ver
get_debian_edu_profile
get_debian_edu_ver
@@ -81,7 +82,7 @@ sub get_hostclass {
sub get_primary_ip_address {
my $hostid = shift;
my $path = get_filepath_current($hostid, "/system/ifconfig-a");
- # XXX Not implemented
+ # XXX Not properly implemented, just pick the first IP
my $ip;
if (open (FILE, $path)) {
while(<FILE>) {
@@ -99,6 +100,29 @@ sub get_primary_ip_address {
}
#
+# Return the IP address on the primary network interface
+#
+sub get_primary_macaddress {
+ my $hostid = shift;
+ my $path = get_filepath_current($hostid, "/system/ifconfig-a");
+ # XXX Not properly implemented, just pick the first interface
+ my $macaddress;
+ if (open (FILE, $path)) {
+ while(<FILE>) {
+ chomp;
+ if (m/Link encap:Ethernet\s+HWaddr (\S+)\s+/) {
+ $macaddress = $1;
+ last;
+ }
+ }
+ close(FILE);
+ return $macaddress;
+ } else {
+ return undef;
+ }
+}
+
+#
# Return the hostname string
#
sub get_hostname {