summaryrefslogtreecommitdiffstats
path: root/modules-available/serversetup-bwlp/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2018-06-12 17:15:44 +0200
committerSimon Rettberg2018-06-12 17:15:44 +0200
commit2e78eec281815d6ba42ff2cf7c3a937abe6d83c5 (patch)
treed98495500354de9b735b31c64e02856eeb179098 /modules-available/serversetup-bwlp/install.inc.php
parent[inc/Database] Method to return single-column queries as array (diff)
downloadslx-admin-2e78eec281815d6ba42ff2cf7c3a937abe6d83c5.tar.gz
slx-admin-2e78eec281815d6ba42ff2cf7c3a937abe6d83c5.tar.xz
slx-admin-2e78eec281815d6ba42ff2cf7c3a937abe6d83c5.zip
[serversetup-bwlp] Start rewrite as purely iPXE-based
Diffstat (limited to 'modules-available/serversetup-bwlp/install.inc.php')
-rw-r--r--modules-available/serversetup-bwlp/install.inc.php74
1 files changed, 74 insertions, 0 deletions
diff --git a/modules-available/serversetup-bwlp/install.inc.php b/modules-available/serversetup-bwlp/install.inc.php
new file mode 100644
index 00000000..8814bb7c
--- /dev/null
+++ b/modules-available/serversetup-bwlp/install.inc.php
@@ -0,0 +1,74 @@
+<?php
+
+$res = array();
+
+$res[] = tableCreate('serversetup_bootentry', "
+ `entryid` varchar(16) CHARACTER SET ascii NOT NULL,
+ `hotkey` varchar(8) CHARACTER SET ascii NOT NULL,
+ `title` varchar(100) NOT NULL,
+ `builtin` tinyint(1) NOT NULL,
+ `data` blob NOT NULL,
+ PRIMARY KEY (`entryid`)
+");
+
+$res[] = tableCreate('serversetup_menu', "
+ `menuid` int(11) NOT NULL AUTO_INCREMENT,
+ `timeoutms` int(10) unsigned NOT NULL,
+ `title` varchar(100) NOT NULL COMMENT 'Escaped/Sanitized for iPXE!',
+ `defaultentryid` int(11) DEFAULT NULL,
+ `isdefault` tinyint(1) NOT NULL,
+ PRIMARY KEY (`menuid`),
+ KEY `defaultentryid` (`defaultentryid`),
+ KEY `isdefault` (`isdefault`)
+");
+
+$res[] = tableCreate('serversetup_menuentry', "
+ `menuentryid` int(11) NOT NULL AUTO_INCREMENT,
+ `menuid` int(11) NOT NULL,
+ `entryid` varchar(16) CHARACTER SET ascii NULL COMMENT 'If NULL, entry is gap',
+ `hotkey` varchar(8) CHARACTER SET ascii NOT NULL,
+ `title` varchar(100) NOT NULL COMMENT 'Sanitize this before insert',
+ `hidden` tinyint(1) NOT NULL,
+ `sortval` int(11) NOT NULL,
+ `plainpass` varchar(80) NOT NULL,
+ `md5pass` char(32) CHARACTER SET ascii NOT NULL,
+ PRIMARY KEY (`menuentryid`),
+ KEY `menuid` (`menuid`,`entryid`),
+ KEY `entryid` (`entryid`)
+");
+
+$res[] = tableCreate('serversetup_menu_location', '
+ `menuid` int(11) NOT NULL,
+ `locationid` int(11) NOT NULL,
+ PRIMARY KEY (`menuid`,`locationid`),
+ UNIQUE `locationid` (`locationid`)
+');
+
+$res[] = tableCreate('serversetup_localboot', "
+ `systemmodel` varchar(120) NOT NULL,
+ `bootmethod` enum('EXIT','COMBOOT','SANBOOT') CHARACTER SET ascii NOT NULL,
+ PRIMARY KEY (`systemmodel`)
+");
+
+$res[] = tableAddConstraint('serversetup_menu', 'defaultentryid', 'serversetup_menuentry', 'menuentryid',
+ 'ON DELETE SET NULL');
+
+$res[] = tableAddConstraint('serversetup_menuentry', 'entryid', 'serversetup_bootentry', 'entryid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+
+$res[] = tableAddConstraint('serversetup_menuentry', 'menuid', 'serversetup_menu', 'menuid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+
+$res[] = tableAddConstraint('serversetup_menu_location', 'menuid', 'serversetup_menu', 'menuid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+
+if (Module::get('location') !== false) {
+ if (!tableExists('location')) {
+ $res[] = UPDATE_RETRY;
+ } else {
+ $res[] = tableAddConstraint('serversetup_menu_location', 'locationid', 'location', 'locationid',
+ 'ON UPDATE CASCADE ON DELETE CASCADE');
+ }
+}
+
+responseFromArray($res);