From 0c0318fc65ba3eedce82e5fd8bb9cf8a46644927 Mon Sep 17 00:00:00 2001 From: abbodi1406 <33669284+abbodi1406@users.noreply.github.com> Date: Sat, 6 Feb 2021 16:28:40 +0300 Subject: [PATCH] Add support for WCOS ReleaseType --- fetchdetect.php | 3 ++- fetchupd.php | 3 ++- shared/genpack.php | 40 +++++++++++++++++++++++++++++++++++----- shared/main.php | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/fetchdetect.php b/fetchdetect.php index 5ad1722..3a7e04f 100644 --- a/fetchdetect.php +++ b/fetchdetect.php @@ -5,6 +5,7 @@ $flight = isset($argv[3]) ? $argv[3] : 'Active'; $build = isset($argv[4]) ? intval($argv[4]) : 16251; $minor = isset($argv[5]) ? intval($argv[5]) : 0; $sku = isset($argv[6]) ? intval($argv[6]) : 48; +$type = isset($argv[7]) ? $argv[7] : 'Production'; require_once dirname(__FILE__).'/api/fetchupd.php'; require_once dirname(__FILE__).'/shared/main.php'; @@ -16,7 +17,7 @@ if(!get7ZipLocation()) { throwError('NO_7ZIP'); } -$fetchedUpdate = uupFetchUpd($arch, $ring, $flight, $build, $minor, $sku); +$fetchedUpdate = uupFetchUpd($arch, $ring, $flight, $build, $minor, $sku, $type); if(isset($fetchedUpdate['error'])) { throwError($fetchedUpdate['error']); } diff --git a/fetchupd.php b/fetchupd.php index bdf6bfb..4055a17 100644 --- a/fetchupd.php +++ b/fetchupd.php @@ -5,12 +5,13 @@ $flight = isset($argv[3]) ? $argv[3] : 'Active'; $build = isset($argv[4]) ? intval($argv[4]) : 16251; $minor = isset($argv[5]) ? intval($argv[5]) : 0; $sku = isset($argv[6]) ? intval($argv[6]) : 48; +$type = isset($argv[7]) ? $argv[7] : 'Production'; require_once dirname(__FILE__).'/api/fetchupd.php'; require_once dirname(__FILE__).'/shared/main.php'; consoleLogger(brand('fetchupd')); -$fetchedUpdate = uupFetchUpd($arch, $ring, $flight, $build, $minor, $sku); +$fetchedUpdate = uupFetchUpd($arch, $ring, $flight, $build, $minor, $sku, $type); if(isset($fetchedUpdate['error'])) { throwError($fetchedUpdate['error']); } diff --git a/shared/genpack.php b/shared/genpack.php index e04a717..518abf3 100644 --- a/shared/genpack.php +++ b/shared/genpack.php @@ -60,7 +60,7 @@ function generatePack($updateId) { $files = preg_grep('/Path = /', $out); $files = preg_replace('/Path = /', '', $files); - $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\.|ServerTargetCompDB_.*_.*\./i', $files); + $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\.|ServerTargetCompDB_.*_.*\.|ModernPCTargetCompDB_.*\.|HolographicTargetCompDB_.*\./i', $files); unset($out); exec("$z7z x -o\"$tmp\" \"$loc\" -y", $out, $errCode); @@ -80,7 +80,7 @@ function generatePack($updateId) { throwError('7ZIP_ERROR'); } - $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\.|^-.*ServerTargetCompDB_.*_.*\./i', $out); + $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\.|^-.*ServerTargetCompDB_.*_.*\.|^-.*ModernPCTargetCompDB_.*\.|^-.*HolographicTargetCompDB_.*\./i', $out); sort($temp); $temp = preg_replace('/^- /', '', $temp[0]); @@ -94,7 +94,7 @@ function generatePack($updateId) { unlink($loc); unset($loc, $checkFile, $checkEd, $dataFiles); } else { - $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\./i', $filesKeys); + $dataFiles = preg_grep('/DesktopTargetCompDB_.*_.*\.|ServerTargetCompDB_.*_.*\.|ModernPCTargetCompDB\.|HolographicTargetCompDB\./i', $filesKeys); foreach($dataFiles as $val) { $url = $files[$val]['url']; @@ -113,7 +113,7 @@ function generatePack($updateId) { throwError('7ZIP_ERROR'); } - $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\./i', $out); + $temp = preg_grep('/^-.*DesktopTargetCompDB_.*_.*\.|^-.*ServerTargetCompDB_.*_.*\.|^-.*ModernPCTargetCompDB\.|^-.*HolographicTargetCompDB\./i', $out); sort($temp); $temp = preg_replace('/^- /', '', $temp[0]); @@ -127,6 +127,12 @@ function generatePack($updateId) { unset($loc, $checkEd, $dataFiles); } + $keepPath = 0; + foreach($filesKeys as $val) { + if(preg_match('/^appx\/(.*?)\//i', $val)) $keepPath = 1; + if(preg_match('/^(retail)\/(.{3,5})\/fre\//i', $val)) $keepPath = 1; + } + $langsEditions = array(); $packages = array(); foreach($filesToRead as $val) { @@ -136,6 +142,14 @@ function generatePack($updateId) { $lang = preg_replace('/.*DesktopTargetCompDB_.*_|.*ServerTargetCompDB_.*_/', '', $filNam); $edition = preg_replace('/.*DesktopTargetCompDB_|.*ServerTargetCompDB_|_'.$lang.'/', '', $filNam); + if($sku == 189) { + $lang = 'en-us'; + $edition = 'Lite'; + } + if($sku == 135) { + $lang = 'en-us'; + $edition = 'Holographic'; + } $lang = strtolower($lang); $edition = strtoupper($edition); @@ -143,7 +157,23 @@ function generatePack($updateId) { foreach($xml->Packages->Package as $val) { foreach($val->Payload->PayloadItem as $PayloadItem) { $name = $PayloadItem['Path']; - $name = preg_replace('/.*\\\/', '', $name); + if($keepPath) { + $name = str_replace('\\', '_', $name); + } else { + $name = preg_replace('/.*\\\/', '', $name); + } + $packages[$lang][$edition][] = $name; + } + } + + if(@count($xml->AppX)) foreach($xml->AppX->AppXPackages->Package as $val) { + foreach($val->Payload->PayloadItem as $PayloadItem) { + $name = $PayloadItem['Path']; + if($keepPath) { + $name = str_replace('\\', '_', $name); + } else { + $name = preg_replace('/.*\\\/', '', $name); + } $packages[$lang][$edition][] = $name; } } diff --git a/shared/main.php b/shared/main.php index 6507768..c4ec023 100644 --- a/shared/main.php +++ b/shared/main.php @@ -2,7 +2,7 @@ require_once dirname(__FILE__).'/../api/shared/main.php'; function brand($script = null) { - $projVersion = '1.0.2'; + $projVersion = '1.0.3'; return 'UUP dump standalone v'.$projVersion; }