diff options
| author | Simon Rettberg | 2013-11-16 15:42:16 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2013-11-16 15:42:16 +0100 |
| commit | 633e43127c6d1a96d47587eed2739bdaff6c3d4f (patch) | |
| tree | afe22b5cef77a5a054388d05f6a2c106dcb4d60b /modules/ipxe.inc.php | |
| parent | Add custom config.tgz upload functionality (diff) | |
| download | slx-admin-633e43127c6d1a96d47587eed2739bdaff6c3d4f.tar.gz slx-admin-633e43127c6d1a96d47587eed2739bdaff6c3d4f.tar.xz slx-admin-633e43127c6d1a96d47587eed2739bdaff6c3d4f.zip | |
Add minilinux download functionality and ipxe compilation scripts
Diffstat (limited to 'modules/ipxe.inc.php')
| -rw-r--r-- | modules/ipxe.inc.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/modules/ipxe.inc.php b/modules/ipxe.inc.php new file mode 100644 index 00000000..869f4c72 --- /dev/null +++ b/modules/ipxe.inc.php @@ -0,0 +1,35 @@ +<?php + +User::load(); + +if (!User::hasPermission('superadmin')) { + Message::addError('no-permission'); + Util::redirect('?do=main'); +} + +if (isset($_POST['action'])) { + if ($_POST['action'] === 'compile') { + if (!Util::verifyToken()) { + Util::redirect('?do=main'); + } + } +} + +function render_module() +{ + $ips = array(); + $current = CONFIG_IPXE_DIR . '/last-ip'; + if (file_exists($current)) $current = file_get_contents($current); + exec('/bin/ip a', $retval); + foreach ($retval as $ip) { + if (preg_match('#inet (\d+\.\d+\.\d+\.\d+)/\d+.*scope#', $ip, $out) && $out[1] !== '127.0.0.1') { + $ips[] = array( + 'ip' => $out[1], + 'current' => ($out[1] == $current) + ); + } + } + Render::addTemplate('page-ipxe', array('ips' => $ips, 'token' => Session::get('token'))); +} + + |
