From: Daniel Hokka Zakrisson Date: Thu, 25 Oct 2007 01:18:49 +0000 (+0000) Subject: Add "Alpine Linux". X-Git-Tag: release-0.30.215~77 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33eeb52bf77d7077ec710119f74dd0b69c3a564a;p=util-vserver.git Add "Alpine Linux". git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2630 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/distrib/Makefile.am b/distrib/Makefile.am index 05bf69b..8a6b378 100644 --- a/distrib/Makefile.am +++ b/distrib/Makefile.am @@ -36,7 +36,9 @@ nobase_distrib_SCRIPTS = redhat/initpost \ redhat/rc.sysinit \ gentoo/initpost \ gentoo/initpre \ - debian/initpost + debian/initpost \ + alpine/initpre \ + alpine/initpost nobase_distrib_DATA = defaults/devs \ defaults/apt.conf \ diff --git a/distrib/alpine/initpost b/distrib/alpine/initpost new file mode 100644 index 0000000..d700067 --- /dev/null +++ b/distrib/alpine/initpost @@ -0,0 +1,68 @@ +#!/bin/bash + +# Copyright (C) 2007 Natanael Copa +# +# 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +## Called as: initpost + +cfgdir="$1" +vdir="$cfgdir"/vdir +. "$2" + +cd "$vdir" + +echo ">>> Creating missing dirs..." +$_CHROOT_SH mkdir proc sys dev home etc etc/rcL.d etc/rcK.d 2>/dev/null + +# remove mtab which is a link +if test -e "$vdir/etc/mtab"; then + $_CHROOT_SH rm /etc/mtab 2>/dev/null +fi + +# trick to install busybox links and 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 + /sbin/rc_add -s 20 -k syslog +' + +# set up hostname +if test -r "$cfgdir"/uts/nodename; then + 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 < "$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 +$_VSERVER "$vserver" stop &>/dev/null || true + diff --git a/distrib/alpine/initpre b/distrib/alpine/initpre new file mode 100644 index 0000000..58ea449 --- /dev/null +++ b/distrib/alpine/initpre @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright (C) 2007 Natanael Copa +# +# 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +## Called as: initpost + +vdir="$1"/vdir +. "$2" + +# 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 +