View script for controller bootmedia and script/action name index
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/bootmedia/list.phtml b/application/modules/backend/views/scripts/bootmedia/list.phtml
new file mode 100644
index 0000000..8d441c9
--- /dev/null
+++ b/application/modules/backend/views/scripts/bootmedia/list.phtml
@@ -0,0 +1,20 @@
+ if (!empty($this->listdata)): ?>
+ foreach ($this->listdata as $l): ?>
+
+ endforeach;?>
+ endif;?>
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/index.phtml b/application/modules/backend/views/scripts/menu/index.phtml
new file mode 100644
index 0000000..2bd3dd3
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/index.phtml
@@ -0,0 +1 @@
+
View script for controller bootmedia and script/action name index
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/list.phtml b/application/modules/backend/views/scripts/menu/list.phtml
new file mode 100644
index 0000000..e28e54e
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/list.phtml
@@ -0,0 +1,15 @@
+ if (!empty($this->listdata)): ?>
+ foreach ($this->listdata as $l): ?>
+
+ endforeach;?>
+ endif;?>
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/listassignments.phtml b/application/modules/backend/views/scripts/menu/listassignments.phtml
new file mode 100644
index 0000000..2ca982b
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/listassignments.phtml
@@ -0,0 +1,18 @@
+ if (!empty($this->listdata)): ?>
+ foreach ($this->listdata as $l): ?>
+
+ endforeach;?>
+ endif;?>
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/menu/listentries.phtml b/application/modules/backend/views/scripts/menu/listentries.phtml
new file mode 100644
index 0000000..4d8431e
--- /dev/null
+++ b/application/modules/backend/views/scripts/menu/listentries.phtml
@@ -0,0 +1,19 @@
+ if (!empty($this->listdata)): ?>
+ foreach ($this->listdata as $l): ?>
+
+ endforeach;?>
+ endif;?>
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/mkiso/index.phtml b/application/modules/backend/views/scripts/mkiso/index.phtml
new file mode 100644
index 0000000..2bd3dd3
--- /dev/null
+++ b/application/modules/backend/views/scripts/mkiso/index.phtml
@@ -0,0 +1 @@
+
View script for controller bootmedia and script/action name index
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/add.phtml b/application/modules/backend/views/scripts/system/add.phtml
new file mode 100644
index 0000000..f09beb8
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/add.phtml
@@ -0,0 +1 @@
+
View script for controller system and script/action name add
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/addkernel.phtml b/application/modules/backend/views/scripts/system/addkernel.phtml
new file mode 100644
index 0000000..e69de29
diff --git a/application/modules/backend/views/scripts/system/index.phtml b/application/modules/backend/views/scripts/system/index.phtml
new file mode 100644
index 0000000..690f955
--- /dev/null
+++ b/application/modules/backend/views/scripts/system/index.phtml
@@ -0,0 +1 @@
+
View script for controller system and script/action name index
\ No newline at end of file
diff --git a/application/modules/backend/views/scripts/system/sync.phtml b/application/modules/backend/views/scripts/system/sync.phtml
new file mode 100644
index 0000000..e69de29
diff --git a/application/modules/backend/views/scripts/system/updateinitramfs.phtml b/application/modules/backend/views/scripts/system/updateinitramfs.phtml
new file mode 100644
index 0000000..e69de29
diff --git a/application/modules/backend/views/scripts/system/updatekernel.phtml b/application/modules/backend/views/scripts/system/updatekernel.phtml
new file mode 100644
index 0000000..e69de29
diff --git a/application/modules/backend/views/scripts/user/index.phtml b/application/modules/backend/views/scripts/user/index.phtml
new file mode 100644
index 0000000..c04cb93
--- /dev/null
+++ b/application/modules/backend/views/scripts/user/index.phtml
@@ -0,0 +1 @@
+
View script for controller user and script/action name index
\ No newline at end of file
diff --git a/application/modules/bootloader/controllers/EnvController.php b/application/modules/bootloader/controllers/EnvController.php
new file mode 100644
index 0000000..aba575b
--- /dev/null
+++ b/application/modules/bootloader/controllers/EnvController.php
@@ -0,0 +1,218 @@
+_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ }
+
+ public function indexAction()
+ {
+ }
+
+ function _ip_netmask_check ($ip, $net, $mask) {
+
+ if (empty($net) OR empty($mask)) return false;
+
+ $ip_net = ip2long ($net);
+ $ip_mask = ~((1 << (32 - $mask)) - 1);
+
+ $ip_ip = ip2long ($ip);
+
+ $ip_ip_net = $ip_ip & $ip_mask;
+
+ return ($ip_ip_net == $ip_net);
+ }
+
+ public function getmenuAction() {
+
+ $mid = $this->getRequest()->getParam('formedia');
+
+ $this->_mmenus = new Model_Menus();
+ $this->_mmenu_entries = new Model_Menuentries();
+ $this->_mmenu_assignments = new Model_Menuassignments();
+ $this->_mmenu_assignment_iprules = new Model_Menuassignmentip();
+ $this->_mmenu_assignment_bmrules = new Model_Menuassignmentbm();
+
+ $s = $this->_mmenu_assignments->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->joinLeft(array('m' => 'menus'), 'm.id = menu_assignments.menu_id',
+ array('m_name' => 'name'))
+ ->joinLeft(array('i' => 'menu_assignment_iprules'), 'i.menu_assignment_rule = menu_assignments.id',
+ array('i_ip' => 'ip',
+ 'i_netmask' => 'netmask'))
+ ->joinLeft(array('b' => 'menu_assignment_bmrules'), 'b.menu_assignment_rule = menu_assignments.id',
+ array('b_bootmedia_id' => 'bootmedia_id'))
+ ->joinLeft(array('bm' => 'bootmedia'), 'bm.id = b.bootmedia_id',
+ array('b_name' => 'name',
+ 'b_identifier' => 'identifier'))
+ ->order(array('menu_id', 'i_netmask', 'b_bootmedia'));
+ $data = $this->_mmenu_assignments->fetchAll($s)->toArray();
+
+ foreach ($data as $d) {
+ if ($this->_ip_netmask_check($_SERVER['REMOTE_ADDR'], $d['i_ip'], $d['i_netmask'])) {
+ if ($pbs_id == $d['b_identifier']) $r[4][] = $d['menu_id'];
+ else $r[3][] = $d['menu_id'];
+ } else {
+ if ($pbs_id == $d['b_identifier']) $r[2][] = $d['menu_id'];
+ else $r[1][] = $d['menu_id'];
+ }
+ }
+
+ for ($i = 4; $i>0; $i--) {
+ if (!empty($r[$i])) {
+ $r = array_shift($r[$i]);
+ break;
+ }
+ }
+
+ $s = $this->_mmenu_entries->select(Zend_Db_Table::SELECT_WITH_FROM_PART);
+ $s->setIntegrityCheck(false)
+ ->where('menu_id = ?', $r)
+ ->joinLeft(array('s' => 'systems'), 's.id = menu_entries.system_id',
+ array('s_name' => 'name',
+ 's_append' => 'append',
+ 's_external_id' => 'external_id',
+ 's_source' => 'source'))
+ ->order('entry_order');
+ $data = $this->_mmenu_entries->fetchAll($s)->toArray();
+
+
+ $r = array();
+ $c = 1;
+ $mapping = "\n case $(cat result) in ";
+ foreach ($data as $d) {
+ $r[] = "$c \"" . (($d['overwrite_caption'] == 1)? $d['alternative_caption'] : $d['s_name']) . "\"";
+ $m = "\n %s)";
+ $m .= "\n echo \"systemid=%s\" >> /tmp/boot";
+ $m .= "\n echo \"systemname=\\\"%s\\\"\" >> /tmp/boot";
+ $m .= "\n echo \"sysname=%s\" >> /tmp/boot";
+ $m .= "\n echo \"syssource=%s\" >> /tmp/boot";
+ $m .= "\n echo \"append=%s\" >> /tmp/boot";
+ $m .= "\n ;;";
+ $mapping .= sprintf($m,
+ $c,
+ $d['id'],
+ (($d['overwrite_caption'] == 1)? $d['alternative_caption'] : $d['s_name']),
+ $d['s_external_id'],
+ $d['s_source'],
+ (($d['overwrite_append'] == 1)? $d['alternative_append'] : $d['s_append'])
+ );
+ $c++;
+ }
+ $mapping .= "\n esac";
+
+ $entryCount = count($r);
+ $entries = implode(" ", $r);
+
+ $v = $this->view;
+ $v->bootmenu = "$entryCount $entries";
+ $v->bootmenu_mapping = $mapping;
+ echo $v->render('env/bootmenu.dialog');
+ }
+
+ public function getinitAction() {
+
+ $mid = $this->getRequest()->getParam('formedia');
+
+ $v = $this->view;
+ #$v->dialog = "/bin/sh";
+ echo $v->render('env/prebootInit.sh');
+ }
+
+ public function getkernelAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+
+ $cmd = "atftp %s -g -r %s -l /tmp/vmlinuz";
+ $cmd = sprintf($cmd, $d['source'], $d['kernel']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+ $file = "/tmp/vmlinuz";
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="vmlinuz"');
+
+ readfile($file);
+ }
+
+ public function getinitramfsAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+ $cmd = "atftp %s -g -r %s -l /tmp/initramfs";
+ $cmd = sprintf($cmd, $d['source'], $d['initrd']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+ $file = "/tmp/initramfs";
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="initramfs"');
+
+ readfile($file);
+ }
+
+ public function getccAction() {
+ $sid = $this->getRequest()->getParam('forsystem');
+ $s = new Model_Systems();
+
+ $d = $s->find($sid)->toArray();
+ $d = $d[0];
+
+ $file = "/tmp/initramfs.".mktime();
+
+ $cmd = "atftp %s -g -r %s -l $file";
+ $cmd = sprintf($cmd, $d['source'], $d['external_id']);
+
+ $output = array();
+ $returnval = null;
+ exec($cmd, $output, $returnval);
+
+
+ header("Content-Type: application/octet-stream");
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . (string)filesize($file));
+ header('Content-Disposition: attachment; filename="initramfs"');
+
+ readfile($file);
+ }
+
+ public function __call($a, $b)
+ {
+ var_dump($a,$b);
+ }
+
+
+
+}
+
+
+
diff --git a/application/modules/bootloader/controllers/IndexController.php b/application/modules/bootloader/controllers/IndexController.php
new file mode 100644
index 0000000..7a2fcea
--- /dev/null
+++ b/application/modules/bootloader/controllers/IndexController.php
@@ -0,0 +1,29 @@
+bootmenu ?> 2>result
+done
+
+= $this->bootmenu_mapping ?>
\ No newline at end of file
diff --git a/application/modules/bootloader/views/scripts/env/prebootInit.sh b/application/modules/bootloader/views/scripts/env/prebootInit.sh
new file mode 100644
index 0000000..acf8f33
--- /dev/null
+++ b/application/modules/bootloader/views/scripts/env/prebootInit.sh
@@ -0,0 +1,71 @@
+#!/bin/ash
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# preboot script for user interaction with OpenSLX preloading environment for
+# Linux stateless clients (fetched by Preboot init over the net)
+
+# get configuration
+. /etc/initramfs-setup
+. /etc/pbs.conf
+. ./preboot-scripts/dialog.functions
+
+# bring the mac address into the standard format 01-
+client=$(echo 01-$macaddr|sed "s/:/-/g")
+
+# check if already a configuration is available to decide if user interaction
+# is required (path is to be fixed)
+#wget -q -O /tmp/have-user-config "$boot_uri/users.pl?user=${client}"
+#have_user_config=$(cat /tmp/have-user-config);
+
+#if [ "x1" == "x$have_user_config" ]; then
+# wget -q -O /tmp/oldconfig "$boot_uri/users.pl?user=${client}&action=read"
+# . /tmp/oldconfig
+# menu_oldconfig $oldconfig
+#else
+# menu_firststart
+#fi
+#rm result;
+
+# Switch here for several boot TYPE=fastboot/directkiosk/cfgkiosk/slxconfig
+# fastboot - no interaction use system from client config
+# directkiosk - start the default slx system into kiosk (using vmchooser)
+# cfgkiosk - offer the user changes to his kiosk system (GUI environment)
+# slxconfig - offer the user set of configuration options, like setting a non-
+# priviledged user, root password, standard gui, plugins to activate ...
+
+wget -q -O /preboot/bootmenu.dialog ${boot_uri}bootloader/env/getmenu/formedia/$pbs_id
+
+# we expect to have a system selection dialog file in /preboot/bootmenu.dialog
+chmod u+x /preboot/bootmenu.dialog
+/preboot/bootmenu.dialog
+
+. /tmp/boot
+
+
+# fetch kernel and initramfs of selected system
+dialog --infobox "Loading kernel of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getkernel/forsystem/$systemid "Kernel" /tmp/kernel
+wget -q -O /tmp/kernel ${boot_uri}bootloader/env/getkernel/forsystem/$systemid
+dialog --infobox "Loading initial ramfs of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid "Initramfs" /tmp/initramfs
+wget -q -O /tmp/initramfs ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid
+
+# read primary IP configuration to pass it on (behaviour like IPAPPEND=1 of
+# PXElinux)
+. /tmp/ipstuff
+
+[ "x$DEBUGLEVEL" != x0 ] && { clear; ash; }
+
+# start the new kernel with initialramfs and composed cmdline
+dialog --infobox "Booting OpenSLX client $label ... (be patient this could take some time)" 3 69
+kexec -l /tmp/kernel --initrd=/tmp/initramfs \
+ --append="$append file=http://${syssource}/pbs/client-config/${sysname}/pbs.tgz $quiet ip=$ip:$siaddr:$router:$subnet:$dnssrv $debug" 2>/dev/null
+kexec -e >/dev/null 2>&1
diff --git a/application/modules/bootloader/views/scripts/index/index.phtml b/application/modules/bootloader/views/scripts/index/index.phtml
new file mode 100644
index 0000000..e69de29
diff --git a/application/modules/ui/controllers/DialogController.php b/application/modules/ui/controllers/DialogController.php
new file mode 100644
index 0000000..6bba3f8
--- /dev/null
+++ b/application/modules/ui/controllers/DialogController.php
@@ -0,0 +1,53 @@
+_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+ $this->_mbootmedia = new Model_Bootmedia();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function getAction()
+ {
+ $dialog = $this->getRequest()->getParam('bootmedia');
+
+ if (!empty($dialog)) {
+ if (in_array($dialog, array('create', 'progress')))
+ $this->view->dialog =
+ $this->view->render("dialog/bootmedia.$dialog.phtml");
+ }
+
+ $dialog = $this->getRequest()->getParam('menu');
+
+ if (!empty($dialog)) {
+ if (in_array($dialog, array('create', 'createentry', 'createassignment', 'createentry2', 'progress')))
+ $this->view->dialog =
+ $this->view->render("dialog/menu.$dialog.phtml");
+ }
+ }
+
+
+
+}
diff --git a/application/modules/ui/controllers/SubpageController.php b/application/modules/ui/controllers/SubpageController.php
new file mode 100644
index 0000000..51fadd3
--- /dev/null
+++ b/application/modules/ui/controllers/SubpageController.php
@@ -0,0 +1,60 @@
+_helper->layout->disableLayout();
+ #$this->_helper->viewRenderer->setNoRender();
+
+ $this->_mkernels = new Model_Kernels();
+ $this->_msources = new Model_Sources();
+ $this->_mbootmedia = new Model_Bootmedia();
+ $this->_mmenus = new Model_Menus();
+
+
+ $this->_logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $this->_logger->addWriter($w);
+ }
+
+ public function indexAction()
+ {
+
+ }
+
+ public function getAction()
+ {
+ $subpage = $this->getRequest()->getParam('bootmedia');
+
+ if (!empty($subpage)) {
+ if (in_array($subpage, array('actionmenu', 'list')))
+ $this->view->subpage =
+ $this->view->render("subpage/bootmedia.$subpage.phtml");
+ }
+
+ $subpage = $this->getRequest()->getParam('menu');
+
+ if (!empty($subpage)) {
+ if (in_array($subpage, array('actionmenu','actionmenu-entries','actionmenu-menuassignment', 'list', 'entrylist', 'assignmentlist')))
+ if ($subpage == 'entrylist') {
+ $r = $this->_mmenus->find($this->getRequest()->getParam('id'));
+ $this->view->currentMenu = $r[0];
+ }
+ $this->view->subpage =
+ $this->view->render("subpage/menu.$subpage.phtml");
+ }
+
+ }
+
+
+
+}
diff --git a/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml b/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml
new file mode 100644
index 0000000..44e7569
--- /dev/null
+++ b/application/modules/ui/views/scripts/dialog/bootmedia.create.phtml
@@ -0,0 +1,18 @@
+
+
+ Enter meta data for the image and select the kernel version it should be based on..
+
\ No newline at end of file
diff --git a/application/views/scripts/index/menu.phtml b/application/views/scripts/index/menu.phtml
new file mode 100644
index 0000000..14eedc7
--- /dev/null
+++ b/application/views/scripts/index/menu.phtml
@@ -0,0 +1,13 @@
+
+
+