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