forked from xbgmsharp/ipxe-buildweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nics.php
executable file
·25 lines (22 loc) · 925 Bytes
/
nics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/*
#------------------------------------------------------------------------
# Dynamic iPXE image generator
#
# Copyright (C) 2012-2018 Francois Lacroix. All Rights Reserved.
# License: GNU General Public License version 3 or later; see LICENSE.txt
# Website: http://ipxe.org, https://github.com/xbgmsharp/ipxe-buildweb
# Support: [email protected]
#------------------------------------------------------------------------
*/
$cache_file = "/tmp/ipxelistnics";
$cache_life = '3600'; //caching time, in seconds, 1h
$filemtime = @filemtime($cache_file); // returns FALSE if file does not exist
if (!$filemtime or (time() - $filemtime >= $cache_life))
{
$outpout = exec("rm -f /tmp/ipxelistnics && cd /var/tmp/ipxe/src/ && /var/tmp/ipxe/src/util/niclist.pl --format json --columns ipxe_name,device_id,vendor_id 1>/tmp/ipxelistnics");
readfile("/tmp/ipxelistnics");
} else {
readfile("/tmp/ipxelistnics");
}
?>