- moved here from sysv/
[util-vserver.git] / distrib / install-rh7.3
1 #!/bin/sh
2 # $Id: install-rh7.3,v 1.1.4.2 2004/02/06 22:20:29 ensc Exp $   --*- 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 : ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
27 test -e "$UTIL_VSERVER_VARS" || {
28     echo "Can not find util-vserver installation; aborting..."
29     exit 1
30 }
31 . "$UTIL_VSERVER_VARS"
32
33 USR_LIB_VSERVER=$PKGLIBDIR
34
35 if [ $# -lt 1 ] ; then
36         echo install-rh7.3 vserver-id [ type ]
37         echo type minimum means, minimum package for a server
38         echo type large means, all packages on the first CD
39 elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
40         echo $VROOTDIR/$1 already exist
41 elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then
42         echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
43 else
44         VROOT=$VROOTDIR/$1
45         mkdir -p -m755 $VROOT
46         chattr -t $VROOT
47         mkdir -p $VROOT/proc
48         mount -t proc none $VROOT/proc
49         mkdir -p $VROOT/var/lib/rpm
50         rpm --root $VROOT --initdb
51         if [ "$2" = "minimum" ] ; then
52                 echo `cat $USR_LIB_VSERVER/rh7.3-minimum | wc -l` packages to install
53                 cd /mnt/cdrom/RedHat/RPMS
54                 rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh7.3-minimum`
55         else
56                 echo `ls        /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
57                         /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install
58                 rpm --root $VROOT -Uvh \
59                         /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
60                         /mnt/cdrom/RedHat/RPMS/*.i386.rpm --nodeps
61         fi
62         $USR_LIB_VSERVER/install-post.sh $1
63         umount $VROOT/proc
64 fi
65
66