Added check for update-proxy.ini and uses real data if it exists.

This commit is contained in:
Richard Blair
2023-01-21 02:54:51 -05:00
parent 51bcae2a12
commit 9dabc2ea0c

View File

@@ -1,14 +1,28 @@
<?php
$SelfUpdateUrl = "https://tonoxisisle.services/tononixOS/recovery/BUILD-DATA";
$SelfUpdateZipUrl = "https://tonoxisisle.services/tononixOS/recovery/recovery.zip";
Use \Noodlehaus\Config;
Use \Noodlehaus\Parser\Ini;
if(file_exists("/settings/update-proxy.ini"))
{
$Configuration = new Config("/settings/update-proxy.ini", new Ini);
$SelfUpdateUrl = $Configuration->get("proxy-urls.self-update-url");
$SelfUpdateZipUrl = $Configuration->get('proxy-urls.self-update-zip');
$SerialNumber = file_get_contents("/sys/firmware/devicetree/base/serial-number");
$ModelName = file_get_contents("/sys/firmware/devicetree/base/model");
$RecoveryVersionInfo = file("/mnt/BUILD-DATA");
} else {
$SelfUpdateUrl = "https://tonoxisisle.services/tononixOS/recovery/BUILD-DATA";
$SelfUpdateZipUrl = "https://tonoxisisle.services/tononixOS/recovery/recovery.zip";
$ModelName = "Raspberry Pi 3 Model B Rev 1.2";
$SerialNumber = "000019292900aTEST";
$RecoveryVersionInfo = file("BUILD-DATA");
}
$SerialNumber = file_get_contents("/sys/firmware/devicetree/base/serial-number");
#$SerialNumber = "000019292900aTEST";
$SerialNumber = str_replace("\r","",$SerialNumber);
$SerialNumber = str_replace("\n","",$SerialNumber);
$RecoveryVersionInfo = file("/mnt/BUILD-DATA");
$RecoveryVersion = str_replace("PINN Version: ", "", $RecoveryVersionInfo[1]);
$RecoveryVersion = str_replace("\r","",$RecoveryVersion);
$RecoveryVersion = str_replace("\n","",$RecoveryVersion);
@@ -16,6 +30,7 @@ $RecoveryVersion = str_replace("\n","",$RecoveryVersion);
$UpdateServiceHeaders = [
'X-Device-Serial-Number' => $SerialNumber,
'X-Device-Bootloader-Version' => $RecoveryVersion,
'X-Device-Model-Name' => $ModelName,
'User-Agent' => 'wget/1.0 tononixPC/'.$RecoveryVersion
];