mirror of
https://github.com/rosalinux/image-builder.git
synced 2025-02-23 10:22:50 +00:00
few minor improvements
This commit is contained in:
parent
e677980e68
commit
422d19e932
3 changed files with 18 additions and 0 deletions
|
@ -71,12 +71,24 @@ def run_dnf_install(config, dnf_conf_path, rootfs_dir, arch, extra_pkgs=""):
|
|||
subprocess.run(dnf_command, check=True)
|
||||
|
||||
|
||||
def set_root_password_with_systemd(rootfs_dir, password_root):
|
||||
"""Set root password using systemd-firstboot in chroot environment."""
|
||||
subprocess.run(
|
||||
["sudo", "systemd-firstboot", "--root-password=", password_root, "--root=", rootfs_dir],
|
||||
check=True
|
||||
)
|
||||
print(f"root password set to '{password_root}' in chroot at {rootfs_dir}")
|
||||
|
||||
|
||||
def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro, arch):
|
||||
# load distro config
|
||||
# bootstrap/DISTRO_NAME
|
||||
distro_config_path = os.path.join(bootstrap_dir, distro)
|
||||
|
||||
if not os.path.exists(distro_config_path):
|
||||
print(f"Bootstrap configuration for distro '{distro}' not found.")
|
||||
current_directory = os.getcwd()
|
||||
print(f"Текущая рабочая директория: {current_directory}")
|
||||
sys.exit(1)
|
||||
|
||||
config = load_config(distro_config_path)
|
||||
|
@ -91,5 +103,6 @@ def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro, arch):
|
|||
|
||||
generate_dnf_conf(dnf_conf_path, config["ABF_DOWNLOADS"], config["RELEASE"])
|
||||
run_dnf_install(config, dnf_conf_path, rootfs_dir, arch, extra_pkgs)
|
||||
set_root_password_with_systemd(rootfs_dir, config["PASSWD_ROOT"])
|
||||
|
||||
#setup_user(rootfs_dir, config["DEFAULT_USER"], config["DEFAULT_USER_PASSWORD"], config["PASSWD_ROOT"])
|
||||
|
|
|
@ -15,7 +15,9 @@ def clone_kernel(TMP_DIR, BASE_DIR, config, vendor, device, kernel_dir):
|
|||
|
||||
|
||||
def make_kernel_tar(kernel_dir, kernel_rpm_dir):
|
||||
base_dir = os.getcwd()
|
||||
os.chdir(kernel_dir)
|
||||
subprocess.run(["git", "archive",
|
||||
"--format=tar", "--prefix=kernel/",
|
||||
f"--output={kernel_rpm_dir}/kernel.tar", "HEAD"])
|
||||
os.chdir(base_dir)
|
||||
|
|
|
@ -13,6 +13,7 @@ def run_rpmbuild(kernel_build_dir, target_arch):
|
|||
print(f"Error: Kernel build directory '{kernel_build_dir}' does not exist.")
|
||||
sys.exit(1)
|
||||
|
||||
base_dir = os.getcwd()
|
||||
# Change to the kernel-build directory
|
||||
os.chdir(kernel_build_dir)
|
||||
|
||||
|
@ -58,6 +59,8 @@ def run_rpmbuild(kernel_build_dir, target_arch):
|
|||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error: rpmbuild failed with error code {e.returncode}")
|
||||
sys.exit(1)
|
||||
# go back to script dir
|
||||
os.chdir(base_dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Reference in a new issue