From 3029e6e84959abfea6572a972d304a43200e29de Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Wed, 26 Jun 2024 11:19:17 +0000 Subject: [PATCH] gpu: rootfs/initrd build init Initramfs expects /init, create symlink only if ${ROOTFS}/init does not exist Init may be provided by other packages, e.g. systemd or GPU initrd/rootfs Signed-off-by: Zvonko Kaiser --- tools/osbuilder/initrd-builder/initrd_builder.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/osbuilder/initrd-builder/initrd_builder.sh b/tools/osbuilder/initrd-builder/initrd_builder.sh index 19b02651bf..47af6d0a90 100755 --- a/tools/osbuilder/initrd-builder/initrd_builder.sh +++ b/tools/osbuilder/initrd-builder/initrd_builder.sh @@ -72,8 +72,9 @@ OK "init is installed" use AGENT_BIN env variable to change the expected agent binary name" OK "Agent is installed" -# initramfs expects /init -sudo ln -sf /sbin/init "${ROOTFS}/init" +# initramfs expects /init, create symlink only if ${ROOTFS}/init does not exist +# Init may be provided by other packages, e.g. systemd or GPU initrd/rootfs +[ -x "${ROOTFS}/init" ] || [ -L "${ROOTFS}/init" ] || sudo ln -sf /sbin/init "${ROOTFS}/init" info "Creating ${IMAGE_DIR}/${IMAGE_NAME} based on rootfs at ${ROOTFS}" ( cd "${ROOTFS}" && sudo find . | sudo cpio -H newc -o | gzip -9 ) > "${IMAGE_DIR}"/"${IMAGE_NAME}"