3 # Copyright (C) 2006 Benedikt Boehm <hollow@gentoo.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 2 of the License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 ## Called as: initpost <cfgdir> <path of util-vserver-vars>
27 NAME=$(< "$cfgdir"/name)
36 # go to vdir for chroot-sh
37 pushd "$vdir" &>/dev/null
40 # helper for sed in chroot
45 sedtmp=$($_MKTEMP chrootsed.XXXXXX)
47 $_CHROOT_SH cat "$file" | $_SED "$@" > $sedtmp
48 $_CHROOT_SH truncate "$file" < $sedtmp
54 # create a locale.gen if needed.
55 if test -n "$LANG" && test "$LANG" != "C"; then
56 echo $LANG $(locale charmap) | $_CHROOT_SH append /etc/locale.gen
60 # make apt and friends work
61 $_CHROOT_SH truncate /etc/apt/sources.list <<EOF
62 deb $MIRROR/ $DIST main
63 deb-src $MIRROR/ $DIST main
65 deb http://security.debian.org $DIST/updates main
70 if test -r "$cfgdir"/uts/nodename; then
71 $_CHROOT_SH truncate /etc/hostname < "$cfgdir"/uts/nodename
75 # setting default /etc/hosts
76 $_CHROOT_SH truncate /etc/hosts <<EOF
81 # The following lines are desirable for IPv6 capable hosts
82 # (added automatically by netbase upgrade)
84 ::1 ip6-localhost ip6-loopback
86 ff00::0 ip6-mcastprefix
88 ff02::2 ip6-allrouters
93 # copy proxy server statement from host if any
94 if test -f /etc/apt/apt.conf; then
95 $_CHROOT_SH truncate /etc/apt/apt.conf < /etc/apt/apt.conf
99 # fix gettys in inittab
100 if $_CHROOT_SH testfile /etc/inittab; then
101 chrootsed /etc/inittab \
102 -e 's/\(^[^#].*getty.*$\)/#\1/'
106 # fix /proc/cmdline in sendsigs
107 if $_CHROOT_SH testfile /etc/init.d/sendsigs; then
108 chrootsed /etc/init.d/sendsigs \
109 -e 's/^\(\s\+splash_back\)$/#\1/'
112 # from here on we need to do things live in the server
113 $_CHROOT_SH truncate /vserver-config.sh < "$__DISTRIBDIR"/etch/vserver-config.sh
114 $_CHROOT_SH chmod 0755 /vserver-config.sh
117 echo ">>> Executing post install script ... "
120 # start vserver before we can exec anything inside it
123 # run the configure commands from within the server
124 vserver $NAME exec /vserver-config.sh
125 $_CHROOT_SH rm /vserver-config.sh