refactor: streamline container setup and dependencies

- Remove `xz-utils` from initial package install
- Remove password/secret check in `obj_init`
- Add on-demand `crun` installation during container create
- Import `herorunner_installer` for `crun` setup
This commit is contained in:
Mahmoud-Emad
2025-09-07 19:01:08 +03:00
parent 7001e8a2a6
commit ef211882af
3 changed files with 8 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.installers.virt.herorunner as herorunner_installer
import os
// Updated enum to be more flexible
@@ -73,6 +74,12 @@ pub fn (mut self ContainerFactory) new(args ContainerNewArgs) !&Container {
// Create container config
self.create_container_config(args.name, rootfs_path)!
// Install crun if not installed
if !osal.cmd_exists('crun') {
mut herorunner := herorunner_installer.new()!
herorunner.install()!
}
// Create container using crun
osal.exec(
cmd: 'crun create --bundle ${self.base_dir}/configs/${args.name} ${args.name}'