initial checkin
[util-vserver.git] / util-vserver / distrib / install-rh7.3
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.3 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.3 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.3 test" will create /vservers/test
25
26 USR_LIB_VSERVER=$(dirname $0)
27 if [ $# -lt 1 ] ; then
28         echo install-rh7.3 vserver-id [ type ]
29         echo type minimum means, minimum package for a server
30         echo type large means, all packages on the first CD
31 elif [ -d /vservers/$1/var/lib/rpm ] ; then
32         echo /vservers/$1 already exist
33 elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then
34         echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
35 else
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         if [ "$2" = "minimum" ] ; then
42                 echo `cat $USR_LIB_VSERVER/rh7.3-minimum | wc -l` packages to install
43                 cd /mnt/cdrom/RedHat/RPMS
44                 rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh7.3-minimum`
45         else
46                 echo `ls        /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
47                         /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install
48                 rpm --root $VROOT -Uvh \
49                         /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
50                         /mnt/cdrom/RedHat/RPMS/*.i386.rpm --nodeps
51         fi
52         $USR_LIB_VSERVER/install-post.sh $1
53         umount $VROOT/proc
54 fi
55
56