- moved here from sysv/
[util-vserver.git] / distrib / install-mdk8.2
1 #!/bin/sh
2 # $Id: install-mdk8.2,v 1.1.4.1 2003/10/30 15:17:33 ensc Exp $  --*- sh -*--
3
4 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 # based on install-mdk8.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
22 # This script creates a vserver from Mandrake 8.2 CD. Only
23 # the first CD is used and must be mounted in /mnt/cdrom.
24 # Specify the name of the vserver
25 # "install-mdk8.2 test" will create /vservers/test
26
27 : ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
28 test -e "$UTIL_VSERVER_VARS" || {
29     echo "Can not find util-vserver installation; aborting..."
30     exit 1
31 }
32 . "$UTIL_VSERVER_VARS"
33
34 USR_LIB_VSERVER=$PKGLIBDIR
35
36 if [ $# -lt 1 ] ; then
37         echo install-mdk8.2 vserver-id [ type ]
38         echo type minimum means, minimum package for a server
39         echo type large means, all packages on the first CD
40 elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
41         echo $VROOTDIR/$1 already exist
42 elif [ ! -d /mnt/cdrom/Mandrake/RPMS ] ; then
43         echo No rpms in /mnt/cdrom/Mandrake/RPMS. Is the CD mounted \?
44 else
45         VROOT=$VROOTDIR/$1
46         $USR_LIB_VSERVER/install-pre.sh $1
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/mdk8.2-minimum | wc -l` packages to install
53                 cd /mnt/cdrom/Mandrake/RPMS
54                 rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/mdk8.2-minimum`
55         else
56                 PKGS=`ls /mnt/cdrom/Mandrake/RPMS/*.i586.rpm | grep -v LPRng- \
57                         | grep -v lpr-`
58
59                 echo `(ls /mnt/cdrom/Mandrake/RPMS/*.noarch.rpm \
60                         ;echo $PKGS) | wc -w` packages to install
61                 rpm --root $VROOT -Uvh \
62                         /mnt/cdrom/Mandrake/RPMS/*.noarch.rpm \
63                         $PKGS --nodeps
64         fi
65         $USR_LIB_VSERVER/install-post.sh $1
66         umount $VROOT/proc
67 fi
68
69