+#!/bin/sh
+# $Id: install-mdk8.2,v 1.1.4.1 2003/10/30 15:17:33 ensc Exp $ --*- sh -*--
+
+# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# based on install-mdk8.2 by Jacques Gelinas
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# This script creates a vserver from Mandrake 8.2 CD. Only
+# the first CD is used and must be mounted in /mnt/cdrom.
+# Specify the name of the vserver
+# "install-mdk8.2 test" will create /vservers/test
+
+: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo "Can not find util-vserver installation; aborting..."
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+
+USR_LIB_VSERVER=$PKGLIBDIR
+
+if [ $# -lt 1 ] ; then
+ echo install-mdk8.2 vserver-id [ type ]
+ echo type minimum means, minimum package for a server
+ echo type large means, all packages on the first CD
+elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
+ echo $VROOTDIR/$1 already exist
+elif [ ! -d /mnt/cdrom/Mandrake/RPMS ] ; then
+ echo No rpms in /mnt/cdrom/Mandrake/RPMS. Is the CD mounted \?
+else
+ VROOT=$VROOTDIR/$1
+ $USR_LIB_VSERVER/install-pre.sh $1
+ mkdir -p $VROOT/proc
+ mount -t proc none $VROOT/proc
+ mkdir -p $VROOT/var/lib/rpm
+ rpm --root $VROOT --initdb
+ if [ "$2" = "minimum" ] ; then
+ echo `cat $USR_LIB_VSERVER/mdk8.2-minimum | wc -l` packages to install
+ cd /mnt/cdrom/Mandrake/RPMS
+ rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/mdk8.2-minimum`
+ else
+ PKGS=`ls /mnt/cdrom/Mandrake/RPMS/*.i586.rpm | grep -v LPRng- \
+ | grep -v lpr-`
+
+ echo `(ls /mnt/cdrom/Mandrake/RPMS/*.noarch.rpm \
+ ;echo $PKGS) | wc -w` packages to install
+ rpm --root $VROOT -Uvh \
+ /mnt/cdrom/Mandrake/RPMS/*.noarch.rpm \
+ $PKGS --nodeps
+ fi
+ $USR_LIB_VSERVER/install-post.sh $1
+ umount $VROOT/proc
+fi
+
+