diff options
Diffstat (limited to 'main/util-vserver/alpine.patch')
-rw-r--r-- | main/util-vserver/alpine.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/main/util-vserver/alpine.patch b/main/util-vserver/alpine.patch new file mode 100644 index 000000000..d3727db8a --- /dev/null +++ b/main/util-vserver/alpine.patch @@ -0,0 +1,120 @@ +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 <<EOF | $_CHROOT_SH truncate /etc/inittab +-::wait:/etc/init.d/rcL +-::ctrlaltdel:/etc/init.d/rcK ++# set up cmd.start and cmd stop if needed ++test -e "$1"/apps/init/style && initstyle=$(cat "$1"/apps/init/style) ++if test "$initstyle" == "openrc" -o "$initstyle" == "gentoo"; then ++ echo ">>> 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 <<EOF | $_CHROOT_SH truncate /lib/rc/sh/init-vserver.sh ++#!/bin/sh ++ ++RUNLEVEL=1 /sbin/rc sysinit && /sbin/rc boot || exit 1 ++/sbin/rc \${1:-default} ++exit 0 ++EOF ++ $_CHROOT_SH chmod 0755 /lib/rc/sh/init-vserver.sh ++ ++ $_CHROOT_SH mkdir /etc/init.d 2>/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 <<EOF | $_CHROOT_SH truncate /etc/inittab ++::sysinit:/sbin/rc sysinit ++::wait:/sbin/rc default ++::ctrlaltdel:/sbin/rc shutdown + ::ctrlaltdel:/usr/bin/killall5 -15 + EOF + +-# set up cmd.start and cmd stop if needed +-test -e "$1"/apps/init/style && initstlye=$(cat "$1"/apps/init/style) +-if test "$initstlye" != "plain"; then +- echo "/etc/init.d/rcL" > "$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 + + |