diff --git a/kernel/console/controllers/KernelController.php b/kernel/console/controllers/KernelController.php index 147d84f..13efa75 100644 --- a/kernel/console/controllers/KernelController.php +++ b/kernel/console/controllers/KernelController.php @@ -27,7 +27,7 @@ class KernelController extends ConsoleController if (file_exists(ROOT_DIR . $this->argv['path'])) { $tmpKernelDirFull = RESOURCES_DIR . '/tmp/ad/kernel/kernel'; - $this->files->copy_folder(KERNEL_DIR, $tmpKernelDirFull); + $this->files->copy_folder(ROOT_DIR . $this->argv['path'], $tmpKernelDirFull); $this->out->r("Ядро скопировано во временную папку", 'green'); } else { $this->out->r("Ядро не найдено", 'red'); @@ -65,11 +65,19 @@ class KernelController extends ConsoleController $this->out->r("/composer.json не найден", 'red'); } - if (!is_dir(RESOURCES_DIR . '/tmp/app')) { - mkdir(RESOURCES_DIR . '/tmp/app'); + if (!is_dir(RESOURCES_DIR . '/tmp/kernel')) { + mkdir(RESOURCES_DIR . '/tmp/kernel'); + } + + if (file_exists(KERNEL_DIR . '/manifest.json')) { + $manifest = json_decode(file_get_contents(KERNEL_DIR . '/manifest.json'), true); + $version = $manifest['version'] ?? ''; + $this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel_v' . $version . '.igk'); + } + else { + $this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel.igk'); } - $this->files->pack(RESOURCES_DIR . '/tmp/ad/kernel/', RESOURCES_DIR . '/tmp/kernel/kernel.igk'); $this->files->recursiveRemoveDir(RESOURCES_DIR . '/tmp/ad/kernel/'); } diff --git a/kernel/manifest.json b/kernel/manifest.json new file mode 100644 index 0000000..25031b0 --- /dev/null +++ b/kernel/manifest.json @@ -0,0 +1,3 @@ +{ + "version": "0.2" +} \ No newline at end of file