3 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
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 ## HACK: this script is full of races...
25 test ! -e "$2" -o -L "$2" || mv -f "$2"{,.orig}
29 ## Usage: subst <file> <regexp>
32 sed -e "$2" "$1" | $_CHROOT_CAT "$1".tmp
33 cmp -s "$1".tmp "$1" || cat "$1".tmp | $_CHROOT_CAT "$1"
37 pushd "$vdir"/etc/init.d &>/dev/null ||
38 pushd "$vdir"/etc/rc.d/init.d &>/dev/null || exit 1
41 test -e "$i" || continue
43 functions|halt|killall|single) ;;
46 $_VSERVER ----insecure "$1" chkconfig "$i" off
54 pushd "$vdir"/sbin &>/dev/null
55 relink /bin/true new-kernel-pkg
58 pushd "$vdir"/usr/bin &>/dev/null
59 relink /bin/true rhgb-client
62 pushd "$vdir"/etc &>/dev/null
63 # TODO: remove race/symlink-attack
64 echo 'NETWORKING=yes' >>sysconfig/network
67 pushd "$vdir" &>/dev/null
68 : | $_CHROOT_CAT /etc/sysctl.conf
69 echo "none / none defaults" | $_CHROOT_CAT /etc/fstab
70 cat "$__DISTRIBDIR"/redhat/rc.sysinit | $_CHROOT_CAT /etc/rc.d/rc.sysinit.vserver
71 # TODO: remove race/symlink-attack
72 chmod +x etc/rc.d/rc.sysinit.vserver
73 subst etc/inittab 's!^\([^#].*:respawn:.* tty\)!#\1!;
74 s!si::sysinit:/etc/rc.d/rc.sysinit!si::sysinit:/etc/rc.d/rc.sysinit.vserver!'