Subject: [PATCH] alpine linux initpost
From: Natanael Copa <natanael.copa@gmail.com>
Date: Fri, 13 Jan 2012 11:27:36 +0100
Fri, 13 Jan 2012 11:27:36 +0100
Hi,

Alpine linux switched to openrc (like gentoo) several years ago.

The attached patch adds support for that in initpost. It would be nice
it it could be applied upstream.

I would also like to mention that Alpine Linux ships a vserver
"livecd", which can run the vserver "host" root from tmpfs. It means
that you can boot your vserver kernel and from cdrom/CF/USB run the
host's root filesystem from tmpfs, and have the disks dedicated for
the vservers. (the config is stored in a file thats read at boot)

Benefit with that is that you can log in to the host and run the host
tools, even if one of the guests manages to block the disk IO
completely.

Another nice thing with Alpine Linux is that the base system is very
small, 6.1MB for a 64 bit guest and 5.9MB for 32 bit, so each new
alpine linux vserver adds very little overhead and all resources are
used for the application you want run in there. (mailservers,
webservers database etc)

Basically all infrastructure for alpine linux (web page, bug tracker
mysql, postresql, email server, build servers, development build
servers) runs vserver.

Thanks!

-- 
Natanael Copa


Index: distrib/alpine/initpost
===================================================================
--- a/distrib/alpine/initpost	(revision 2855)
+++ b/distrib/alpine/initpost	(working copy)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (C) 2007 Natanael Copa <ncopa@alpinelinux.org>
+# Copyright (C) 2007, 2012 Natanael Copa <ncopa@alpinelinux.org>
 #  
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -37,7 +37,12 @@
 $_VSERVER "$vserver" stop  &>/dev/null || true
 $_VSERVER "$vserver" start --rescue --rescue-init /bin/busybox sh -c '
 	/bin/busybox --install -s
-	/sbin/rc_add -s 20 -k syslog
+	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
 '
 
 # set up hostname