Bootstrap: scratch

%setup
    busybox_url='https://www.busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox'

    # Create necessary config files.
    printf 'root:!:0:0:root:/root:/bin/sh\n' > "${APPTAINER_ROOTFS}/etc/passwd"
    printf 'root:x:0:\n' > "${APPTAINER_ROOTFS}/etc/group"

    chmod 0644 "${APPTAINER_ROOTFS}/etc/passwd" "${APPTAINER_ROOTFS}/etc/group"

    # Create bin directory.
    mkdir "${APPTAINER_ROOTFS}/bin"
    chmod 0755 "${APPTAINER_ROOTFS}/bin"

    # Download busybox binary.
    curl -o "${APPTAINER_ROOTFS}/bin/busybox" "${busybox_url}"
    chmod 0755 "${APPTAINER_ROOTFS}/bin/busybox"

    # Install busybox.
    "${APPTAINER_ROOTFS}/bin/busybox" --install "${APPTAINER_ROOTFS}/bin"
