From fcc75d1f30782a5ef1a5f053b105a037192956b3 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 14 Jan 2010 15:39:14 +0000 Subject: [PATCH] needed to resurrect that one --- bootmanager.spec | 2 ++ nodeconfig/boot/getnodeid.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 nodeconfig/boot/getnodeid.php diff --git a/bootmanager.spec b/bootmanager.spec index 65575f8..58efc5d 100644 --- a/bootmanager.spec +++ b/bootmanager.spec @@ -59,6 +59,7 @@ install -m 644 README $RPM_BUILD_ROOT/%{_datadir}/%{name}/README # formerly in the nodeconfig module install -D -m 755 nodeconfig/boot/index.php $RPM_BUILD_ROOT/var/www/html/boot/index.php install -D -m 755 nodeconfig/boot/upload-bmlog.php $RPM_BUILD_ROOT/var/www/html/boot/upload-bmlog.php +install -D -m 755 nodeconfig/boot/getnodeid.php $RPM_BUILD_ROOT/var/www/html/boot/getnodeid.php # formerly in the MyPLC module install -D -m 755 plc.d/bootmanager $RPM_BUILD_ROOT/etc/plc.d/bootmanager @@ -80,6 +81,7 @@ chkconfig --del monitor-runlevelagent %{_datadir}/%{name} /var/www/html/boot/index.php /var/www/html/boot/upload-bmlog.php +/var/www/html/boot/getnodeid.php /etc/plc.d/bootmanager %changelog diff --git a/nodeconfig/boot/getnodeid.php b/nodeconfig/boot/getnodeid.php new file mode 100755 index 0000000..d097b35 --- /dev/null +++ b/nodeconfig/boot/getnodeid.php @@ -0,0 +1,29 @@ + +// Copyright (C) 2006 The Trustees of Princeton University +// +// $Id: getnodeid.php 9469 2008-05-26 14:13:19Z thierry $ $ +// + +// Get admin API handle +require_once 'plc_api.php'; +global $adm; + +if (!empty($_REQUEST['mac_addr'])) { + $mac_lower = strtolower(trim($_REQUEST['mac_addr'])); + $mac_upper = strtoupper(trim($_REQUEST['mac_addr'])); + $interfaces = $adm->GetInterfaces(array('mac' => array($mac_lower, $mac_upper))); +} else { + $interfaces = $adm->GetInterfaces(array('ip' => $_SERVER['REMOTE_ADDR'])); +} + +if (!empty($interfaces)) { + print $interfaces[0]['node_id']; +} else { + print "-1"; +} + +?> -- 2.43.0