initial checkin
[util-vserver.git] / util-vserver / distrib / install-rh9.0
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 USR_LIB_VSERVER=$(dirname $0)
26 if [ $# -lt 1 ] ; then
27         echo install-rh9.0 vserver-id [ type ]
28         echo type minimum means, minimum package for a server
29         echo type large means, all packages on the first CD
30 elif [ -d /vservers/$1/var/lib/rpm ] ; then
31         echo /vservers/$1 already exist
32 elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then
33         echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
34 else
35         VROOT=/vservers/$1
36         $USR_LIB_VSERVER/install-pre.sh $1
37         mkdir -p $VROOT/proc
38         mount -t proc none $VROOT/proc
39         mount -t devpts none $VROOT/dev/pts
40         mkdir -p $VROOT/var/lib/rpm
41         rpm --root $VROOT --initdb
42         if [ "$2" = "minimum" ] ; then
43                 echo `cat $USR_LIB_VSERVER/rh9.0-minimum | wc -l` packages to install
44                 cd /mnt/cdrom/RedHat/RPMS
45                 rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh9.0-minimum`
46         else
47                 PKGS=`ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
48                          /mnt/cdrom/RedHat/RPMS/*.i386.rpm`
49                 for except in control-center iptables kernel-pcmcia-cs\
50                         nfs-utils pciutils quota rp-pppoe tcpdump \
51                         lokkit kudzu-devel pciutils-devel \
52                         redhat-config-securitylevel redhat-config-nfs
53                 do
54                         PKGS=`ls $PKGS | grep -v $except`
55                 done
56                 echo `echo $PKGS | wc -w` packages to install
57                 rpm --root $VROOT -Uvh $PKGS --nodeps
58         fi
59         umount $VROOT/proc
60         umount $VROOT/dev/pts
61         $USR_LIB_VSERVER/install-post.sh $1
62 fi
63
64