summaryrefslogtreecommitdiffstats
path: root/modules-available/runmode/baseconfig
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-12 18:39:21 +0200
committerSimon Rettberg2017-07-12 18:39:21 +0200
commit6b5d3a94ed1b62728957b04b36a08327837b0b5f (patch)
treec3cf440c5ca2a6a34b74d08d5a571bc1312aa2e2 /modules-available/runmode/baseconfig
parent[baseconfig_partitions_cdn] Fix warning (diff)
downloadslx-admin-6b5d3a94ed1b62728957b04b36a08327837b0b5f.tar.gz
slx-admin-6b5d3a94ed1b62728957b04b36a08327837b0b5f.tar.xz
slx-admin-6b5d3a94ed1b62728957b04b36a08327837b0b5f.zip
[runmode] Tweaks, support NO_CONFIG and systemd target
Diffstat (limited to 'modules-available/runmode/baseconfig')
-rw-r--r--modules-available/runmode/baseconfig/getconfig.inc.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules-available/runmode/baseconfig/getconfig.inc.php b/modules-available/runmode/baseconfig/getconfig.inc.php
new file mode 100644
index 00000000..fe04b5ef
--- /dev/null
+++ b/modules-available/runmode/baseconfig/getconfig.inc.php
@@ -0,0 +1,29 @@
+<?php
+
+$foofoo = function($machineUuid) {
+ $res = Database::queryFirst('SELECT module, modeid, modedata FROM runmode WHERE machineuuid = :uuid',
+ array('uuid' => $machineUuid));
+ if ($res === false)
+ return;
+ $config = RunMode::getModuleConfig($res['module']);
+ if ($config === false || $config->configHook === false)
+ return;
+ if (!Module::isAvailable($res['module']))
+ return; // Not really possible because getModuleConfig would have failed but we should make sure
+ call_user_func($config->configHook, $machineUuid, $res['modeid'], $res['modedata']);
+ if ($config->systemdDefaultTarget !== false) {
+ ConfigHolder::add('SLX_SYSTEMD_TARGET', $config->systemdDefaultTarget, 10000);
+ }
+ if ($config->noSysconfig) {
+ ConfigHolder::add('SLX_NO_CONFIG_TGZ', '1', 10000);
+ }
+ // Disable exam mode - not sure if this is generally a good idea; for now, all modes we can think of would
+ // not make sense that way so do this for now
+ if (ConfigHolder::get('SLX_EXAM') !== false) {
+ ConfigHolder::add('SLX_EXAM', '', 100001);
+ ConfigHolder::add('SLX_EXAM_START', '', 100001);
+ ConfigHolder::add('SLX_AUTOLOGIN', '', 100001);
+ }
+};
+
+$foofoo($uuid); \ No newline at end of file