First simple implementation of tftp_provisioner.php

Signed-off-by: Diederik de Groot <ddegroot@talon.nl>
This commit is contained in:
Diederik de Groot
2020-02-17 17:52:29 +01:00
parent cc3ee10aaa
commit 70e99148f2
3 changed files with 115 additions and 149 deletions

View File

@@ -1,11 +1,12 @@
<?php
include_once("logger.php");
include_once("utils.php");
//$base_path = !empty($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT'] . "/.."): realpath(getcwd() . "/..");
$base_path = realpath(__DIR__ . DIRECTORY_SEPARATOR . "..");
$base_path = !empty($_SERVER['DOCUMENT_ROOT']) ? realpath($_SERVER['DOCUMENT_ROOT'] . "/../"): realpath(getcwd()."/../");
$base_config = Array(
'main' => Array(
'debug' => TRUE,
'debug' => true,
'default_language' => 'English_United_States',
'log_type' => "NULL",
'log_level' => 'LOG_EMERG'
@@ -51,7 +52,7 @@ $base_config = Array(
'charset' => 'utf-8'
),
'urls' => Array(
'security' => FALSE,
'security' => false,
'information' => NULL,
'authentication' => NULL,
'services' => NULL,
@@ -62,19 +63,19 @@ $base_config = Array(
)
);
$tree_base = Array(
'settings' => array('path' => 'tftproot', "strip" => TRUE),
'wallpapers' => array('path' => 'tftproot', "strip" => FALSE),
'ringtones' => array('path' => 'tftproot', "strip" => TRUE),
'locales' => array('path' => 'tftproot', "strip" => TRUE),
'firmware' => array('path' => 'tftproot', "strip" => TRUE),
'languages' => array('path' => 'locales', "strip" => FALSE),
'countries' => array('path' => 'locales', "strip" => FALSE),
'default_language' => array('path' => 'locales', "strip" => TRUE),
'settings' => array('path' => 'tftproot', "strip" => true),
'wallpapers' => array('path' => 'tftproot', "strip" => false),
'ringtones' => array('path' => 'tftproot', "strip" => true),
'locales' => array('path' => 'tftproot', "strip" => true),
'firmware' => array('path' => 'tftproot', "strip" => true),
'languages' => array('path' => 'locales', "strip" => false),
'countries' => array('path' => 'locales', "strip" => false),
'default_language' => array('path' => 'locales', "strip" => true),
);
# Merge config
//$ini_array = parse_ini_file("$base_path/config.ini", TRUE, INI_SCANNER_TYPED);
$ini_array = parse_ini_file_multi("$base_path/config.ini", TRUE, INI_SCANNER_TYPED);
//$ini_array = parse_ini_file("$base_path/config.ini", true, INI_SCANNER_TYPED);
$ini_array = parse_ini_file_multi("$base_path/config.ini", true, INI_SCANNER_TYPED);
if (!empty($ini_array)) {
$config = array_merge($base_config, $ini_array);
}