diff --git a/distrib/alpine/initpost b/distrib/alpine/initpost index 4bb639d..969e20c 100644 --- a/distrib/alpine/initpost +++ b/distrib/alpine/initpost @@ -23,8 +23,8 @@ vdir="$cfgdir"/vdir cd "$vdir" -echo ">>> Creating missing dirs..." -$_CHROOT_SH mkdir proc sys dev home etc etc/rcL.d etc/rcK.d 2>/dev/null +echo ">>> Creating missing dirs ..." +$_CHROOT_SH mkdir proc sys dev home etc run 2>/dev/null # remove mtab which is a link if test -e "$vdir/etc/mtab"; then @@ -32,40 +32,54 @@ if test -e "$vdir/etc/mtab"; then fi # trick to install busybox links and boot services -echo ">>> Installing boot services..." +echo ">>> Installing boot services ..." vserver="$1" -$_VSERVER "$vserver" stop &>/dev/null || true -$_VSERVER "$vserver" start --rescue --rescue-init /bin/busybox sh -c ' - /bin/busybox --install -s - if [ -x /sbin/rc-update ]; then - /sbin/rc-update add syslog boot - /bin/rmdir /etc/rcL.d /etc/rcK.d - else - /sbin/rc_add -s 20 -k syslog - fi -' +$_CHROOT_SH mkdir /etc/runlevels 2>/dev/null +$_CHROOT_SH mkdir /etc/runlevels/boot 2>/dev/null +$_CHROOT_SH link /etc/init.d/syslog /etc/runlevels/boot/syslog # set up hostname if test -r "$cfgdir"/uts/nodename; then - echo ">>> Setting hostname..." + echo ">>> Setting hostname ..." $_CHROOT_SH truncate /etc/hostname < "$cfgdir/uts/nodename" fi # create fstab echo -e "none\t/\tnone\tdefaults" | $_CHROOT_SH truncate /etc/fstab -# create busybox style inittab -cat <>> Installing openrc init-style magic ..." + $_CHROOT_SH mkdir /lib 2>/dev/null + $_CHROOT_SH mkdir /lib/rc 2>/dev/null + $_CHROOT_SH mkdir /lib/rc/sh 2>/dev/null + + cat </dev/null + echo "exit 0" | $_CHROOT_SH truncate /etc/init.d/shutdown.sh + $_CHROOT_SH chmod 0755 /etc/init.d/shutdown.sh + echo "exit 0" | $_CHROOT_SH truncate /etc/init.d/reboot.sh + $_CHROOT_SH chmod 0755 /etc/init.d/reboot.sh + +else + echo ">>> Creating busybox style inittab ..." + # create busybox style inittab + cat < "$cfgdir/apps/init/cmd.start" - echo "/etc/init.d/rcK" > "$cfgdir/apps/init/cmd.stop" fi # vserver should not be running at this point but lets be sure diff --git a/distrib/alpine/initpre b/distrib/alpine/initpre index 58ea449..0257e20 100644 --- a/distrib/alpine/initpre +++ b/distrib/alpine/initpre @@ -20,14 +20,19 @@ vdir="$1"/vdir . "$2" +echo ">>> Adding /run to fstab ..." +echo "none /run tmpfs size=1m,mode=0755 0 0" >> "$1"/fstab + # initstyle sanity initstyle=sysv test -e "$1"/apps/init/style && initstyle=$(cat "$1"/apps/init/style) echo ">>> Checking init-style ... $initstyle" -if test "$initstyle" != "sysv" && test "$initstyle" != "plain" ; then - echo "!!! The init-style is not supported for Alpine Linux" - echo "!!! Please use sysv or plain" -fi +case "$initstyle" in + plain|openrc|gentoo) ;; + *) echo "!!! The init-style $initstyle is not supported for Alpine Linux" + echo "!!! Please use plain or openrc" + ;; +esac