linka-cloud / d2vm

Build Virtual Machine Image from Dockerfile or Docker image
Apache License 2.0
208 stars 31 forks source link

alpine: replace manual init services configuration with the empty `/etc/.default_boot_services` file #6

Closed Adphi closed 1 year ago

Adphi commented 1 year ago

see init script:

https://github.com/alpinelinux/mkinitfs/blob/224826dcee28425a81bae099ade87fad797a5674/initramfs-init.in#L642-L669

if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
    # add some boot services by default
    rc_add devfs sysinit
    rc_add dmesg sysinit
    rc_add mdev sysinit
    rc_add hwdrivers sysinit
    rc_add modloop sysinit

    rc_add modules boot
    rc_add sysctl boot
    rc_add hostname boot
    rc_add bootmisc boot
    rc_add syslog boot

    rc_add mount-ro shutdown
    rc_add killprocs shutdown
    rc_add savecache shutdown

    rc_add firstboot default

    # add openssh
    if [ -n "$KOPT_ssh_key" ]; then
        pkgs="$pkgs openssh"
        rc_add sshd default
    fi

    rm -f "$sysroot/etc/.default_boot_services"
fi
Adphi commented 1 year ago

This would actually not work as the kernel cmdline has the root argument.