- moved here from sysv/
[util-vserver.git] / distrib / install-rh7.2
1 #!/bin/sh
2 # $Id: install-rh7.2,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.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 : ${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 [ $# != 1 ] ; then
36         echo install-rh7.2 vserver-id
37 elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
38         echo $VROOTDIR/$1 already exist
39 elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then
40         echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
41 else
42         echo `ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
43                 /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install
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         rpm --root $VROOT -Uvh \
52                 /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
53                 /mnt/cdrom/RedHat/RPMS/*.i386.rpm
54         $USR_LIB_VSERVER/install-post.sh $1
55         umount $VROOT/proc
56 fi
57
58