- moved here from sysv/
[util-vserver.git] / distrib / install-fc2
1 #!/bin/sh
2
3 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 # based on distrib/install-rh9.0 by Jacques Gelinas
5 #  
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10 #  
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #  
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 # This script creates a vserver from RedHat 9.0 CD. Only
21 # the first CD is used and must be mounted in /mnt/cdrom.
22 # Specify the name of the vserver
23 # "install-rh9.0 test" will create /vservers/test
24
25 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
26 test -e "$UTIL_VSERVER_VARS" || {
27     echo "Can not find util-vserver installation; aborting..."
28     exit 1
29 }
30 . "$UTIL_VSERVER_VARS"
31
32 USR_LIB_VSERVER=$PKGLIBDIR
33
34 if [ $# -lt 1 ] ; then
35         echo $0 vserver-id [ group ]
36 elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
37         echo $VROOTDIR/$1 already exist
38 else
39         VROOT=$VROOTDIR/$1
40         $USR_LIB_VSERVER/install-pre.sh $1
41         mkdir -p $VROOT/proc
42         mount -t proc none $VROOT/proc
43         mount -t devpts none $VROOT/dev/pts
44         mkdir -p $VROOT/var/lib/rpm
45         rpm --root $VROOT --initdb
46         yum --installroot="$VROOT" -y groupinstall "$2"
47         umount $VROOT/proc
48         umount $VROOT/dev/pts
49         $USR_LIB_VSERVER/install-post.sh $1
50 fi