+++ /dev/null
-## $Id: Makefile-files,v 1.1.4.1 2004/04/03 01:40:08 ensc Exp $ -*- makefile -*-
-
-## Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-##
-## 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.
-
-distrib_SCRPTS = distrib/install-mdk8.2 \
- distrib/install-post.sh \
- distrib/install-pre.sh \
- distrib/install-rh7.2 \
- distrib/install-rh7.3 \
- distrib/install-rh8.0 \
- distrib/install-rh9.0 \
- distrib/install-fc1 \
- distrib/sample.sh
-
-distrib_DAT = distrib/mdk8.2-minimum \
- distrib/rh7.3-minimum \
- distrib/rh8.0-minimum \
- distrib/rh9.0-minimum \
- distrib/fc1-minimum \
- distrib/sample.conf
-
+++ /dev/null
-chkconfig-[0-9]*.i386.rpm
-glibc-[0-9]*.i386.rpm
-glibc-common-[0-9]*.i386.rpm
-coreutils-[0-9]*.i386.rpm
-termcap-*.noarch.rpm
-libtermcap-[0-9]*.i386.rpm
-ethtool-[0-9]*.i386.rpm
-tzdata-2003d-1.noarch.rpm
-beecrypt-3.0.1-0.20030630.1.i386.rpm
-elfutils-libelf-0.89-2.i386.rpm
-tcp_wrappers-7.6-34.as21.1.i386.rpm
-gpm-[0-9]*.i386.rpm
-4Suite-[0-9]*.i386.rpm
-MAKEDEV-[0-9]*.i386.rpm
-PyXML-[0-9]*.i386.rpm
-SysVinit-[0-9]*.i386.rpm
-a2ps-[0-9]*.i386.rpm
-alchemist-[0-9]*.i386.rpm
-anacron-[0-9]*.i386.rpm
-ash-[0-9]*.i386.rpm
-at-[0-9]*.i386.rpm
-audiofile-[0-9]*.i386.rpm
-authconfig-[0-9]*.i386.rpm
-basesystem-*.noarch.rpm
-bash-[0-9]*.i386.rpm
-bzip2-[0-9]*.i386.rpm
-bzip2-libs-[0-9]*.i386.rpm
-cpio-[0-9]*.i386.rpm
-cracklib-[0-9]*.i386.rpm
-cracklib-dicts-[0-9]*.i386.rpm
-crontabs-*.noarch.rpm
-cyrus-sasl-[0-9]*.i386.rpm
-cyrus-sasl-md5-[0-9]*.i386.rpm
-db4-[0-9]*.i386.rpm
-dev-[0-9]*.i386.rpm
-diffutils-[0-9]*.i386.rpm
-dosfstools-[0-9]*.i386.rpm
-e2fsprogs-[0-9]*.i386.rpm
-ed-[0-9]*.i386.rpm
-fam-[0-9]*.i386.rpm
-file-[0-9]*.i386.rpm
-filesystem-[0-9]*.i386.rpm
-findutils-[0-9]*.i386.rpm
-libacl-[0-9]*.i386.rpm
-libgcc-[0-9]*.i386.rpm
-freetype-[0-9]*.i386.rpm
-gawk-[0-9]*.i386.rpm
-gdbm-[0-9]*.i386.rpm
-glib-[0-9]*.i386.rpm
-glib2-[0-9]*.i386.rpm
-gnupg-[0-9]*.i386.rpm
-grep-[0-9]*.i386.rpm
-groff-[0-9]*.i386.rpm
-gzip-[0-9]*.i386.rpm
-indexhtml-*.noarch.rpm
-info-[0-9]*.i386.rpm
-initscripts-[0-9]*.i386.rpm
-iputils-[0-9]*.i386.rpm
-less-[0-9]*.i386.rpm
-libcap-[0-9]*.i386.rpm
-libghttp-[0-9]*.i386.rpm
-libjpeg-[0-9]*.i386.rpm
-libmng-[0-9]*.i386.rpm
-libogg-[0-9]*.i386.rpm
-libpng-[0-9]*.i386.rpm
-libstdc++-[0-9]*.i386.rpm
-libtiff-[0-9]*.i386.rpm
-libuser-[0-9]*.i386.rpm
-libvorbis-[0-9]*.i386.rpm
-libxml-[0-9]*.i386.rpm
-libxml2-[0-9]*.i386.rpm
-libxslt-[0-9]*.i386.rpm
-logrotate-[0-9]*.i386.rpm
-losetup-[0-9]*.i386.rpm
-m4-[0-9]*.i386.rpm
-mailcap-*.noarch.rpm
-mailx-[0-9]*.i386.rpm
-make-[0-9]*.i386.rpm
-man-[0-9]*.i386.rpm
-man-pages-*.noarch.rpm
-mktemp-[0-9]*.i386.rpm
-mount-[0-9]*.i386.rpm
-mpage-[0-9]*.i386.rpm
-ncurses-[0-9]*.i386.rpm
-netpbm-[0-9]*.i386.rpm
-newt-[0-9]*.i386.rpm
-ntsysv-[0-9]*.i386.rpm
-openldap-[0-9]*.i386.rpm
-openssh-[0-9]*.i386.rpm
-openssh-clients-[0-9]*.i386.rpm
-openssh-server-[0-9]*.i386.rpm
-openssl-[0-9]*.i386.rpm
-pam-[0-9]*.i386.rpm
-passwd-[0-9]*.i386.rpm
-patch-[0-9]*.i386.rpm
-pcre-[0-9]*.i386.rpm
-perl-[0-9]*.i386.rpm
-perl-Filter-[0-9]*.i386.rpm
-krb5-libs-[0-9]*.i386.rpm
-libattr-[0-9]*.i386.rpm
-hesiod-[0-9]*.i386.rpm
-pnm2ppa-[0-9]*.i386.rpm
-popt-[0-9]*.i386.rpm
-portmap-[0-9]*.i386.rpm
-procmail-[0-9]*.i386.rpm
-procps-[0-9]*.i386.rpm
-psmisc-[0-9]*.i386.rpm
-psutils-[0-9]*.i386.rpm
-python-[0-9]*.i386.rpm
-readline-[0-9]*.i386.rpm
-fedora-release-*.i386.rpm
-rootfiles-*.noarch.rpm
-rpm-[0-9]*.i386.rpm
-sed-[0-9]*.i386.rpm
-sendmail-[0-9]*.i386.rpm
-setup-*.noarch.rpm
-sgml-common-*.noarch.rpm
-shadow-utils-[0-9]*.i386.rpm
-slang-[0-9]*.i386.rpm
-slocate-[0-9]*.i386.rpm
-specspo-*.noarch.rpm
-sysklogd-[0-9]*.i386.rpm
-tar-[0-9]*.i386.rpm
-tcl-[0-9]*.i386.rpm
-tcsh-[0-9]*.i386.rpm
-time-[0-9]*.i386.rpm
-tmpwatch-[0-9]*.i386.rpm
-umb-scheme-[0-9]*.i386.rpm
-unzip-[0-9]*.i386.rpm
-usermode-[0-9]*.i386.rpm
-utempter-[0-9]*.i386.rpm
-util-linux-[0-9]*.i386.rpm
-vim-common-[0-9]*.i386.rpm
-vim-minimal-[0-9]*.i386.rpm
-vixie-cron-[0-9]*.i386.rpm
-which-[0-9]*.i386.rpm
-words-*.noarch.rpm
-xinetd-[0-9]*.i386.rpm
-zip-[0-9]*.i386.rpm
-zlib-[0-9]*.i386.rpm
-mingetty-[0-9]*.i386.rpm
-iproute-[0-9]*.i386.rpm
-modutils-[0-9]*.i386.rpm
-gmp-[0-9]*.i386.rpm
-expat-[0-9]*.i386.rpm
-net-tools-[0-9]*.i386.rpm
-nscd-[0-9]*.i386.rpm
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-rh9.0 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 RedHat Fedora Core 1 CD. Only
-# the first CD is used and must be mounted in /mnt/cdrom.
-# Specify the name of the vserver
-# "install-fc1 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-fc1 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/Fedora/RPMS ] ; then
- echo No rpms in /mnt/cdrom/Fedora/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
- mount -t devpts none $VROOT/dev/pts
- mkdir -p $VROOT/var/lib/rpm
- rpm --root $VROOT --initdb
- if [ "$2" = "minimum" ] ; then
- echo `cat $USR_LIB_VSERVER/fc1-minimum | wc -l` packages to install
- cd /mnt/cdrom/Fedora/RPMS
- rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/fc1-minimum`
- else
- PKGS=`ls /mnt/cdrom/Fedora/RPMS/*.noarch.rpm \
- /mnt/cdrom/Fedora/RPMS/*.i386.rpm`
- for except in control-center iptables kernel-pcmcia-cs\
- nfs-utils pciutils quota rp-pppoe tcpdump \
- lokkit kudzu-devel pciutils-devel \
- redhat-config-securitylevel redhat-config-nfs
- do
- PKGS=`ls $PKGS | grep -v $except`
- done
- echo `echo $PKGS | wc -w` packages to install
- rpm --root $VROOT -Uvh $PKGS --nodeps
- fi
- umount $VROOT/proc
- umount $VROOT/dev/pts
- $USR_LIB_VSERVER/install-post.sh $1
-fi
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-post 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.
-
-# Complete the installation of a vserver
-: ${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
-
-vserver_mknod()
-{
- mknod $1 $2 $3 $4
- chmod $5 $1
-}
-
-if [ $# != 1 ] ; then
- echo install-post.sh vserver
-else
- VROOT=$VROOTDIR/$1
- rm -fr $VROOT/dev
- mkdir $VROOT/dev && chmod 755 $VROOT/dev
- mkdir $VROOT/dev/pts
- vserver_mknod $VROOT/dev/null c 1 3 666
- vserver_mknod $VROOT/dev/zero c 1 5 666
- vserver_mknod $VROOT/dev/full c 1 7 666
- vserver_mknod $VROOT/dev/random c 1 8 644
- vserver_mknod $VROOT/dev/urandom c 1 9 644
- vserver_mknod $VROOT/dev/tty c 5 0 666
- vserver_mknod $VROOT/dev/ptmx c 5 2 666
- test -f /etc/vservers/$1.conf || cp $USR_LIB_VSERVER/sample.conf /etc/vservers/$1.conf
- test -f /etc/vservers/$1.sh || cp $USR_LIB_VSERVER/sample.sh /etc/vservers/$1.sh
- echo NETWORKING=yes >$VROOT/etc/sysconfig/network
- echo HOSTNAME=$1 >>$VROOT/etc/sysconfig/network
- (
- cd $VROOT/etc/rc.d/init.d || cd $VROOT/etc/init.d
- for serv in *
- do
- case $serv in
- *.bak|*~|functions|killall|halt|single)
- ;;
- *)
- $USR_LIB_VSERVER/capchroot $VROOTDIR/$1 /sbin/chkconfig --level 2345 $serv off
- ;;
- esac
- done
- rm -f $VROOT/etc/rc.d/rc6.d/S*reboot
- )
- if [ ! -f $VROOT/etc/fstab ] ; then
- echo /dev/hdv1 / ext2 defaults 1 1 >$VROOT/etc/fstab
- echo /dev/hdv1 / ext2 rw 1 1 >$VROOT/etc/mtab
- fi
- cp -a $USR_LIB_VSERVER/vreboot $VROOT/sbin/.
- ln -sf vreboot $VROOT/sbin/vhalt
- if [ -x /etc/vservers/install-post.sh ]; then
- /etc/vservers/install-post.sh $VROOT
- fi
-fi
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-pre 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.
-
-: ${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"
-
-vserver_mknod()
-{
- mknod $1 $2 $3 $4
- chmod $5 $1
-}
-
-if [ $# != 1 ] ; then
- echo install-pre.sh vserver
-else
- mkdir -p /etc/vservers
- mkdir -p $VROOTDIR 2>/dev/null
- VROOT=$VROOTDIR/$1
- mkdir -p -m755 $VROOT
- chattr -t $VROOT
- rm -fr $VROOT/dev
- mkdir -p $VROOT/dev && chmod 755 $VROOT/dev
- mkdir $VROOT/dev/pts
- vserver_mknod $VROOT/dev/null c 1 3 666
- vserver_mknod $VROOT/dev/zero c 1 5 666
- vserver_mknod $VROOT/dev/full c 1 7 666
- vserver_mknod $VROOT/dev/random c 1 8 644
- vserver_mknod $VROOT/dev/urandom c 1 9 644
- vserver_mknod $VROOT/dev/tty c 5 0 666
- vserver_mknod $VROOT/dev/ptmx c 5 2 666
- # We fake this device to help some package managers
- touch $VROOT/dev/hdv1
-fi
-
+++ /dev/null
-#!/bin/sh
-# $Id: install-rh7.2,v 1.1.4.2 2004/02/06 22:20:29 ensc Exp $ --*- sh -*--
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-rh7.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 RedHat 7.2 CD. Only
-# the first CD is used and must be mounted in /mnt/cdrom.
-# Specify the name of the vserver
-# "install-rh7.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 [ $# != 1 ] ; then
- echo install-rh7.2 vserver-id
-elif [ -d $VROOTDIR/$1/var/lib/rpm ] ; then
- echo $VROOTDIR/$1 already exist
-elif [ ! -d /mnt/cdrom/RedHat/RPMS ] ; then
- echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
-else
- echo `ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install
- VROOT=$VROOTDIR/$1
- mkdir -p -m755 $VROOT
- chattr -t $VROOT
- mkdir -p $VROOT/proc
- mount -t proc none $VROOT/proc
- mkdir -p $VROOT/var/lib/rpm
- rpm --root $VROOT --initdb
- rpm --root $VROOT -Uvh \
- /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm
- $USR_LIB_VSERVER/install-post.sh $1
- umount $VROOT/proc
-fi
-
-
+++ /dev/null
-#!/bin/sh
-# $Id: install-rh7.3,v 1.1.4.2 2004/02/06 22:20:29 ensc Exp $ --*- sh -*--
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-rh7.3 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 RedHat 7.3 CD. Only
-# the first CD is used and must be mounted in /mnt/cdrom.
-# Specify the name of the vserver
-# "install-rh7.3 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-rh7.3 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/RedHat/RPMS ] ; then
- echo No rpms in /mnt/cdrom/RedHat/RPMS. Is the CD mounted \?
-else
- VROOT=$VROOTDIR/$1
- mkdir -p -m755 $VROOT
- chattr -t $VROOT
- 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/rh7.3-minimum | wc -l` packages to install
- cd /mnt/cdrom/RedHat/RPMS
- rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh7.3-minimum`
- else
- echo `ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm | wc -l` packages to install
- rpm --root $VROOT -Uvh \
- /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm --nodeps
- fi
- $USR_LIB_VSERVER/install-post.sh $1
- umount $VROOT/proc
-fi
-
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-rh8.0 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 RedHat 8.0 CD. Only
-# the first CD is used and must be mounted in /mnt/cdrom.
-# Specify the name of the vserver
-# "install-rh8.0 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-rh8.0 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/RedHat/RPMS ] ; then
- echo No rpms in /mnt/cdrom/RedHat/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
- mount -t devpts none $VROOT/dev/pts
- mkdir -p $VROOT/var/lib/rpm
- rpm --root $VROOT --initdb
- if [ "$2" = "minimum" ] ; then
- echo `cat $USR_LIB_VSERVER/rh8.0-minimum | wc -l` packages to install
- cd /mnt/cdrom/RedHat/RPMS
- rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh8.0-minimum`
- else
- PKGS=`ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm`
- for except in control-center iptables kernel-pcmcia-cs\
- nfs-utils pciutils quota rp-pppoe tcpdump \
- lokkit kudzu-devel pciutils-devel
- do
- PKGS=`ls $PKGS | grep -v $except`
- done
- echo `echo $PKGS | wc -w` packages to install
- rpm --root $VROOT -Uvh $PKGS
- fi
- umount $VROOT/proc
- umount $VROOT/dev/pts
- $USR_LIB_VSERVER/install-post.sh $1
-fi
-
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib/install-rh9.0 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 RedHat 9.0 CD. Only
-# the first CD is used and must be mounted in /mnt/cdrom.
-# Specify the name of the vserver
-# "install-rh9.0 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-rh9.0 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/RedHat/RPMS ] ; then
- echo No rpms in /mnt/cdrom/RedHat/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
- mount -t devpts none $VROOT/dev/pts
- mkdir -p $VROOT/var/lib/rpm
- rpm --root $VROOT --initdb
- if [ "$2" = "minimum" ] ; then
- echo `cat $USR_LIB_VSERVER/rh9.0-minimum | wc -l` packages to install
- cd /mnt/cdrom/RedHat/RPMS
- rpm --root $VROOT -Uvh `cat $USR_LIB_VSERVER/rh9.0-minimum`
- else
- PKGS=`ls /mnt/cdrom/RedHat/RPMS/*.noarch.rpm \
- /mnt/cdrom/RedHat/RPMS/*.i386.rpm`
- for except in control-center iptables kernel-pcmcia-cs\
- nfs-utils pciutils quota rp-pppoe tcpdump \
- lokkit kudzu-devel pciutils-devel \
- redhat-config-securitylevel redhat-config-nfs
- do
- PKGS=`ls $PKGS | grep -v $except`
- done
- echo `echo $PKGS | wc -w` packages to install
- rpm --root $VROOT -Uvh $PKGS --nodeps
- fi
- umount $VROOT/proc
- umount $VROOT/dev/pts
- $USR_LIB_VSERVER/install-post.sh $1
-fi
-
-
+++ /dev/null
-4Suite-0.11.1-8.i386.rpm
-Canna-3.5b2-62.i386.rpm
-Canna-libs-3.5b2-62.i386.rpm
-Distutils-1.0.2-2.noarch.rpm
-MAKEDEV-3.3-4.i386.rpm
-PyXML-0.7-4.i386.rpm
-SysVinit-2.84-2.i386.rpm
-a2ps-4.13b-19.i386.rpm
-alchemist-1.0.23-1.i386.rpm
-anacron-2.3-17.i386.rpm
-ash-0.3.7-2.i386.rpm
-at-3.1.8-23.i386.rpm
-audiofile-0.2.3-1.i386.rpm
-authconfig-4.2.8-4.i386.rpm
-basesystem-7.0-2.noarch.rpm
-bash-2.05a-13.i386.rpm
-bdflush-1.5-17.i386.rpm
-bzip2-1.0.2-2.i386.rpm
-bzip2-libs-1.0.2-2.i386.rpm
-chkconfig-1.3.5-3.i386.rpm
-cpio-2.4.2-26.i386.rpm
-cracklib-2.7-15.i386.rpm
-cracklib-dicts-2.7-15.i386.rpm
-crontabs-1.10-1.noarch.rpm
-cyrus-sasl-1.5.24-25.i386.rpm
-cyrus-sasl-md5-1.5.24-25.i386.rpm
-cyrus-sasl-plain-1.5.24-25.i386.rpm
-db1-1.85-8.i386.rpm
-db2-2.4.14-10.i386.rpm
-db3-3.3.11-6.i386.rpm
-dev-3.3-4.i386.rpm
-diffutils-2.7.2-5.i386.rpm
-dosfstools-2.8-1.i386.rpm
-e2fsprogs-1.27-3.i386.rpm
-ed-0.2-25.i386.rpm
-fam-2.6.7-6.i386.rpm
-file-3.37-5.i386.rpm
-filesystem-2.1.6-2.noarch.rpm
-fileutils-4.1-10.i386.rpm
-findutils-4.1.7-4.i386.rpm
-freetype-2.0.9-2.i386.rpm
-gawk-3.1.0-4.i386.rpm
-gdbm-1.8.0-14.i386.rpm
-glib-1.2.10-5.i386.rpm
-glib2-2.0.1-2.i386.rpm
-glibc-2.2.5-34.i386.rpm
-glibc-common-2.2.5-34.i386.rpm
-gnupg-1.0.6-5.i386.rpm
-grep-2.5.1-1.i386.rpm
-groff-1.17.2-12.i386.rpm
-groff-perl-1.17.2-12.i386.rpm
-gzip-1.3.3-1.i386.rpm
-htdig-3.2.0-2.011302.i386.rpm
-indexhtml-7.3-3.noarch.rpm
-info-4.1-1.i386.rpm
-initscripts-6.67-1.i386.rpm
-iputils-20020124-3.i386.rpm
-less-358-24.i386.rpm
-libcap-1.10-8.i386.rpm
-libghttp-1.0.9-2.i386.rpm
-libjpeg-6b-19.i386.rpm
-libmng-1.0.3-2.i386.rpm
-libogg-1.0rc3-1.i386.rpm
-libpng-1.0.12-2.i386.rpm
-libstdc++-2.96-110.i386.rpm
-libtermcap-2.0.8-28.i386.rpm
-libtiff-3.5.7-2.i386.rpm
-libtool-libs-1.4.2-7.i386.rpm
-libunicode-0.4-6.i386.rpm
-libuser-0.50.2-1.i386.rpm
-libvorbis-1.0rc3-1.i386.rpm
-libxml-1.8.17-3.i386.rpm
-libxml2-2.4.19-4.i386.rpm
-libxslt-1.0.15-1.i386.rpm
-logrotate-3.6.4-1.i386.rpm
-losetup-2.11n-12.i386.rpm
-m4-1.4.1-7.i386.rpm
-mailcap-2.1.9-2.noarch.rpm
-mailx-8.1.1-22.i386.rpm
-make-3.79.1-8.i386.rpm
-man-1.5j-6.i386.rpm
-man-pages-1.48-2.noarch.rpm
-mktemp-1.5-14.i386.rpm
-mount-2.11n-12.i386.rpm
-mpage-2.5.1-9.i386.rpm
-ncurses-5.2-26.i386.rpm
-netpbm-9.24-3.i386.rpm
-netpbm-progs-9.24-3.i386.rpm
-newt-0.50.35-1.i386.rpm
-nhpf-1.42-2.i386.rpm
-ntsysv-1.3.5-3.i386.rpm
-openldap-2.0.23-4.i386.rpm
-openssh-3.1p1-3.i386.rpm
-openssh-clients-3.1p1-3.i386.rpm
-openssl-0.9.6b-18.i386.rpm
-pam-0.75-32.i386.rpm
-passwd-0.67-1.i386.rpm
-patch-2.5.4-12.i386.rpm
-pcre-3.9-2.i386.rpm
-perl-5.6.1-34.99.6.i386.rpm
-perl-CGI-2.752-34.99.6.i386.rpm
-perl-CPAN-1.59_54-34.99.6.i386.rpm
-perl-DB_File-1.75-34.99.6.i386.rpm
-perl-DateManip-5.40-15.i386.rpm
-perl-Digest-MD5-2.16-15.i386.rpm
-perl-File-MMagic-1.13-14.i386.rpm
-perl-HTML-Parser-3.26-2.i386.rpm
-perl-HTML-Tagset-3.03-14.i386.rpm
-perl-MIME-Base64-2.12-14.i386.rpm
-perl-NDBM_File-1.75-34.99.6.i386.rpm
-perl-NKF-1.71-2.i386.rpm
-perl-Parse-Yapp-1.05-15.i386.rpm
-perl-Storable-1.0.14-15.i386.rpm
-perl-URI-1.17-16.i386.rpm
-perl-XML-Dumper-0.4-12.noarch.rpm
-perl-XML-Encoding-1.01-9.noarch.rpm
-perl-XML-Grove-0.46alpha-11.noarch.rpm
-perl-XML-Parser-2.30-15.i386.rpm
-perl-XML-Twig-2.02-9.noarch.rpm
-perl-libnet-1.0901-17.i386.rpm
-perl-libwww-perl-5.63-9.i386.rpm
-perl-libxml-enno-1.02-15.i386.rpm
-perl-libxml-perl-0.07-14.noarch.rpm
-pnm2ppa-1.04-2.i386.rpm
-popt-1.6.4-7x.18.i386.rpm
-portmap-4.0-41.i386.rpm
-procmail-3.22-5.i386.rpm
-procps-2.0.7-12.i386.rpm
-psmisc-20.2-2.i386.rpm
-pspell-0.12.2-8.i386.rpm
-psutils-1.17-13.i386.rpm
-pwdb-0.61.2-2.i386.rpm
-python-1.5.2-38.i386.rpm
-python-clap-1.0.0-3.noarch.rpm
-python-popt-0.8.8-7.x.2.i386.rpm
-python-xmlrpc-1.5.1-7.x.3.i386.rpm
-python2-2.2-16.i386.rpm
-readline-4.2a-4.i386.rpm
-redhat-release-7.3-1.noarch.rpm
-rootfiles-7.2-1.noarch.rpm
-rpm-4.0.4-7x.18.i386.rpm
-rpm-python-4.0.4-7x.18.i386.rpm
-sed-3.02-11.i386.rpm
-sendmail-8.11.6-15.i386.rpm
-setup-2.5.12-1.noarch.rpm
-sgml-common-0.6.3-9.noarch.rpm
-sh-utils-2.0.11-14.i386.rpm
-shadow-utils-20000902-7.i386.rpm
-slang-1.4.5-2.i386.rpm
-slocate-2.6-1.i386.rpm
-specspo-7.3-4.noarch.rpm
-sysklogd-1.4.1-8.i386.rpm
-tar-1.13.25-4.i386.rpm
-tcl-8.3.3-67.i386.rpm
-tcsh-6.10-6.i386.rpm
-termcap-11.0.1-10.noarch.rpm
-textutils-2.0.21-1.i386.rpm
-time-1.7-16.i386.rpm
-tmpwatch-2.8.3-1.i386.rpm
-umb-scheme-3.2-21.i386.rpm
-unzip-5.50-2.i386.rpm
-usermode-1.53-2.i386.rpm
-utempter-0.5.2-6.i386.rpm
-util-linux-2.11n-12.i386.rpm
-vim-common-6.1-2.i386.rpm
-vim-minimal-6.1-2.i386.rpm
-vixie-cron-3.0.1-64.i386.rpm
-which-2.13-3.i386.rpm
-words-2-18.noarch.rpm
-xinetd-2.3.4-0.8.i386.rpm
-xml-common-0.6.3-9.noarch.rpm
-zip-2.3-12.i386.rpm
-zlib-1.1.3-25.7.i386.rpm
-mingetty-1.00-1.i386.rpm
-iproute-2.4.7-1.i386.rpm
-modutils-2.4.14-3.i386.rpm
-gmp-4.0.1-3.i386.rpm
-expat-1.95.2-2.i386.rpm
-net-tools-1.60-4.i386.rpm
+++ /dev/null
-4Suite-0.11.1-8.i386.rpm
-Canna-3.5b2-62.i386.rpm
-Canna-libs-3.5b2-62.i386.rpm
-Distutils-1.0.2-2.noarch.rpm
-MAKEDEV-3.3-4.i386.rpm
-PyXML-0.7-4.i386.rpm
-SysVinit-2.84-2.i386.rpm
-a2ps-4.13b-19.i386.rpm
-alchemist-1.0.23-1.i386.rpm
-anacron-2.3-17.i386.rpm
-ash-0.3.7-2.i386.rpm
-at-3.1.8-23.i386.rpm
-audiofile-0.2.3-1.i386.rpm
-authconfig-4.2.8-4.i386.rpm
-basesystem-7.0-2.noarch.rpm
-bash-2.05a-13.i386.rpm
-bdflush-1.5-17.i386.rpm
-bzip2-1.0.2-2.i386.rpm
-bzip2-libs-1.0.2-2.i386.rpm
-chkconfig-1.3.5-3.i386.rpm
-cpio-2.4.2-26.i386.rpm
-cracklib-2.7-15.i386.rpm
-cracklib-dicts-2.7-15.i386.rpm
-crontabs-1.10-1.noarch.rpm
-cyrus-sasl-1.5.24-25.i386.rpm
-cyrus-sasl-md5-1.5.24-25.i386.rpm
-cyrus-sasl-plain-1.5.24-25.i386.rpm
-db1-1.85-8.i386.rpm
-db2-2.4.14-10.i386.rpm
-db3-3.3.11-6.i386.rpm
-dev-3.3-4.i386.rpm
-diffutils-2.7.2-5.i386.rpm
-dosfstools-2.8-1.i386.rpm
-e2fsprogs-1.27-3.i386.rpm
-ed-0.2-25.i386.rpm
-fam-2.6.7-6.i386.rpm
-file-3.37-5.i386.rpm
-filesystem-2.1.6-2.noarch.rpm
-fileutils-4.1-10.i386.rpm
-findutils-4.1.7-4.i386.rpm
-freetype-2.0.9-2.i386.rpm
-gawk-3.1.0-4.i386.rpm
-gdbm-1.8.0-14.i386.rpm
-glib-1.2.10-5.i386.rpm
-glib2-2.0.1-2.i386.rpm
-glibc-2.2.5-34.i386.rpm
-glibc-common-2.2.5-34.i386.rpm
-gnupg-1.0.6-5.i386.rpm
-grep-2.5.1-1.i386.rpm
-groff-1.17.2-12.i386.rpm
-groff-perl-1.17.2-12.i386.rpm
-gzip-1.3.3-1.i386.rpm
-htdig-3.2.0-2.011302.i386.rpm
-indexhtml-7.3-3.noarch.rpm
-info-4.1-1.i386.rpm
-initscripts-6.67-1.i386.rpm
-iputils-20020124-3.i386.rpm
-less-358-24.i386.rpm
-libcap-1.10-8.i386.rpm
-libghttp-1.0.9-2.i386.rpm
-libjpeg-6b-19.i386.rpm
-libmng-1.0.3-2.i386.rpm
-libogg-1.0rc3-1.i386.rpm
-libpng-1.0.12-2.i386.rpm
-libstdc++-2.96-110.i386.rpm
-libtermcap-2.0.8-28.i386.rpm
-libtiff-3.5.7-2.i386.rpm
-libtool-libs-1.4.2-7.i386.rpm
-libunicode-0.4-6.i386.rpm
-libuser-0.50.2-1.i386.rpm
-libvorbis-1.0rc3-1.i386.rpm
-libxml-1.8.17-3.i386.rpm
-libxml2-2.4.19-4.i386.rpm
-libxslt-1.0.15-1.i386.rpm
-logrotate-3.6.4-1.i386.rpm
-losetup-2.11n-12.i386.rpm
-m4-1.4.1-7.i386.rpm
-mailcap-2.1.9-2.noarch.rpm
-mailx-8.1.1-22.i386.rpm
-make-3.79.1-8.i386.rpm
-man-1.5j-6.i386.rpm
-man-pages-1.48-2.noarch.rpm
-mktemp-1.5-14.i386.rpm
-mount-2.11n-12.i386.rpm
-mpage-2.5.1-9.i386.rpm
-ncurses-5.2-26.i386.rpm
-netpbm-9.24-3.i386.rpm
-netpbm-progs-9.24-3.i386.rpm
-newt-0.50.35-1.i386.rpm
-nhpf-1.42-2.i386.rpm
-ntsysv-1.3.5-3.i386.rpm
-openldap-2.0.23-4.i386.rpm
-openssh-3.1p1-3.i386.rpm
-openssh-clients-3.1p1-3.i386.rpm
-openssl-0.9.6b-18.i386.rpm
-pam-0.75-32.i386.rpm
-passwd-0.67-1.i386.rpm
-patch-2.5.4-12.i386.rpm
-pcre-3.9-2.i386.rpm
-perl-5.6.1-34.99.6.i386.rpm
-perl-CGI-2.752-34.99.6.i386.rpm
-perl-CPAN-1.59_54-34.99.6.i386.rpm
-perl-DB_File-1.75-34.99.6.i386.rpm
-perl-DateManip-5.40-15.i386.rpm
-perl-Digest-MD5-2.16-15.i386.rpm
-perl-File-MMagic-1.13-14.i386.rpm
-perl-HTML-Parser-3.26-2.i386.rpm
-perl-HTML-Tagset-3.03-14.i386.rpm
-perl-MIME-Base64-2.12-14.i386.rpm
-perl-NDBM_File-1.75-34.99.6.i386.rpm
-perl-NKF-1.71-2.i386.rpm
-perl-Parse-Yapp-1.05-15.i386.rpm
-perl-Storable-1.0.14-15.i386.rpm
-perl-URI-1.17-16.i386.rpm
-perl-XML-Dumper-0.4-12.noarch.rpm
-perl-XML-Encoding-1.01-9.noarch.rpm
-perl-XML-Grove-0.46alpha-11.noarch.rpm
-perl-XML-Parser-2.30-15.i386.rpm
-perl-XML-Twig-2.02-9.noarch.rpm
-perl-libnet-1.0901-17.i386.rpm
-perl-libwww-perl-5.63-9.i386.rpm
-perl-libxml-enno-1.02-15.i386.rpm
-perl-libxml-perl-0.07-14.noarch.rpm
-pnm2ppa-1.04-2.i386.rpm
-popt-1.6.4-7x.18.i386.rpm
-portmap-4.0-41.i386.rpm
-procmail-3.22-5.i386.rpm
-procps-2.0.7-12.i386.rpm
-psmisc-20.2-2.i386.rpm
-pspell-0.12.2-8.i386.rpm
-psutils-1.17-13.i386.rpm
-pwdb-0.61.2-2.i386.rpm
-python-1.5.2-38.i386.rpm
-python-clap-1.0.0-3.noarch.rpm
-python-popt-0.8.8-7.x.2.i386.rpm
-python-xmlrpc-1.5.1-7.x.3.i386.rpm
-python2-2.2-16.i386.rpm
-readline-4.2a-4.i386.rpm
-redhat-release-7.3-1.noarch.rpm
-rootfiles-7.2-1.noarch.rpm
-rpm-4.0.4-7x.18.i386.rpm
-rpm-python-4.0.4-7x.18.i386.rpm
-sed-3.02-11.i386.rpm
-sendmail-8.11.6-15.i386.rpm
-setup-2.5.12-1.noarch.rpm
-sgml-common-0.6.3-9.noarch.rpm
-sh-utils-2.0.11-14.i386.rpm
-shadow-utils-20000902-7.i386.rpm
-slang-1.4.5-2.i386.rpm
-slocate-2.6-1.i386.rpm
-specspo-7.3-4.noarch.rpm
-sysklogd-1.4.1-8.i386.rpm
-tar-1.13.25-4.i386.rpm
-tcl-8.3.3-67.i386.rpm
-tcsh-6.10-6.i386.rpm
-termcap-11.0.1-10.noarch.rpm
-textutils-2.0.21-1.i386.rpm
-time-1.7-16.i386.rpm
-tmpwatch-2.8.3-1.i386.rpm
-umb-scheme-3.2-21.i386.rpm
-unzip-5.50-2.i386.rpm
-usermode-1.53-2.i386.rpm
-utempter-0.5.2-6.i386.rpm
-util-linux-2.11n-12.i386.rpm
-vim-common-6.1-2.i386.rpm
-vim-minimal-6.1-2.i386.rpm
-vixie-cron-3.0.1-64.i386.rpm
-which-2.13-3.i386.rpm
-words-2-18.noarch.rpm
-xinetd-2.3.4-0.8.i386.rpm
-xml-common-0.6.3-9.noarch.rpm
-zip-2.3-12.i386.rpm
-zlib-1.1.3-25.7.i386.rpm
-mingetty-1.00-1.i386.rpm
-iproute-2.4.7-1.i386.rpm
-modutils-2.4.14-3.i386.rpm
-gmp-4.0.1-3.i386.rpm
-expat-1.95.2-2.i386.rpm
-net-tools-1.60-4.i386.rpm
+++ /dev/null
-4Suite-[0-9]*.i386.rpm
-Canna-[0-9]*.i386.rpm
-Canna-libs-[0-9]*.i386.rpm
-Distutils-*.noarch.rpm
-MAKEDEV-[0-9]*.i386.rpm
-PyXML-[0-9]*.i386.rpm
-SysVinit-[0-9]*.i386.rpm
-a2ps-[0-9]*.i386.rpm
-alchemist-[0-9]*.i386.rpm
-anacron-[0-9]*.i386.rpm
-ash-[0-9]*.i386.rpm
-at-[0-9]*.i386.rpm
-audiofile-[0-9]*.i386.rpm
-authconfig-[0-9]*.i386.rpm
-basesystem-*.noarch.rpm
-bash-[0-9]*.i386.rpm
-bdflush-[0-9]*.i386.rpm
-bzip2-[0-9]*.i386.rpm
-bzip2-libs-[0-9]*.i386.rpm
-chkconfig-[0-9]*.i386.rpm
-cpio-[0-9]*.i386.rpm
-cracklib-[0-9]*.i386.rpm
-cracklib-dicts-[0-9]*.i386.rpm
-crontabs-*.noarch.rpm
-cyrus-sasl-[0-9]*.i386.rpm
-cyrus-sasl-md5-[0-9]*.i386.rpm
-db1-[0-9]*.i386.rpm
-db2-[0-9]*.i386.rpm
-db3-[0-9]*.i386.rpm
-db4-[0-9]*.i386.rpm
-libelf-[0-9]*.i386.rpm
-dev-[0-9]*.i386.rpm
-diffutils-[0-9]*.i386.rpm
-dosfstools-[0-9]*.i386.rpm
-e2fsprogs-[0-9]*.i386.rpm
-ed-[0-9]*.i386.rpm
-fam-[0-9]*.i386.rpm
-file-[0-9]*.i386.rpm
-filesystem-[0-9]*.noarch.rpm
-fileutils-[0-9]*.i386.rpm
-findutils-[0-9]*.i386.rpm
-libacl-[0-9]*.i386.rpm
-libgcc-[0-9]*.i386.rpm
-freetype-[0-9]*.i386.rpm
-gawk-[0-9]*.i386.rpm
-gdbm-[0-9]*.i386.rpm
-glib-[0-9]*.i386.rpm
-glib2-[0-9]*.i386.rpm
-glibc-[0-9]*.i386.rpm
-glibc-common-[0-9]*.i386.rpm
-gnupg-[0-9]*.i386.rpm
-grep-[0-9]*.i386.rpm
-groff-[0-9]*.i386.rpm
-groff-perl-[0-9]*.i386.rpm
-gzip-[0-9]*.i386.rpm
-htdig-[0-9]*.i386.rpm
-indexhtml-*.noarch.rpm
-info-[0-9]*.i386.rpm
-initscripts-[0-9]*.i386.rpm
-iputils-[0-9]*.i386.rpm
-less-[0-9]*.i386.rpm
-libcap-[0-9]*.i386.rpm
-libghttp-[0-9]*.i386.rpm
-libjpeg-[0-9]*.i386.rpm
-libmng-[0-9]*.i386.rpm
-libogg-[0-9]*.i386.rpm
-libpng-[0-9]*.i386.rpm
-libstdc++-[0-9]*.i386.rpm
-libtermcap-[0-9]*.i386.rpm
-libtiff-[0-9]*.i386.rpm
-libtool-libs-[0-9]*.i386.rpm
-libunicode-[0-9]*.i386.rpm
-libuser-[0-9]*.i386.rpm
-libvorbis-[0-9]*.i386.rpm
-libxml-[0-9]*.i386.rpm
-libxml2-[0-9]*.i386.rpm
-libxslt-[0-9]*.i386.rpm
-logrotate-[0-9]*.i386.rpm
-losetup-[0-9]*.i386.rpm
-m4-[0-9]*.i386.rpm
-mailcap-*.noarch.rpm
-mailx-[0-9]*.i386.rpm
-make-[0-9]*.i386.rpm
-man-[0-9]*.i386.rpm
-man-pages-*.noarch.rpm
-mktemp-[0-9]*.i386.rpm
-mount-[0-9]*.i386.rpm
-mpage-[0-9]*.i386.rpm
-ncurses-[0-9]*.i386.rpm
-netpbm-[0-9]*.i386.rpm
-newt-[0-9]*.i386.rpm
-nhpf-[0-9]*.i386.rpm
-ntsysv-[0-9]*.i386.rpm
-openldap-[0-9]*.i386.rpm
-openssh-[0-9]*.i386.rpm
-openssh-clients-[0-9]*.i386.rpm
-openssh-server-[0-9]*.i386.rpm
-openssl-[0-9]*.i386.rpm
-pam-[0-9]*.i386.rpm
-passwd-[0-9]*.i386.rpm
-patch-[0-9]*.i386.rpm
-pcre-[0-9]*.i386.rpm
-perl-[0-9]*.i386.rpm
-perl-Filter-[0-9]*.i386.rpm
-krb5-libs-[0-9]*.i386.rpm
-libattr-[0-9]*.i386.rpm
-hesiod-[0-9]*.i386.rpm
-pnm2ppa-[0-9]*.i386.rpm
-popt-[0-9]*.i386.rpm
-portmap-[0-9]*.i386.rpm
-procmail-[0-9]*.i386.rpm
-procps-[0-9]*.i386.rpm
-psmisc-[0-9]*.i386.rpm
-pspell-[0-9]*.i386.rpm
-psutils-[0-9]*.i386.rpm
-pwdb-[0-9]*.i386.rpm
-python-[0-9]*.i386.rpm
-python-clap-*.noarch.rpm
-python-popt-[0-9]*.i386.rpm
-python-xmlrpc-[0-9]*.i386.rpm
-python2-[0-9]*.i386.rpm
-readline-[0-9]*.i386.rpm
-redhat-release-*.noarch.rpm
-rootfiles-*.noarch.rpm
-rpm-[0-9]*.i386.rpm
-sed-[0-9]*.i386.rpm
-sendmail-[0-9]*.i386.rpm
-setup-*.noarch.rpm
-sgml-common-*.noarch.rpm
-sh-utils-[0-9]*.i386.rpm
-shadow-utils-[0-9]*.i386.rpm
-slang-[0-9]*.i386.rpm
-slocate-[0-9]*.i386.rpm
-specspo-*.noarch.rpm
-sysklogd-[0-9]*.i386.rpm
-tar-[0-9]*.i386.rpm
-tcl-[0-9]*.i386.rpm
-tcsh-[0-9]*.i386.rpm
-termcap-*.noarch.rpm
-textutils-[0-9]*.i386.rpm
-time-[0-9]*.i386.rpm
-tmpwatch-[0-9]*.i386.rpm
-umb-scheme-[0-9]*.i386.rpm
-unzip-[0-9]*.i386.rpm
-usermode-[0-9]*.i386.rpm
-utempter-[0-9]*.i386.rpm
-util-linux-[0-9]*.i386.rpm
-vim-common-[0-9]*.i386.rpm
-vim-minimal-[0-9]*.i386.rpm
-vixie-cron-[0-9]*.i386.rpm
-which-[0-9]*.i386.rpm
-words-*.noarch.rpm
-xinetd-[0-9]*.i386.rpm
-xml-common-*.noarch.rpm
-zip-[0-9]*.i386.rpm
-zlib-[0-9]*.i386.rpm
-mingetty-[0-9]*.i386.rpm
-iproute-[0-9]*.i386.rpm
-modutils-[0-9]*.i386.rpm
-gmp-[0-9]*.i386.rpm
-expat-[0-9]*.i386.rpm
-net-tools-[0-9]*.i386.rpm
-
+++ /dev/null
-chkconfig-[0-9]*.i386.rpm
-glibc-[0-9]*.i386.rpm
-glibc-common-[0-9]*.i386.rpm
-filesystem-[0-9]*.i386.rpm
-tcp_wrappers-[0-9]*.i386.rpm
-elfutils-libelf-[0-9]*.i386.rpm
-coreutils-[0-9]*.i386.rpm
-4Suite-[0-9]*.i386.rpm
-MAKEDEV-[0-9]*.i386.rpm
-PyXML-[0-9]*.i386.rpm
-SysVinit-[0-9]*.i386.rpm
-a2ps-[0-9]*.i386.rpm
-alchemist-[0-9]*.i386.rpm
-anacron-[0-9]*.i386.rpm
-ash-[0-9]*.i386.rpm
-at-[0-9]*.i386.rpm
-audiofile-[0-9]*.i386.rpm
-authconfig-[0-9]*.i386.rpm
-basesystem-*.noarch.rpm
-bash-[0-9]*.i386.rpm
-bzip2-[0-9]*.i386.rpm
-bzip2-libs-[0-9]*.i386.rpm
-cpio-[0-9]*.i386.rpm
-cracklib-[0-9]*.i386.rpm
-cracklib-dicts-[0-9]*.i386.rpm
-crontabs-*.noarch.rpm
-cyrus-sasl-[0-9]*.i386.rpm
-cyrus-sasl-md5-[0-9]*.i386.rpm
-db4-[0-9]*.i386.rpm
-dev-[0-9]*.i386.rpm
-diffutils-[0-9]*.i386.rpm
-dosfstools-[0-9]*.i386.rpm
-e2fsprogs-[0-9]*.i386.rpm
-ed-[0-9]*.i386.rpm
-fam-[0-9]*.i386.rpm
-file-[0-9]*.i386.rpm
-findutils-[0-9]*.i386.rpm
-libacl-[0-9]*.i386.rpm
-libgcc-[0-9]*.i386.rpm
-freetype-[0-9]*.i386.rpm
-gawk-[0-9]*.i386.rpm
-gdbm-[0-9]*.i386.rpm
-glib-[0-9]*.i386.rpm
-glib2-[0-9]*.i386.rpm
-gnupg-[0-9]*.i386.rpm
-grep-[0-9]*.i386.rpm
-groff-[0-9]*.i386.rpm
-gzip-[0-9]*.i386.rpm
-indexhtml-*.noarch.rpm
-info-[0-9]*.i386.rpm
-initscripts-[0-9]*.i386.rpm
-iputils-[0-9]*.i386.rpm
-less-[0-9]*.i386.rpm
-libcap-[0-9]*.i386.rpm
-libghttp-[0-9]*.i386.rpm
-libjpeg-[0-9]*.i386.rpm
-libmng-[0-9]*.i386.rpm
-libogg-[0-9]*.i386.rpm
-libpng-[0-9]*.i386.rpm
-libstdc++-[0-9]*.i386.rpm
-libtermcap-[0-9]*.i386.rpm
-libtiff-[0-9]*.i386.rpm
-libtool-libs-[0-9]*.i386.rpm
-libunicode-[0-9]*.i386.rpm
-libuser-[0-9]*.i386.rpm
-libvorbis-[0-9]*.i386.rpm
-libxml-[0-9]*.i386.rpm
-libxml2-[0-9]*.i386.rpm
-libxslt-[0-9]*.i386.rpm
-logrotate-[0-9]*.i386.rpm
-losetup-[0-9]*.i386.rpm
-m4-[0-9]*.i386.rpm
-mailcap-*.noarch.rpm
-mailx-[0-9]*.i386.rpm
-make-[0-9]*.i386.rpm
-man-[0-9]*.i386.rpm
-man-pages-*.noarch.rpm
-mktemp-[0-9]*.i386.rpm
-mount-[0-9]*.i386.rpm
-mpage-[0-9]*.i386.rpm
-ncurses-[0-9]*.i386.rpm
-netpbm-[0-9]*.i386.rpm
-newt-[0-9]*.i386.rpm
-ntsysv-[0-9]*.i386.rpm
-openldap-[0-9]*.i386.rpm
-openssh-[0-9]*.i386.rpm
-openssh-clients-[0-9]*.i386.rpm
-openssh-server-[0-9]*.i386.rpm
-openssl-[0-9]*.i386.rpm
-pam-[0-9]*.i386.rpm
-passwd-[0-9]*.i386.rpm
-patch-[0-9]*.i386.rpm
-pcre-[0-9]*.i386.rpm
-perl-[0-9]*.i386.rpm
-perl-Filter-[0-9]*.i386.rpm
-krb5-libs-[0-9]*.i386.rpm
-libattr-[0-9]*.i386.rpm
-hesiod-[0-9]*.i386.rpm
-pnm2ppa-[0-9]*.i386.rpm
-popt-[0-9]*.i386.rpm
-portmap-[0-9]*.i386.rpm
-procmail-[0-9]*.i386.rpm
-procps-[0-9]*.i386.rpm
-psmisc-[0-9]*.i386.rpm
-pspell-[0-9]*.i386.rpm
-psutils-[0-9]*.i386.rpm
-python-[0-9]*.i386.rpm
-readline-[0-9]*.i386.rpm
-redhat-release-*.i386.rpm
-rootfiles-*.noarch.rpm
-rpm-[0-9]*.i386.rpm
-sed-[0-9]*.i386.rpm
-sendmail-[0-9]*.i386.rpm
-setup-*.noarch.rpm
-sgml-common-*.noarch.rpm
-shadow-utils-[0-9]*.i386.rpm
-slang-[0-9]*.i386.rpm
-slocate-[0-9]*.i386.rpm
-specspo-*.noarch.rpm
-sysklogd-[0-9]*.i386.rpm
-tar-[0-9]*.i386.rpm
-tcl-[0-9]*.i386.rpm
-tcsh-[0-9]*.i386.rpm
-termcap-*.noarch.rpm
-time-[0-9]*.i386.rpm
-tmpwatch-[0-9]*.i386.rpm
-umb-scheme-[0-9]*.i386.rpm
-unzip-[0-9]*.i386.rpm
-usermode-[0-9]*.i386.rpm
-utempter-[0-9]*.i386.rpm
-util-linux-[0-9]*.i386.rpm
-vim-common-[0-9]*.i386.rpm
-vim-minimal-[0-9]*.i386.rpm
-vixie-cron-[0-9]*.i386.rpm
-which-[0-9]*.i386.rpm
-words-*.noarch.rpm
-xinetd-[0-9]*.i386.rpm
-zip-[0-9]*.i386.rpm
-zlib-[0-9]*.i386.rpm
-mingetty-[0-9]*.i386.rpm
-iproute-[0-9]*.i386.rpm
-modutils-[0-9]*.i386.rpm
-gmp-[0-9]*.i386.rpm
-expat-[0-9]*.i386.rpm
-net-tools-[0-9]*.i386.rpm
-nscd-[0-9]*.i386.rpm
-
+++ /dev/null
-# Select an unused context (this is optional)
-# The default is to allocate a free context on the fly
-# In general you don't need to force a context
-#S_CONTEXT=
-# Select the IP number assigned to the virtual server
-# This IP must be one IP of the server, either an interface
-# or an IP alias
-IPROOT=1.2.3.4
-# The netmask and broadcast are computed by default from IPROOTDEV
-#IPROOTMASK=
-#IPROOTBCAST=
-# You can define on which device the IP alias will be done
-# The IP alias will be set when the server is started and unset
-# when the server is stopped
-IPROOTDEV=eth0
-# Uncomment the onboot line if you want to enable this
-# virtual server at boot time
-#ONBOOT=yes
-# You can set a different host name for the vserver
-# If empty, the host name of the main server is used
-S_HOSTNAME=somename.somedomain.com
-# You can set a different NIS domain for the vserver
-# If empty, the current on is kept
-# Set it to "none" to have no NIS domain set
-S_DOMAINNAME=
-# You can set the priority level (nice) of all process in the vserver
-# Even root won't be able to raise it
-S_NICE=
-# You can set various flags for the new security context
-# lock: Prevent the vserver from setting new security context
-# sched: Merge scheduler priority of all processes in the vserver
-# so that it acts a like a single one.
-# nproc: Limit the number of processes in the vserver according to ulimit
-# (instead of a per user limit, this becomes a per vserver limit)
-# private: No other process can join this security context. Even root
-# Do not forget the quotes around the flags
-S_FLAGS="lock nproc"
-# You can set various ulimit flags and they will be inherited by the
-# vserver. You enter here various command line argument of ulimit
-# ULIMIT="-H -u 200"
-# The example above, combined with the nproc S_FLAGS will limit the
-# vserver to a maximum of 200 processes
-ULIMIT="-HS -u 1000"
-# You can set various capabilities. By default, the vserver are run
-# with a limited set, so you can let root run in a vserver and not
-# worry about it. He can't take over the machine. In some cases
-# you can to give a little more capabilities (such as CAP_NET_RAW)
-# S_CAPS="CAP_NET_RAW"
-S_CAPS=""
+++ /dev/null
-#!/bin/sh
-case $1 in
-pre-start)
- ;;
-post-start)
- ;;
-pre-stop)
- ;;
-post-stop)
- ;;
-*)
- echo $0 pre-start
- echo $0 pre-stop
- echo $0 post-start
- echo $0 post-stop
- ;;
-esac
+++ /dev/null
-
- Object not found!
-
- The requested URL was not found on this server. If you entered
- the URL manually please check your spelling and try again.
-
- If you think this is a server error, please contact the
- [1]webmaster
-
-Error 404
-
-
- [2]remtk
- ven 18 jui 2003 11:41:32 EDT
- Apache/2.0.40 (Red Hat Linux)
-
-Références
-
- 1. mailto:root@localhost
- 2. http://remtk/
+++ /dev/null
-
- Object not found!
-
- The requested URL was not found on this server. If you entered
- the URL manually please check your spelling and try again.
-
- If you think this is a server error, please contact the
- [1]webmaster
-
-Error 404
-
-
- [2]remtk
- ven 18 jui 2003 11:41:32 EDT
- Apache/2.0.40 (Red Hat Linux)
-
-Références
-
- 1. mailto:root@localhost
- 2. http://remtk/
+++ /dev/null
-#ifndef _VX_CONTEXT_H
-#define _VX_CONTEXT_H
-
-#include <linux/types.h>
-
-
-#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
-#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
-
-#define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
-
-/* context flags */
-
-#define VXF_INFO_LOCK 0x00000001
-#define VXF_INFO_SCHED 0x00000002
-#define VXF_INFO_NPROC 0x00000004
-#define VXF_INFO_PRIVATE 0x00000008
-
-#define VXF_INFO_INIT 0x00000010
-#define VXF_INFO_HIDE 0x00000020
-#define VXF_INFO_ULIMIT 0x00000040
-#define VXF_INFO_NSPACE 0x00000080
-
-#define VXF_SCHED_HARD 0x00000100
-#define VXF_SCHED_PRIO 0x00000200
-#define VXF_SCHED_PAUSE 0x00000400
-
-#define VXF_VIRT_MEM 0x00010000
-#define VXF_VIRT_UPTIME 0x00020000
-#define VXF_VIRT_CPU 0x00040000
-#define VXF_VIRT_LOAD 0x00080000
-
-#define VXF_HIDE_MOUNT 0x01000000
-#define VXF_HIDE_NETIF 0x02000000
-
-#define VXF_STATE_SETUP (1ULL<<32)
-#define VXF_STATE_INIT (1ULL<<33)
-
-#define VXF_STATE_HELPER (1ULL<<36)
-
-#define VXF_FORK_RSS (1ULL<<48)
-#define VXF_PROLIFIC (1ULL<<49)
-
-#define VXF_IGNEG_NICE (1ULL<<52)
-
-#define VXF_ONE_TIME (0x0003ULL<<32)
-
-#define VXF_INIT_SET (VXF_STATE_SETUP|VXF_STATE_INIT)
-
-
-/* context caps */
-
-#define VXC_CAP_MASK 0x00000000
-
-#define VXC_SET_UTSNAME 0x00000001
-#define VXC_SET_RLIMIT 0x00000002
-
-#define VXC_RAW_ICMP 0x00000100
-#define VXC_SYSLOG 0x00001000
-
-#define VXC_SECURE_MOUNT 0x00010000
-#define VXC_SECURE_REMOUNT 0x00020000
-#define VXC_BINARY_MOUNT 0x00040000
-
-#define VXC_QUOTA_CTL 0x00100000
-
-
-/* context state changes */
-
-enum {
- VSC_STARTUP = 1,
- VSC_SHUTDOWN,
-
- VSC_NETUP,
- VSC_NETDOWN,
-};
-
-
-#ifdef __KERNEL__
-
-#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/rcupdate.h>
-
-#include "limit_def.h"
-#include "sched_def.h"
-#include "cvirt_def.h"
-
-struct vx_info {
- struct hlist_node vx_hlist; /* linked list of contexts */
- xid_t vx_id; /* context id */
- atomic_t vx_usecnt; /* usage count */
- atomic_t vx_tasks; /* tasks count */
- struct vx_info *vx_parent; /* parent context */
- int vx_state; /* context state */
-
- struct namespace *vx_namespace; /* private namespace */
- struct fs_struct *vx_fs; /* private namespace fs */
- uint64_t vx_flags; /* context flags */
- uint64_t vx_bcaps; /* bounding caps (system) */
- uint64_t vx_ccaps; /* context caps (vserver) */
-
- pid_t vx_initpid; /* PID of fake init process */
-
- wait_queue_head_t vx_wait; /* context exit waitqueue */
-
- struct _vx_limit limit; /* vserver limits */
- struct _vx_sched sched; /* vserver scheduler */
- struct _vx_cvirt cvirt; /* virtual/bias stuff */
- struct _vx_cacct cacct; /* context accounting */
-
- char vx_name[65]; /* vserver name */
-};
-
-
-/* status flags */
-
-#define VXS_HASHED 0x0001
-#define VXS_PAUSED 0x0010
-#define VXS_ONHOLD 0x0020
-#define VXS_SHUTDOWN 0x0100
-#define VXS_RELEASED 0x8000
-
-/* check conditions */
-
-#define VX_ADMIN 0x0001
-#define VX_WATCH 0x0002
-#define VX_HIDE 0x0004
-#define VX_HOSTID 0x0008
-
-#define VX_IDENT 0x0010
-#define VX_EQUIV 0x0020
-#define VX_PARENT 0x0040
-#define VX_CHILD 0x0080
-
-#define VX_ARG_MASK 0x00F0
-
-#define VX_DYNAMIC 0x0100
-#define VX_STATIC 0x0200
-
-#define VX_ATR_MASK 0x0F00
-
-
-extern void claim_vx_info(struct vx_info *, struct task_struct *);
-extern void release_vx_info(struct vx_info *, struct task_struct *);
-
-extern struct vx_info *locate_vx_info(int);
-extern struct vx_info *locate_or_create_vx_info(int);
-
-extern int get_xid_list(int, unsigned int *, int);
-extern int xid_is_hashed(xid_t);
-
-extern int vx_migrate_task(struct task_struct *, struct vx_info *);
-
-extern long vs_state_change(struct vx_info *, unsigned int);
-
-
-#endif /* __KERNEL__ */
-#else /* _VX_CONTEXT_H */
-#warning duplicate inclusion
-#endif /* _VX_CONTEXT_H */
+++ /dev/null
-#ifndef _VX_CVIRT_H
-#define _VX_CVIRT_H
-
-#ifdef __KERNEL__
-
-struct timespec;
-
-void vx_vsi_uptime(struct timespec *, struct timespec *);
-
-
-struct vx_info;
-
-void vx_update_load(struct vx_info *);
-
-
-int vx_uts_virt_handler(struct ctl_table *ctl, int write, xid_t xid,
- void **datap, size_t *lenp);
-
-
-int vx_do_syslog(int, char __user *, int);
-
-#endif /* __KERNEL__ */
-#else /* _VX_CVIRT_H */
-#warning duplicate inclusion
-#endif /* _VX_CVIRT_H */
+++ /dev/null
-#ifndef _VX_CVIRT_DEF_H
-#define _VX_CVIRT_DEF_H
-
-#include <linux/jiffies.h>
-#include <linux/utsname.h>
-#include <linux/spinlock.h>
-#include <linux/wait.h>
-#include <linux/time.h>
-#include <asm/atomic.h>
-
-
-struct _vx_usage_stat {
- uint64_t user;
- uint64_t nice;
- uint64_t system;
- uint64_t softirq;
- uint64_t irq;
- uint64_t idle;
- uint64_t iowait;
-};
-
-struct _vx_syslog {
- wait_queue_head_t log_wait;
- spinlock_t logbuf_lock; /* lock for the log buffer */
-
- unsigned long log_start; /* next char to be read by syslog() */
- unsigned long con_start; /* next char to be sent to consoles */
- unsigned long log_end; /* most-recently-written-char + 1 */
- unsigned long logged_chars; /* #chars since last read+clear operation */
-
- char log_buf[1024];
-};
-
-
-/* context sub struct */
-
-struct _vx_cvirt {
- int max_threads; /* maximum allowed threads */
- atomic_t nr_threads; /* number of current threads */
- atomic_t nr_running; /* number of running threads */
- atomic_t nr_uninterruptible; /* number of uninterruptible threads */
-
- atomic_t nr_onhold; /* processes on hold */
- uint32_t onhold_last; /* jiffies when put on hold */
-
- struct timespec bias_idle;
- struct timespec bias_uptime; /* context creation point */
- uint64_t bias_clock; /* offset in clock_t */
-
- struct new_utsname utsname;
-
- spinlock_t load_lock; /* lock for the load averages */
- atomic_t load_updates; /* nr of load updates done so far */
- uint32_t load_last; /* last time load was cacled */
- uint32_t load[3]; /* load averages 1,5,15 */
-
- atomic_t total_forks; /* number of forks so far */
-
- struct _vx_usage_stat cpustat[NR_CPUS];
-
- struct _vx_syslog syslog;
-};
-
-struct _vx_sock_acc {
- atomic_t count;
- atomic_t total;
-};
-
-/* context sub struct */
-
-struct _vx_cacct {
- unsigned long total_forks;
-
- struct _vx_sock_acc sock[5][3];
-};
-
-#endif /* _VX_CVIRT_DEF_H */
+++ /dev/null
-#ifndef _VX_DEBUG_H
-#define _VX_DEBUG_H
-
-#ifndef CONFIG_VSERVER
-#warning config options missing
-#endif
-
-#define VXD_CBIT(n,m) (vx_debug_ ## n & (1 << (m)))
-#define VXD_CMIN(n,m) (vx_debug_ ## n > (m))
-#define VXD_MASK(n,m) (vx_debug_ ## n & (m))
-
-#define VXD_QPOS(v,p) (((uint32_t)(v) >> ((p)*8)) & 0xFF)
-#define VXD_QUAD(v) VXD_QPOS(v,0), VXD_QPOS(v,1), \
- VXD_QPOS(v,2), VXD_QPOS(v,3)
-
-#define __FUNC__ __func__
-
-
-#ifdef CONFIG_VSERVER_DEBUG
-
-extern unsigned int vx_debug_switch;
-extern unsigned int vx_debug_xid;
-extern unsigned int vx_debug_nid;
-extern unsigned int vx_debug_net;
-extern unsigned int vx_debug_limit;
-extern unsigned int vx_debug_dlim;
-extern unsigned int vx_debug_cvirt;
-
-
-#define VX_LOGLEVEL "vxD: "
-#define VX_WARNLEVEL KERN_WARNING "vxW: "
-
-#define vxdprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f "\n" , ##x); \
- } while (0)
-
-#define vxlprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f " @%s:%d\n", x); \
- } while (0)
-
-#define vxfprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
- } while (0)
-
-
-#define vxwprintk(c,f,x...) \
- do { \
- if (c) \
- printk(VX_WARNLEVEL f "\n" , ##x); \
- } while (0)
-
-
-#define vxd_path(d,m) \
- ({ static char _buffer[PATH_MAX]; \
- d_path((d), (m), _buffer, sizeof(_buffer)); })
-
-#else /* CONFIG_VSERVER_DEBUG */
-
-#define vx_debug_switch 0
-#define vx_debug_xid 0
-#define vx_debug_nid 0
-#define vx_debug_net 0
-#define vx_debug_limit 0
-#define vx_debug_dlim 0
-#define vx_debug_cvirt 0
-
-#define vxdprintk(x...) do { } while (0)
-#define vxlprintk(x...) do { } while (0)
-#define vxfprintk(x...) do { } while (0)
-#define vxwprintk(x...) do { } while (0)
-
-#define vxd_path "<none>"
-
-#endif /* CONFIG_VSERVER_DEBUG */
-
-
-/* history stuff */
-
-#ifdef CONFIG_VSERVER_HISTORY
-
-
-extern unsigned volatile int vxh_active;
-
-struct _vxhe_vxi {
- struct vx_info *ptr;
- unsigned xid;
- unsigned usecnt;
- unsigned tasks;
-};
-
-struct _vxhe_set_clr {
- void *data;
-};
-
-struct _vxhe_loc_lookup {
- unsigned arg;
-};
-
-enum {
- VXH_UNUSED=0,
- VXH_THROW_OOPS=1,
-
- VXH_GET_VX_INFO,
- VXH_PUT_VX_INFO,
- VXH_INIT_VX_INFO,
- VXH_SET_VX_INFO,
- VXH_CLR_VX_INFO,
- VXH_CLAIM_VX_INFO,
- VXH_RELEASE_VX_INFO,
- VXH_ALLOC_VX_INFO,
- VXH_DEALLOC_VX_INFO,
- VXH_HASH_VX_INFO,
- VXH_UNHASH_VX_INFO,
- VXH_LOC_VX_INFO,
- VXH_LOOKUP_VX_INFO,
- VXH_CREATE_VX_INFO,
-};
-
-struct _vx_hist_entry {
- void *loc;
- unsigned short seq;
- unsigned short type;
- struct _vxhe_vxi vxi;
- union {
- struct _vxhe_set_clr sc;
- struct _vxhe_loc_lookup ll;
- };
-};
-
-struct _vx_hist_entry *vxh_advance(void *loc);
-
-#define VXH_HERE() \
- ({ __label__ here; \
- here:; \
- &&here; })
-
-
-
-static inline void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
-{
- entry->vxi.ptr = vxi;
- if (vxi) {
- entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
- entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
- entry->vxi.xid = vxi->vx_id;
- }
-}
-
-
-#define __VXH_BODY(__type, __data) \
- struct _vx_hist_entry *entry; \
- \
- preempt_disable(); \
- entry = vxh_advance(VXH_HERE()); \
- __data; \
- entry->type = __type; \
- preempt_enable();
-
-
- /* pass vxi only */
-#define __VXH_SIMPLE \
- __vxh_copy_vxi(entry, vxi)
-
-#define VXH_SIMPLE(__name, __type) \
-static inline void __name(struct vx_info *vxi) \
-{ \
- __VXH_BODY(__type, __VXH_SIMPLE) \
-}
-
- /* pass vxi and data (void *) */
-#define __VXH_DATA \
- __vxh_copy_vxi(entry, vxi); \
- entry->sc.data = data
-
-#define VXH_DATA(__name, __type) \
-static inline \
-void __name(struct vx_info *vxi, void *data) \
-{ \
- __VXH_BODY(__type, __VXH_DATA) \
-}
-
- /* pass vxi and arg (long) */
-#define __VXH_LARG \
- __vxh_copy_vxi(entry, vxi); \
- entry->ll.arg = arg
-
-#define VXH_LARG(__name, __type) \
-static inline \
-void __name(struct vx_info *vxi, long arg) \
-{ \
- __VXH_BODY(__type, __VXH_LARG) \
-}
-
-
-static inline void vxh_throw_oops(void)
-{
- __VXH_BODY(VXH_THROW_OOPS, {});
- /* prevent further acquisition */
- vxh_active = 0;
-}
-
-VXH_SIMPLE(vxh_get_vx_info, VXH_GET_VX_INFO);
-VXH_SIMPLE(vxh_put_vx_info, VXH_PUT_VX_INFO);
-
-VXH_DATA(vxh_init_vx_info, VXH_INIT_VX_INFO);
-VXH_DATA(vxh_set_vx_info, VXH_SET_VX_INFO);
-VXH_DATA(vxh_clr_vx_info, VXH_CLR_VX_INFO);
-
-VXH_DATA(vxh_claim_vx_info, VXH_CLAIM_VX_INFO);
-VXH_DATA(vxh_release_vx_info, VXH_RELEASE_VX_INFO);
-
-VXH_SIMPLE(vxh_alloc_vx_info, VXH_ALLOC_VX_INFO);
-VXH_SIMPLE(vxh_dealloc_vx_info, VXH_DEALLOC_VX_INFO);
-
-VXH_SIMPLE(vxh_hash_vx_info, VXH_HASH_VX_INFO);
-VXH_SIMPLE(vxh_unhash_vx_info, VXH_UNHASH_VX_INFO);
-
-VXH_LARG(vxh_loc_vx_info, VXH_LOC_VX_INFO);
-VXH_LARG(vxh_lookup_vx_info, VXH_LOOKUP_VX_INFO);
-VXH_LARG(vxh_create_vx_info, VXH_CREATE_VX_INFO);
-
-extern void vxh_dump_history(void);
-
-
-#else /* CONFIG_VSERVER_HISTORY */
-
-
-#define vxh_throw_oops() do { } while (0)
-
-#define vxh_get_vx_info(v) do { } while (0)
-#define vxh_put_vx_info(v) do { } while (0)
-
-#define vxh_init_vx_info(v,d) do { } while (0)
-#define vxh_set_vx_info(v,d) do { } while (0)
-#define vxh_clr_vx_info(v,d) do { } while (0)
-
-#define vxh_claim_vx_info(v,d) do { } while (0)
-#define vxh_release_vx_info(v,d) do { } while (0)
-
-#define vxh_alloc_vx_info(v) do { } while (0)
-#define vxh_dealloc_vx_info(v) do { } while (0)
-
-#define vxh_hash_vx_info(v) do { } while (0)
-#define vxh_unhash_vx_info(v) do { } while (0)
-
-#define vxh_loc_vx_info(a,v) do { } while (0)
-#define vxh_lookup_vx_info(a,v) do { } while (0)
-#define vxh_create_vx_info(a,v) do { } while (0)
-
-#define vxh_dump_history() do { } while (0)
-
-
-#endif /* CONFIG_VSERVER_HISTORY */
-
-
-#ifdef CONFIG_VSERVER_DEBUG
-#define vxd_assert_lock(l) assert_spin_locked(l)
-#else
-#define vxd_assert_lock(l) do { } while (0)
-#endif
-
-
-#endif /* _VX_DEBUG_H */
+++ /dev/null
-#ifndef _VX_DLIMIT_H
-#define _VX_DLIMIT_H
-
-#include "switch.h"
-
-#define CDLIM_UNSET (0ULL)
-#define CDLIM_INFINITY (~0ULL)
-#define CDLIM_KEEP (~1ULL)
-
-
-#ifdef __KERNEL__
-
-#include <linux/spinlock.h>
-
-struct super_block;
-
-struct dl_info {
- struct hlist_node dl_hlist; /* linked list of contexts */
- struct rcu_head dl_rcu; /* the rcu head */
- xid_t dl_xid; /* context id */
- atomic_t dl_usecnt; /* usage count */
- atomic_t dl_refcnt; /* reference count */
-
- struct super_block *dl_sb; /* associated superblock */
-
- spinlock_t dl_lock; /* protect the values */
-
- uint64_t dl_space_used; /* used space in bytes */
- uint64_t dl_space_total; /* maximum space in bytes */
- uint32_t dl_inodes_used; /* used inodes */
- uint32_t dl_inodes_total; /* maximum inodes */
-
- unsigned int dl_nrlmult; /* non root limit mult */
-};
-
-struct rcu_head;
-
-extern void rcu_free_dl_info(struct rcu_head *);
-extern void unhash_dl_info(struct dl_info *);
-
-extern struct dl_info *locate_dl_info(struct super_block *, xid_t);
-
-
-struct kstatfs;
-
-extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
-
-typedef uint64_t dlsize_t;
-
-#endif /* __KERNEL__ */
-#else /* _VX_DLIMIT_H */
-#warning duplicate inclusion
-#endif /* _VX_DLIMIT_H */
+++ /dev/null
-#ifndef _VX_INODE_H
-#define _VX_INODE_H
-
-
-#define IATTR_XID 0x01000000
-
-#define IATTR_ADMIN 0x00000001
-#define IATTR_WATCH 0x00000002
-#define IATTR_HIDE 0x00000004
-#define IATTR_FLAGS 0x00000007
-
-#define IATTR_BARRIER 0x00010000
-#define IATTR_IUNLINK 0x00020000
-#define IATTR_IMMUTABLE 0x00040000
-
-#ifdef __KERNEL__
-
-#ifndef CONFIG_VSERVER
-#warning config options missing
-#endif
-
-#ifdef CONFIG_VSERVER_PROC_SECURE
-#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
-#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
-#else
-#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
-#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
-#endif
-
-#define vx_hide_check(c,m) (((m) & IATTR_HIDE) ? vx_check(c,m) : 1)
-
-#endif /* __KERNEL__ */
-
-/* inode ioctls */
-
-#define FIOC_GETXFLG _IOR('x', 5, long)
-#define FIOC_SETXFLG _IOW('x', 6, long)
-
-#else /* _VX_INODE_H */
-#warning duplicate inclusion
-#endif /* _VX_INODE_H */
+++ /dev/null
-#ifndef _VX_LIMIT_H
-#define _VX_LIMIT_H
-
-#ifdef __KERNEL__
-
-struct sysinfo;
-
-void vx_vsi_meminfo(struct sysinfo *);
-void vx_vsi_swapinfo(struct sysinfo *);
-
-#define VXD_RLIMIT(r,l) (VXD_CBIT(limit, (l)) && ((r) == (l)))
-
-#define NUM_LIMITS 24
-
-#define VLIMIT_NSOCK 16
-#define VLIMIT_OPENFD 17
-#define VLIMIT_ANON 18
-#define VLIMIT_SHMEM 19
-
-extern const char *vlimit_name[NUM_LIMITS];
-
-#endif /* __KERNEL__ */
-#endif /* _VX_LIMIT_H */
+++ /dev/null
-#ifndef _VX_LIMIT_DEF_H
-#define _VX_LIMIT_DEF_H
-
-#include <asm/atomic.h>
-#include <asm/resource.h>
-
-#include "limit.h"
-
-/* context sub struct */
-
-struct _vx_limit {
- atomic_t ticks;
-
- unsigned long rlim[NUM_LIMITS]; /* Context limit */
- unsigned long rmax[NUM_LIMITS]; /* Context maximum */
- atomic_t rcur[NUM_LIMITS]; /* Current value */
- atomic_t lhit[NUM_LIMITS]; /* Limit hits */
-};
-
-
-#endif /* _VX_LIMIT_DEF_H */
+++ /dev/null
-#ifndef _VX_NAMESPACE_H
-#define _VX_NAMESPACE_H
-
-#include <linux/types.h>
-
-struct vx_info;
-struct namespace;
-struct fs_struct;
-
-extern int vx_set_namespace(struct vx_info *, struct namespace *, struct fs_struct *);
-
-#else /* _VX_NAMESPACE_H */
-#warning duplicate inclusion
-#endif /* _VX_NAMESPACE_H */
+++ /dev/null
-#ifndef _VX_NAMESPACE_CMD_H
-#define _VX_NAMESPACE_CMD_H
-
-#define VCMD_enter_namespace VC_CMD(PROCALT, 1, 0)
-#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
-#define VCMD_set_namespace VC_CMD(PROCALT, 3, 0)
-
-
-#ifdef __KERNEL__
-
-extern int vc_enter_namespace(uint32_t, void __user *);
-extern int vc_cleanup_namespace(uint32_t, void __user *);
-extern int vc_set_namespace(uint32_t, void __user *);
-
-#endif /* __KERNEL__ */
-#endif /* _VX_NAMESPACE_CMD_H */
+++ /dev/null
-#ifndef _VX_SCHED_H
-#define _VX_SCHED_H
-
-#ifdef __KERNEL__
-
-struct timespec;
-
-void vx_vsi_uptime(struct timespec *, struct timespec *);
-
-
-struct vx_info;
-
-void vx_update_load(struct vx_info *);
-
-
-struct task_struct;
-
-int vx_effective_vavavoom(struct vx_info *, int);
-
-int vx_tokens_recalc(struct vx_info *);
-
-#endif /* __KERNEL__ */
-#else /* _VX_SCHED_H */
-#warning duplicate inclusion
-#endif /* _VX_SCHED_H */
+++ /dev/null
-#ifndef _VX_SCHED_DEF_H
-#define _VX_SCHED_DEF_H
-
-#include <linux/spinlock.h>
-#include <linux/jiffies.h>
-#include <linux/cpumask.h>
-#include <asm/atomic.h>
-#include <asm/param.h>
-
-
-struct _vx_ticks {
- uint64_t user_ticks; /* token tick events */
- uint64_t sys_ticks; /* token tick events */
- uint64_t hold_ticks; /* token ticks paused */
- uint64_t unused[5]; /* cacheline ? */
-};
-
-/* context sub struct */
-
-struct _vx_sched {
- atomic_t tokens; /* number of CPU tokens */
- spinlock_t tokens_lock; /* lock for token bucket */
-
- int fill_rate; /* Fill rate: add X tokens... */
- int interval; /* Divisor: per Y jiffies */
- int tokens_min; /* Limit: minimum for unhold */
- int tokens_max; /* Limit: no more than N tokens */
- uint32_t jiffies; /* last time accounted */
-
- int priority_bias; /* bias offset for priority */
- int vavavoom; /* last calculated vavavoom */
-
- cpumask_t cpus_allowed; /* cpu mask for context */
-
- struct _vx_ticks cpu[NR_CPUS];
-};
-
-#endif /* _VX_SCHED_DEF_H */
+++ /dev/null
-#ifndef _VX_XID_H
-#define _VX_XID_H
-
-#ifndef CONFIG_VSERVER
-#warning config options missing
-#endif
-
-#define XID_TAG_SB(sb) (sb->s_flags & MS_TAGXID)
-
-#define XID_TAG(in) (!(in) || \
- (((struct inode *)in)->i_sb && \
- XID_TAG_SB(((struct inode *)in)->i_sb)))
-
-
-#ifdef CONFIG_XID_TAG_NFSD
-#define XID_TAG_NFSD 1
-#else
-#define XID_TAG_NFSD 0
-#endif
-
-
-#ifdef CONFIG_INOXID_NONE
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOXID_XID(tag, uid, gid, xid) (0)
-
-#define XIDINO_UID(tag, uid, xid) (uid)
-#define XIDINO_GID(tag, gid, xid) (gid)
-
-#endif
-
-
-#ifdef CONFIG_INOXID_GID16
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0x0000FFFF
-
-#define INOXID_XID(tag, uid, gid, xid) \
- ((tag) ? (((gid) >> 16) & 0xFFFF) : 0)
-
-#define XIDINO_UID(tag, uid, xid) (uid)
-#define XIDINO_GID(tag, gid, xid) \
- ((tag) ? (((gid) & 0xFFFF) | ((xid) << 16)) : (gid))
-
-#endif
-
-
-#ifdef CONFIG_INOXID_UGID24
-
-#define MAX_UID 0x00FFFFFF
-#define MAX_GID 0x00FFFFFF
-
-#define INOXID_XID(tag, uid, gid, xid) \
- ((tag) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
-
-#define XIDINO_UID(tag, uid, xid) \
- ((tag) ? (((uid) & 0xFFFFFF) | (((xid) & 0xFF00) << 16)) : (uid))
-#define XIDINO_GID(tag, gid, xid) \
- ((tag) ? (((gid) & 0xFFFFFF) | (((xid) & 0x00FF) << 24)) : (gid))
-
-#endif
-
-
-#ifdef CONFIG_INOXID_UID16
-
-#define MAX_UID 0x0000FFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOXID_XID(tag, uid, gid, xid) \
- ((tag) ? (((uid) >> 16) & 0xFFFF) : 0)
-
-#define XIDINO_UID(tag, uid, xid) \
- ((tag) ? (((uid) & 0xFFFF) | ((xid) << 16)) : (uid))
-#define XIDINO_GID(tag, gid, xid) (gid)
-
-#endif
-
-
-#ifdef CONFIG_INOXID_INTERN
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOXID_XID(tag, uid, gid, xid) \
- ((tag) ? (xid) : 0)
-
-#define XIDINO_UID(tag, uid, xid) (uid)
-#define XIDINO_GID(tag, gid, xid) (gid)
-
-#endif
-
-
-#ifdef CONFIG_INOXID_RUNTIME
-
-#define MAX_UID 0xFFFFFFFF
-#define MAX_GID 0xFFFFFFFF
-
-#define INOXID_XID(tag, uid, gid, xid) (0)
-
-#define XIDINO_UID(tag, uid, xid) (uid)
-#define XIDINO_GID(tag, gid, xid) (gid)
-
-#endif
-
-
-#ifdef CONFIG_INOXID_NONE
-#define vx_current_fsxid(sb) (0)
-#else
-#define vx_current_fsxid(sb) \
- (XID_TAG_SB(sb) ? current->xid : 0)
-#endif
-
-#define INOXID_UID(tag, uid, gid) \
- ((tag) ? ((uid) & MAX_UID) : (uid))
-#define INOXID_GID(tag, uid, gid) \
- ((tag) ? ((gid) & MAX_GID) : (gid))
-
-
-static inline uid_t vx_map_uid(uid_t uid)
-{
- if ((uid > MAX_UID) && (uid != -1))
- uid = -2;
- return (uid & MAX_UID);
-}
-
-static inline gid_t vx_map_gid(gid_t gid)
-{
- if ((gid > MAX_GID) && (gid != -1))
- gid = -2;
- return (gid & MAX_GID);
-}
-
-
-#ifdef CONFIG_VSERVER_LEGACY
-#define FIOC_GETXID _IOR('x', 1, long)
-#define FIOC_SETXID _IOW('x', 2, long)
-#define FIOC_SETXIDJ _IOW('x', 3, long)
-#endif
-
-int vx_parse_xid(char *string, xid_t *xid, int remove);
-void vx_propagate_xid(struct nameidata *nd, struct inode *inode);
-
-#endif /* _VX_XID_H */
+++ /dev/null
-// $Id: getctx-compat.hc,v 1.1.2.2 2003/12/30 13:45:57 ensc Exp $ --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//
-// 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; version 2 of the License.
-//
-// 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.
-
-
-#ifndef H_UTIL_VSERVER_LIB_GETCTX_COMPAT_H
-#define H_UTIL_VSERVER_LIB_GETCTX_COMPAT_H
-
-#include "getctx-legacy.hc"
-
-static inline ALWAYSINLINE xid_t
-vc_X_getctx_compat(pid_t pid)
-{
- return vc_X_getctx_legacy(pid);
-}
-
-#endif // H_UTIL_VSERVER_LIB_GETCTX_COMPAT_H
+++ /dev/null
-// $Id: getctx-legacy.hc,v 1.1.2.3 2003/12/30 13:45:57 ensc Exp $ --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//
-// 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; version 2 of the License.
-//
-// 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.
-
-
-#ifndef H_UTIL_VSERVER_LIB_GETCTX_LEGACY_H
-#define H_UTIL_VSERVER_LIB_GETCTX_LEGACY_H
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "compat.h"
-
-#include "vserver.h"
-#include "vserver-internal.h"
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#define CTX_TAG "\ns_context: "
-
-static xid_t
-vc_X_getctx_legacy(pid_t pid)
-{
- static volatile size_t bufsize=4097;
- // TODO: is this really race-free?
- size_t cur_bufsize = bufsize;
- int fd;
- char status_name[ sizeof("/proc/01234/status") ];
- char buf[cur_bufsize];
- size_t len;
- char *pos = 0;
-
- if (pid<0 || (uint32_t)(pid)>99999) {
- errno = EINVAL;
- return 0;
- }
-
- if (pid==0) strcpy(status_name, "/proc/self/status");
- else {
- strcpy(status_name, "/proc/");
- len = utilvserver_uint2str(status_name+sizeof("/proc/")-1,
- sizeof(status_name)-sizeof("/proc//status")+1,
- pid, 10);
- strcpy(status_name+sizeof("/proc/")+len-1, "/status");
- }
-
- fd = open(status_name, O_RDONLY);
- if (fd==-1) return VC_NOCTX;
-
- len = read(fd, buf, cur_bufsize);
- close(fd);
-
- if (len<cur_bufsize) {
- buf[len] = '\0';
- pos = strstr(buf, CTX_TAG);
- }
- else if (len!=(size_t)-1) {
- bufsize = cur_bufsize * 2 - 1;
- errno = EAGAIN;
- }
-
- if (pos!=0) return atoi(pos+sizeof(CTX_TAG)-1);
- else return VC_NOCTX;
-}
-
-#endif // H_UTIL_VSERVER_LIB_GETCTX_LEGACY_H
+++ /dev/null
-// $Id: getctx.c,v 1.2.2.2 2003/12/30 13:45:57 ensc Exp $ --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//
-// 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; version 2 of the License.
-//
-// 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.
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "compat.h"
-#include "vserver.h"
-#include "vserver-internal.h"
-
-#ifdef VC_ENABLE_API_COMPAT
-# include "getctx-compat.hc"
-#endif
-
-#ifdef VC_ENABLE_API_LEGACY
-# include "getctx-legacy.hc"
-#endif
-
-#include <sys/types.h>
-
-xid_t
-vc_X_getctx(pid_t pid)
-{
- CALL_VC(CALL_VC_COMPAT(vc_X_getctx, pid),
- CALL_VC_LEGACY(vc_X_getctx, pid));
-}
+++ /dev/null
-// $Id: uint2str.c,v 1.1.2.1 2003/10/14 15:19:14 ensc Exp $ --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//
-// 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; version 2 of the License.
-//
-// 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.
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "compat.h"
-
-#include <assert.h>
-#include <stdbool.h>
-#include <string.h>
-
-size_t
-utilvserver_uint2str(char *buf, size_t len, unsigned int val, unsigned char base)
-{
- char *ptr = buf+len-1;
- register size_t res;
- if (base>=36 || len==0) return 0;
-
- *ptr = '\0';
- while (ptr>buf) {
- unsigned char digit = val%base;
-
- --ptr;
- *ptr = (digit<10 ? '0'+digit :
- digit<36 ? 'a'+digit-10 :
- (assert(false),'?'));
-
- val /= base;
- if (val==0) break;
- }
-
- assert(ptr>=buf && ptr<=buf+len-1);
-
- res = buf+len-ptr;
- memmove(buf, ptr, res);
-
- return res-1;
-}
+++ /dev/null
-## $Id: Makefile-files,v 1.1.2.2 2003/11/03 20:49:42 ensc Exp $ -*- makefile -*-
-
-## Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-##
-## 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.
-
-linuxconf_gen_SCRPTS = linuxconf/newvserver
-linuxconf_src_DATMAN = linuxconf/newvserver.8
-linuxconf_cfg_src_DTA = linuxconf/newvserver.defaults
-
-linuxconf_XTRAS = linuxconf/newvserver.subst \
- $(linuxconf_cfg_src_DTA) \
- $(linuxconf_src_DATMAN)
-
-linuxconf_GENFILES = $(linuxconf_gen_SCRPTS)
-
-
-if ENSC_ENABLE_LINUXCONF
-linuxconf_DATMAN = $(linuxconf_src_DATMAN)
-linuxconf_SCRPTS = $(linuxconf_gen_SCRPTS)
-linuxconf_cfg_DTA = $(linuxconf_cfg_src_DTA)
-
-linuxconf/%: linuxconf/%.subst
- @mkdir -p $$(dirname '$@')
- sed -e 's!@'PKGLIBDIR'@!$(pkglibdir)!g; \
- s!@'SBINDIR'@!$(sbindir)!g' '$<' >'$@.tmp'
- @-chmod --reference='$<' '$@.tmp'
- @-rm -f '$@'
- mv '$@.tmp' '$@'
- @chmod a-w '$@'
-else
-linuxconf_DATMAN =
-linuxconf_SCRPTS =
-linuxconf_cfg_DTA =
-endif
+++ /dev/null
-.TH "newvserver" "8" "0.1.0" "Jacques Gelinas <jack@solucorp.qc.ca>" "System Administration"
-.SH "NAME"
-.LP
-newvserver \- The newvserver is an interactive tool to create new vservers.
-.SH "SYNTAX"
-.LP
-newvserver [ options ]
-
-.SH "DESCRIPTION"
-.LP
-newvserver \- The newvserver creates new vservers interactivly. It provides
-a graphical user interface as well as a text user interface. You can
-configure most aspect of the vserver (name, description, hostname, IP number,
-root password, ...), select a source and then perform the creation.
-
-A vserver may be created by cloning another one, cloning the root server
-or by performing a minimal installation from a distribution CD (RedHat
-supported so far).
-
-.SH "Default values"
-.LP
-The file /etc/vservers/newvserver.defaults is sourced to get default
-input value for many fields. If you are creating many vservers
-(you will :-) ), you may want to edit this file and enter suitable
-values such as your domain name, IP network, etc...
-
-
-.SH "OPTIONS"
-.LP
-.TP
-.I --help:
-Presents a summary of the options.
-.TP
-.I --name:
-Set the name of the new vserver.
-.TP
-.I --desc:
-Set the description.
-.TP
-.I --unify 1/0:
-Turn on unification on and off.
-.TP
-.I --hostname:
-Set the host name of the new vserver
-.TP
-.I --ip:
-Set the IP number(s)
-.TP
-.I --ondev:
-Install the IP numbers as IP aliases on device.
-.TP
-.I --clone:
-Create the vserver from another one or a distribution CD.
-.TP
-The distribution CD are identified by special strings:
- #rh8.0m: RedHat 8 minimal
- #rh8.0f: RedHat 8 complete first CD
- #rh7.3m: RedHat 7.3 minimal
- #rh7.3f: RedHat 7.3 complete first CD
- #rh7.2m: RedHat 7.2 minimal
- #rh7.2f: RedHat 7.2 complete first CD
-
-.SH "FILES"
-.LP
-\fI/etc/vservers/*.conf\fP
-.P
-\fI/etc/vservers/*.sh\fP
-.P
-\fI/etc/vservers/newvserver.defaults\fP
-.P
-\fI/vservers/*\fP
-
-.SH "AUTHORS"
-.LP
-This Man page was written by Jacques Gelinas.
-.SH "SEE ALSO"
-.LP
-vserver(8)
-vserver\-stat(8)
-distrib-info(8)
-vbuild(8)
-
+++ /dev/null
-# This script is sourced by newvserver to set the dialog default values
-# Uncomment only the line you want to override.
-# Name of the vserver
-# name=
-# Description
-# desc=
-# Reference vserver to clone
-# clone=/
-# Use unification
-# unify=1
-# Host name. Put the default domain if you want
-# hostname=.mydomain.com
-# List of IP
-# Put the prefix of your network to save some typing
-# ip=
-# Network device for IP aliases setup
-# ondev=eth0
-
+++ /dev/null
-#!/usr/bin/shellmod
-# This module is used to create a new virtual private server
-
-# This module may be use inside linuxconf
-# Do linuxconf --modulemain shellmod --setmod @SBINDIR@/newvserver
-
-# Load shellmod support function
-. /usr/lib/linuxconf/lib/shellmod-lib.sh
-
-USR_SBIN=@SBINDIR@
-USR_LIB_VSERVER=@PKGLIBDIR@
-VSERVER_CMD=$USR_SBIN/vserver
-CHBIND_CMD=$USR_SBIN/chbind
-CHCONTEXT_CMD=$USR_SBIN/chcontext
-SAVE_S_CONTEXT_CMD=$USR_LIB_VSERVER/save_s_context
-CAPCHROOT_CMD=$USR_LIB_VSERVER/capchroot
-VSERVERKILLALL_CMD=$USR_LIB_VSERVER/vserverkillall
-
-
-usage(){
- cat <<-EOF >&2
-
-newvserver [ options ]
-
- Interactive utility to create vservers.
-
-Options:
- --name: Set the name of the new vserver.
- --desc: Set the description.
- --unify 1/0: Turn on unification on and off.
- --hostname: Set the host name of the new vserver
- --ip: Set the IP number(s)
- --ondev: Install the IP numbers as IP aliases on device.
- --clone: Create the vserver from another one or a distribution CD.
-
-The distribution CD are identified by special strings:
- #rh9.0m: RedHat 9 minimal
- #rh9.0f: RedHat 9 complete first CD
- #rh8.0m: RedHat 8 minimal
- #rh8.0f: RedHat 8 complete first CD
- #rh7.3m: RedHat 7.3 minimal
- #rh7.3f: RedHat 7.3 complete first CD
- #rh7.2m: RedHat 7.2 minimal
- #rh7.2f: RedHat 7.2 complete first CD
-
-EOF
-}
-
-register(){
- qecho regmenu main MENU_MISCSERV "Create a new vserver"
-}
-
-check_name(){
- LEN=`echo -n $1 | wc -c`
- SMALL=`expr $LEN \<= 10`
- if [ "$SMALL" = "1" ] ; then
- return 0
- fi
- return 1
-}
-
-check_hostname(){
- case $1 in
- *\.*)
- return 0
- ;;
- *)
- ;;
- esac
- return 1
-}
-
-check_ip(){
- case $1 in
- *\.*\.*\.*)
- return 0
- ;;
- *)
- ;;
- esac
- return 1
-}
-
-check_device(){
- if [ "$1" = "" ] ; then
- return 1;
- fi
- return 0
-}
-
-# Tell the user to mount the CD
-check_cd(){
- echo defval s1 "Make sure the $1"
- echo defval s1 "is mounted on /mnt/cdrom"
- echo defval s1
- echo defval s1 "Execute \"mount /mnt/cdrom\" if not"
- echo notice =s1
-}
-
-# Set a fake fstab and mtab in a vserver
-# $1 is the vserver path (/vserver/id)
-set_fstab(){
- mkdir -p $1/etc
- echo /dev/hdv1 / ext2 defaults 1 1 >$1/etc/fstab
- echo /dev/hdv1 / ext2 rw 1 1 >$1/etc/mtab
-}
-
-# Show a progress bar during installation
-# The sub-process sends the number of output line first, then the lines
-execprogress(){
- LOG=$1
- title=$2
- desc=$3
- shift; shift; shift
- $* |
- (
- >$LOG
- read SIZE rest
- qecho DIALOG
- qecho settype DIATYPE_POPUP
- qecho newf_str p1 "Package"
- qecho newf_gauge s1 "$desc" 0 $SIZE
- qecho show "$title" "$SIZE $rest"
- nb=0
- while read pkg line
- do
- nb=`expr $nb + 1`
- printf "%-20s %s\n" $pkg $line >>$LOG
- qecho newf_str p1 "Package" "$pkg"
- qecho newf_gauge s1 "$desc" $nb $SIZE
- qecho show "$title" "$SIZE $rest"
- done
- qecho end
- )
-}
-
-# install some packages with a progress bar
-installpkgs(){
- LOG=$1
- shift
- execprogress $LOG "Installing" "Packages installed" $*
-}
-
-# Point d'entré du module
-main(){
- name=
- desc=
- clone=/
- unify=1
- hostname=
- ip=
- ondev=eth0
- if [ -f /etc/vservers/newvserver.defaults ] ; then
- source /etc/vservers/newvserver.defaults
- fi
- while [ "$1" != "" ]
- do
- case $1 in
- --help)
- usage
- exit
- ;;
- --name)
- name=$2
- shift; shift
- ;;
- --desc)
- desc=$2
- shift; shift
- ;;
- --unify)
- unify=$2
- shift; shift
- ;;
- --hostname)
- hostname=$2
- shift; shift
- ;;
- --ip)
- ip="$2"
- shift; shift
- ;;
- --ondev)
- ondev=$2
- shift; shift
- ;;
- --clone)
- clone=$2
- shift; shift
- ;;
- *)
- qecho error "Invalid option $1"
- exit 1
- esac
- done
- qecho DIALOG
- qecho newf_title top 1 top
- qecho newf_str name "Vserver name (max 10 chars)" $name
- qecho newf_str desc "Vserver description" "$desc"
- qecho newf_list clone "Clone vserver" $clone
- for conf in /etc/vservers/*.conf
- do
- case $conf in
- /etc/vservers/\*.conf)
- ;;
- *)
- DESC=`grep "# Description:" $conf | ( read a b c; echo $c)`
- qecho listitem `basename $conf .conf` "$DESC"
- ;;
- esac
- done
- qecho listitem / "Root server"
- qecho listitem "#rh9.0m" "From RedHat 9.0 CDrom/Minimal"
- qecho listitem "#rh9.0f" "From RedHat 9.0 CDrom/Full"
- qecho listitem "#rh8.0m" "From RedHat 8.0 CDrom/Minimal"
- qecho listitem "#rh8.0f" "From RedHat 8.0 CDrom/Full"
- qecho listitem "#rh7.3m" "From RedHat 7.3 CDrom/Minimal"
- qecho listitem "#rh7.3f" "From RedHat 7.3 CDrom/Full"
- qecho listitem "#rh7.2" "From RedHat 7.2 CDrom"
- #qecho listitem "#mdk8.2m" "From Mandrake 8.2 CDrom/Minimal"
- #qecho listitem "#mdk8.2f" "From Mandrake 8.2 CDrom/Full"
- qecho newf_chk unify "Unified mode" 1 "Share disk space" $unify
-
- qecho newf_title Networking 1 Networking
- qecho newf_str hostname "Host name" $hostname
- qecho newf_info "" "Up to 16 IP numbers"
- qecho newf_str ip "IP number(s)" "$ip"
- qecho newf_str ondev "Install IP on device" $ondev
-
- qecho newf_title Authentication 1 Authentication
- qecho newf_pass pass1 "Root password"
- qecho newf_pass pass2 "Root password (retype)"
- qecho newf_chk usemd5 "Password format" 1 "Use MD5"
- qecho newf_chk useshadow "Password location" 1 "/etc/shadow"
-
- qecho newf_title NIS/LDAP 1 NIS/LDAP
- qecho newf_str nisserver "NIS server"
- qecho newf_str domainname "NIS domainname"
- qecho newf_str ldapserver "LDAP server"
- qecho newf_str ldapbasedn "LDAP base dn"
-
- qecho newf_title Services 1 Services
- qecho newf_chk crond "crond" 1 "Scheduled tasks"
- qecho newf_chk httpd "httpd" 0 "Web server"
- qecho newf_chk sshd "sshd" 1 "Secure shell server"
- qecho newf_chk cleansshd "" 1 "Redo sshd server keys"
- qecho newf_chk syslog "syslog" 1 "Message logger"
- qecho newf_chk xinetd "xinetd" 0 "On demand inet service"
- qecho newf_chk nscd "nscd" 0 "Name service cache daemon"
-
- qecho newf_title "Backup profile" 1 "Backup profile"
- qecho newf_str bkhostname "Host name"
- qecho newf_info "" "Up to 16 IP numbers"
- qecho newf_str bkip "IP number(s)"
- qecho newf_str bkondev "Install IP on device" eth0
-
- qecho newf_title Extra 1 Extra
- qecho newf_chk onboot "Start server" 0 "at boot time"
- qecho newf_str priority "Start priority" 100
- qecho newf_str nice "Nice level"
- qecho newf_info "Available flags" "lock nproc sched hideinfo private"
- qecho newf_str flags "Flags" "lock nproc"
- qecho newf_str ulimit "Vserver ulimit" "-H -u 1000"
-
-
- qecho newf_title "Shared directories" 1 "Shared directories"
- qecho newf_str dir1 "Directory"
- qecho newf_str dir2 "Directory"
- qecho newf_str dir3 "Directory"
- qecho newf_str dir4 "Directory"
-
- qecho newf_title "Excluded directories" 1 "Excluded directories"
- qecho newf_info "" "Won't copy files in those directories"
- qecho newf_str exdir1 "Directory" "/var/log"
- qecho newf_str exdir2 "Directory" "/var/run"
- qecho newf_str exdir3 "Directory" "/var/spool/mail"
- qecho newf_str exdir4 "Directory" "/tmp"
- qecho newf_str exdir5 "Directory" ""
- qecho newf_str exdir6 "Directory" ""
-
-
- while true
- do
- qecho edit "Vserver basic setup"
- dispatch
- if [ $CODE != "accept" ] ; then
- break
- elif ! check_name $name ; then
- qecho error "You must provide a name (10 chars max)"
- elif ! check_hostname $hostname ; then
- qecho error "You must provide a valid/fully qualified host name"
- elif ! check_ip $ip ; then
- qecho error "You must provide a valid IP number"
- elif ! check_device $ondev ; then
- qecho error "You must provide a valid network device"
- elif [ "$pass1" != "" -a "$pass1" != "$pass2" ] ; then
- echo defval s1 The two passwords differ.
- echo defval s1 You must re-enter the root password.
- echo error =s1
- else
- STARTTIME=`date +%s`
- ONBOOT=no
- if [ "$onboot" = "1" ] ; then
- ONBOOT=yes
- fi
- VROOT=/vservers/$name
- CONF=/etc/vservers/$name.conf
- $USR_LIB_VSERVER/install-pre.sh $name
- rm -f $CONF >/dev/null 2>/dev/null
- echo "# Description: $desc" >>$CONF
- echo >>$CONF
- echo "if [ \"$PROFILE\" = \"\" ]; then" >>$CONF
- echo " PROFILE=prod" >>$CONF
- echo "fi" >>$CONF
- echo "case \$PROFILE in" >>$CONF
- echo "prod)" >>$CONF
- echo " # Select the IP number(s) assigned to the virtual server" >>$CONF
- echo " # These IPs will be defined as IP alias" >>$CONF
- echo " # The alias will be setup on IPROOTDEV" >>$CONF
- echo " # You can specify the device if needed" >>$CONF
- echo " # IPROOT=\"eth0:1.2.3.4 eth1:3.4.5.6\" " >>$CONF
- echo " IPROOT=\"$ip\"" >>$CONF
- echo " # You can define on which device the IP alias will be done" >>$CONF
- echo " # The IP alias will be set when the server is started and unset" >>$CONF
- echo " # when the server is stopped" >>$CONF
- echo " # The netmask and broadcast are computed by default from IPROOTDEV" >>$CONF
- echo " #IPROOTMASK=" >>$CONF
- echo " #IPROOTBCAST=" >>$CONF
- echo " IPROOTDEV=$ondev" >>$CONF
- echo " # You can set a different host name for the vserver" >>$CONF
- echo " # If empty, the host name of the main server is used" >>$CONF
- echo " S_HOSTNAME=$hostname" >>$CONF
- echo " ;;" >>$CONF
- echo "backup)" >>$CONF
- echo " IPROOT=\"$bkip\"" >>$CONF
- echo " #IPROOTMASK=" >>$CONF
- echo " #IPROOTBCAST=" >>$CONF
- echo " IPROOTDEV=$bkondev" >>$CONF
- echo " S_HOSTNAME=$bkhostname" >>$CONF
- echo " ;;" >>$CONF
- echo "esac" >>$CONF
- echo "# Set ONBOOT to yes or no if you want to enable this" >>$CONF
- echo "# virtual server at boot time" >>$CONF
- echo "ONBOOT=$ONBOOT" >>$CONF
- echo "# Control the start order of the vservers" >>$CONF
- echo "# Lower value start first" >>$CONF
- echo "PRIORITY=$priority" >>$CONF
- echo "# You can set a different NIS domain for the vserver" >>$CONF
- echo "# If empty, the current on is kept" >>$CONF
- echo "# Set it to \"none\" to have no NIS domain set" >>$CONF
- echo "S_DOMAINNAME=$domainname" >>$CONF
- echo "# You can set the priority level (nice) of all process in the vserver" >>$CONF
- echo "# Even root won't be able to raise it" >>$CONF
- echo "S_NICE=$nice" >>$CONF
- echo "# You can set various flags for the new security context" >>$CONF
- echo "# lock: Prevent the vserver from setting new security context" >>$CONF
- echo "# sched: Merge scheduler priority of all processes in the vserver" >>$CONF
- echo "# so that it acts a like a single one." >>$CONF
- echo "# nproc: Limit the number of processes in the vserver according to ulimit" >>$CONF
- echo "# (instead of a per user limit, this becomes a per vserver limit)" >>$CONF
- echo "# private: No other process can join this security context. Even root" >>$CONF
- echo "# Do not forget the quotes around the flags" >>$CONF
- echo "S_FLAGS=\"$flags\"" >>$CONF
- echo "# You can set various ulimit flags and they will be inherited by the" >>$CONF
- echo "# vserver. You enter here various command line argument of ulimit" >>$CONF
- echo "# ULIMIT=\"-H -u 200\"" >>$CONF
- echo "# The example above, combined with the nproc S_FLAGS will limit the" >>$CONF
- echo "# vserver to a maximum of 200 processes" >>$CONF
- echo "ULIMIT=\"$ulimit\"" >>$CONF
- echo "# You can set various capabilities. By default, the vserver are run" >>$CONF
- echo "# with a limited set, so you can let root run in a vserver and not" >>$CONF
- echo "# worry about it. He can\'t take over the machine. In some cases" >>$CONF
- echo "# you can to give a little more capabilities \(such as CAP_NET_RAW\)" >>$CONF
- echo "# S_CAPS=\"CAP_NET_RAW\"" >>$CONF
- echo "S_CAPS=\"\"" >>$CONF
- echo "# Select an unused context (this is optional)" >>$CONF
- echo "# The default is to allocate a free context on the fly" >>$CONF
- echo "# In general you don't need to force a context" >>$CONF
- echo "#S_CONTEXT=" >>$CONF
-
- # Now we create the optional companion startup script
- # for the vserver
- SCRIPT=/etc/vservers/$name.sh
- echo "#!/bin/sh" >$SCRIPT
- echo 'case $1 in' >>$SCRIPT
- echo "pre-start)" >>$SCRIPT
- for dir in $dir1 $dir2 $dir3 $dir4 none
- do
- if [ "$dir" != "none" ] ; then
- echo " mkdir -p $VROOT/$dir" >>$SCRIPT
- echo " mount --bind $dir $VROOT/$dir" >>$SCRIPT
- fi
- done
- echo " ;;" >>$SCRIPT
- echo "post-start)" >>$SCRIPT
- echo " ;;" >>$SCRIPT
- echo "pre-stop)" >>$SCRIPT
- echo " ;;" >>$SCRIPT
- echo "post-stop)" >>$SCRIPT
- for dir in $dir1 $dir2 $dir3 $dir4 none
- do
- if [ "$dir" != "none" ] ; then
- echo " umount $VROOT/$dir" >>$SCRIPT
- fi
- done
- echo " ;;" >>$SCRIPT
- echo '*)' >>$SCRIPT
- echo ' echo $0 pre-start' >>$SCRIPT
- echo ' echo $0 pre-stop' >>$SCRIPT
- echo ' echo $0 post-start' >>$SCRIPT
- echo ' echo $0 post-stop' >>$SCRIPT
- echo " ;;" >>$SCRIPT
- echo "esac" >>$SCRIPT
- chmod +x $SCRIPT
-
- LOG=/var/run/newvserver.log.$$
- if [ "$clone" = "/" ] ; then
- # Unification does not work on / yet
- $VSERVER_CMD $name build >$LOG
- elif [ "$clone" = "#rh7.2" ] ; then
- check_cd "first RedHat 7.2 CD"
- set_fstab $VROOT
- installpkgs $LOG $USR_LIB_VSERVER/install-rh7.2 $name
- elif [ "$clone" = "#rh7.3m" -o "$clone" = "#rh7.3f" ] ; then
- check_cd "first RedHat 7.3 CD"
- set_fstab $VROOT
- if [ "$clone" = "#rh7.3m" ] ;then
- installpkgs $LOG $USR_LIB_VSERVER/install-rh7.3 $name minimum
- else
- installpkgs $LOG $USR_LIB_VSERVER/install-rh7.3 $name full
- fi
- elif [ "$clone" = "#rh8.0m" -o "$clone" = "#rh8.0f" ] ; then
- check_cd "first RedHat 8.0 CD"
- set_fstab $VROOT
- if [ "$clone" = "#rh8.0m" ] ;then
- installpkgs $LOG $USR_LIB_VSERVER/install-rh8.0 $name minimum
- else
- installpkgs $LOG $USR_LIB_VSERVER/install-rh8.0 $name full
- fi
- elif [ "$clone" = "#rh9.0m" -o "$clone" = "#rh9.0f" ] ; then
- check_cd "first RedHat 9.0 CD"
- set_fstab $VROOT
- if [ "$clone" = "#rh9.0m" ] ;then
- installpkgs $LOG $USR_LIB_VSERVER/install-rh9.0 $name minimum
- else
- installpkgs $LOG $USR_LIB_VSERVER/install-rh9.0 $name full
- fi
- elif [ "$unify" = "0" ] ; then
- cp -ax /vservers/$clone/. $VROOT/. >$LOG
- else
- EXCLOPT=
- for dir in $exdir1 $exdir2 $exdir3 $exdir4 $exdir5 $exdir6 none
- do
- if [ "$dir" != "none" ] ; then
- EXCLOPT="$EXCLOPT --excldir $dir"
- fi
- done
- $USR_LIB_VSERVER/vbuild $EXCLOPT --stats /vservers/$clone $VROOT >$LOG
- fi
- rm -f $VROOT/var/run/utmp
- $USR_LIB_VSERVER/fakerunlevel 3 $VROOT/var/run/utmp
- test "$crond" = 1 && $VSERVER_CMD $name chkconfig crond on >/dev/null
- test "$httpd" = 1 && $VSERVER_CMD $name chkconfig httpd on >/dev/null
- test "$sshd" = 1 && $VSERVER_CMD $name chkconfig sshd on >/dev/null
- if [ "$cleansshd" = 1 ] ; then
- echo Deleting sshd server keys >>$LOG
- rm -f $VROOT/etc/ssh/*_key
- rm -f $VROOT/etc/ssh/*_key.pub
- fi
- test "$syslog" = 1 && $VSERVER_CMD $name chkconfig syslog on >/dev/null
- test "$xinetd" = 1 && $VSERVER_CMD $name chkconfig xinetd on >/dev/null
- test "$nscd" = 1 && $VSERVER_CMD $name chkconfig nscd on >/dev/null
- host0=`echo $hostname | sed 's/\./ /g' | ( read a b; echo $a)`
- echo $ip $hostname $host0 localhost >$VROOT/etc/hosts
- RHNETWORK=$VROOT/etc/sysconfig/network
- if [ -f $RHNETWORK ] ; then
- cat $RHNETWORK | grep -v HOSTNAME >/tmp/newvserver.tmp.$$
- cp /tmp/newvserver.tmp.$$ $RHNETWORK
- echo HOSTNAME=$hostname >>$RHNETWORK
- fi
- # Umount proc and /dev/pts
- $VSERVER_CMD $name stop >/dev/null
- ENDTIME=`date +%s`
- DURATION=`expr $ENDTIME - $STARTTIME`
-
- echo defval s1 Server $name was installed in $VROOT
- echo defval s1 The configuration file /etc/vservers/$name.conf was created
- echo defval s1 The script /etc/vservers/$name.sh was created
- echo defval s1 Vserver $name was created in $DURATION seconds
- echo defval s1
- cat $LOG | while read line
- do
- echo defval s1 $line
- done
- echo notice =s1
- rm -f $LOG
- # Finish some stuff: root password, account policies
- if [ -x $VROOT/usr/sbin/authconfig ] ; then
- SHADOWOPT=
- MD5OPT=
- NISOPT=
- LDAPOPT=
- if [ "$usemd5" = "1" ] ; then
- MD5OPT=--usemd5
- fi
- if [ "$useshadow" = "1" ] ; then
- SHADOWOPT=--useshadow
- fi
- if [ "$nisserver" != "" ] ; then
- NISOPT="--nisserver $nisserver --nisdomain $domainname"
- fi
- if [ "$ldapserver" != "" ] ; then
- LDAPOPT="--ldapserver $ldapserver --ldapbasedn $ldapbasedn"
- fi
- $VSERVER_CMD $name exec /usr/sbin/authconfig \
- --nostart --kickstart \
- $SHADOWOPT $MD5OPT $NISOPT $LDAPOPT
- fi
- if [ "$pass1" != "" ] ; then
- (echo $pass1; sleep 5; echo $pass1) \
- | $VSERVER_CMD --silent $name exec passwd >/dev/null
- fi
- break
- fi
- done
- qecho end
-}
-
-dispatch
+++ /dev/null
-dnl $Id: ensc_kerneldir.m4,v 1.3 2004/02/14 01:20:35 ensc Exp $
-
-dnl Copyright (C) 2002 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; version 2 of the License.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-dnl Usage: ENSC_KERNEL_HEADERS(<var>)
-dnl <var> ... basedir of kernel-headers (without the '/linux');
-dnl this value will be AC_SUBST'ed
-
-AC_DEFUN([_ENSC_KERNEL_DIR],
-[
- AC_CACHE_CHECK([for linux kernel dir], [ensc_cv_path_kerneldir],
- [
-AC_ARG_WITH([kerneldir],
- [AC_HELP_STRING([--with-kerneldir=DIR],
- [assume kernelsources in DIR (default: /lib/modules/<current>/build)])],
- [case "$withval" in
- yes|no) AC_MSG_ERROR(['$withval' is not a valid value for kerneldir]);;
- *) ensc_cv_path_kerneldir=$withval;;
- esac],
- [ensc_cv_path_kerneldir=
- for i in /lib/modules/$(uname -r)/build /usr/src/linux /usr; do
- test -e $i/include/linux/version.h && { ensc_cv_path_kerneldir=$i; break; }
- done])
- ])
-
- test "$ensc_cv_path_kerneldir" -a -e "$ensc_cv_path_kerneldir"/include/linux/version.h || {
- AC_MSG_ERROR([Can not find kernelsources])
- }
-])
-
-AC_DEFUN([ENSC_KERNEL_HEADERS],
-[
- AC_REQUIRE([_ENSC_KERNEL_DIR])
-
- AC_CACHE_CHECK([for linux kernel headers], [ensc_cv_path_kernelheaders],
- [
- ensc_cv_path_kernelheaders=$ensc_cv_path_kerneldir/include
- ])
-
- if test x"$1" != x; then
- $1=$ensc_cv_path_kernelheaders
- AC_SUBST($1)
- fi
-])
+++ /dev/null
-.TH "vrpm" "8" "0.1.0" "Klavs Klavsen <kl@vsen.dk>" "System Administration"
-.SH "NAME"
-.LP
-vrpm \- is simply a wrapper for the rpm utility.
-.SH "SYNTAX"
-.LP
-vrpm [--unify] [ALL | vserver1 vserver2 ...] \-\- [rpm options]
-
-.SH "DESCRIPTION"
-.LP
-vrpm \- is simply a wrapper for the rpm utility. It enables rpm to manage a specific, several or all virtual server(s) with one command.
-vrpm is executed in the root server.
-.SH "OPTIONS"
-.LP
-.TP
-\fB\-\-\fR All commands after this, is given to the rpm utility (see man rpm).
-.TP
-The
-\fB--unify\fR option triggers the vunify utility on the vservers and the
-supplied packages.
-.SH "FILES"
-.LP
-\fI/usr/sbin/vrpm\fP
-
-
-.SH "EXAMPLES"
-.TP
-verifies the gcc package on all vservers.
-.LP
-vrpm ALL \-\- \-\-verify gcc
-.TP
-Updates package.rpm on vserver1 and vserver2 if
-the package exists in a earlier version
-(the F flag for rpm).
-.LP
-vrpm vserver1 vserver2 \-\- \-Fvh package.rpm
-.TP
-vrpm is executed in the root server
-.LP
-Please contribute some more, if you feel it's important.
-.SH "AUTHORS"
-.LP
-This Man page was written by Klavs Klavsen <kl@vsen.dk> and based upon the helpful output from the program itself and the documentation on the Virtual Server site <http://www.solucorp.qc.ca/miscprj/s_context.hc?prjstate=1&nodoc=0>
-.SH "SEE ALSO"
-.LP
-chcontext(8) rebootmgr(8) reducecap(8)
-chbind(8) vps(8) vtop(8) vserver(8)
-vserver\-stat(8) vpstree(8)
+++ /dev/null
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-
-scriptversion=2004-02-15.20
-
-# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain.
-#
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-errstatus=0
-dirmode=""
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
-
-Create each directory DIR (with mode MODE, if specified), including all
-leading file name components.
-
-Report bugs to <bug-automake@gnu.org>."
-
-# process command line arguments
-while test $# -gt 0 ; do
- case $1 in
- -h | --help | --h*) # -h for help
- echo "$usage"
- exit 0
- ;;
- -m) # -m PERM arg
- shift
- test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
- dirmode=$1
- shift
- ;;
- --version)
- echo "$0 $scriptversion"
- exit 0
- ;;
- --) # stop option processing
- shift
- break
- ;;
- -*) # unknown option
- echo "$usage" 1>&2
- exit 1
- ;;
- *) # first non-opt arg
- break
- ;;
- esac
-done
-
-for file
-do
- if test -d "$file"; then
- shift
- else
- break
- fi
-done
-
-case $# in
- 0) exit 0 ;;
-esac
-
-# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
-# mkdir -p a/c at the same time, both will detect that a is missing,
-# one will create a, then the other will try to create a and die with
-# a "File exists" error. This is a problem when calling mkinstalldirs
-# from a parallel make. We use --version in the probe to restrict
-# ourselves to GNU mkdir, which is thread-safe.
-case $dirmode in
- '')
- if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
- echo "mkdir -p -- $*"
- exec mkdir -p -- "$@"
- else
- # On NextStep and OpenStep, the `mkdir' command does not
- # recognize any option. It will interpret all options as
- # directories to create, and then abort because `.' already
- # exists.
- test -d ./-p && rmdir ./-p
- test -d ./--version && rmdir ./--version
- fi
- ;;
- *)
- if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
- test ! -d ./--version; then
- echo "mkdir -m $dirmode -p -- $*"
- exec mkdir -m "$dirmode" -p -- "$@"
- else
- # Clean up after NextStep and OpenStep mkdir.
- for d in ./-m ./-p ./--version "./$dirmode";
- do
- test -d $d && rmdir $d
- done
- fi
- ;;
-esac
-
-for file
-do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d
- do
- pathcomp="$pathcomp$d"
- case $pathcomp in
- -*) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp"
-
- mkdir "$pathcomp" || lasterr=$?
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- else
- if test ! -z "$dirmode"; then
- echo "chmod $dirmode $pathcomp"
- lasterr=""
- chmod "$dirmode" "$pathcomp" || lasterr=$?
-
- if test ! -z "$lasterr"; then
- errstatus=$lasterr
- fi
- fi
- fi
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-#!/bin/bash
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on distrib-info by Jacques Gelinas
-# Debian support shoe-horned in by Matthew Lavy <mml@mupsych.org>
-#
-# 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 scripts knows about every possible distribution (well, it should)
-# It is passed a vserver name and a key (a command). The key represent a task.
-# It executes the command and output on stdout.
-# For example
-# distrib-info vserver1 pkgversion
-# If vserver1 is a redhat system, it executes
-# rpm -qa --queryformat "%{name}=%{version}-%{release}
-: ${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"
-
-if [ "$1" = "" ] ; then
- echo distrib-info vserver-name command [ args ... ] >&2
- echo Commands are: >&2
- echo dumpfiles: Shows all files owned by a package >&2
- echo pkgversion: reports all packages and their version/release >&2
- echo unifiles: reports all unify-able file of a package >&2
- exit 1
-fi
-if [ "$1" = "/" ] ; then
- DISTDIR=/
- CHROOTCMD=
-elif [ -d "$1" ] ; then
- DISTDIR=$1
- CHROOTCMD="$SBINDIR/chroot $DISTDIR"
-else
- DISTDIR=$VROOTDIR/$1
- CHROOTCMD="$SBINDIR/chroot $DISTDIR"
-fi
-KEY=$2
-shift
-shift
-if [ -f $DIRDIR/etc/redhat-release -o -f $DISTDIR/etc/mandrake-release ] ; then
- case $KEY in
- pkgversion)
- $CHROOTCMD /bin/rpm -qa --queryformat "%{name}=%{version}-%{release}\n"
- ;;
- unifiles)
- # We remove /etc and /var/log to make sure no special file
- # there will be unified
- $CHROOTCMD /bin/rpm -ql --dump $* \
- | $PKGLIBDIR/parserpmdump /etc/
- ;;
- dumpfiles)
- $CHROOTCMD /bin/rpm -ql $*
- ;;
- *)
- echo unknown request $KEY >&2
- ;;
- esac
-elif [ -f $DISTDIR/etc/debian_version ] ; then
- case $KEY in
- pkgversion)
- $CHROOTCMD /usr/bin/dpkg-query -W \
- --showformat='${Package}=${Version}#${Status}\n' \
- | perl -pe 's/(.+)-.*/$1/' \
- | grep "install ok installed" | cut -d"#" -f1
- ;;
- unifiles)
- echo $* | perl -pe 's/(.+)-.*/$1/' \
- | xargs $CHROOTCMD /usr/bin/dpkg -L \
- | grep -v "^/etc\|^/var"
- ;;
- dumpfiles)
- echo $* | perl -pe 's/(.+)-.*/$1/' \
- | xargs $CHROOTCMD /usr/bin/dpkg -L
- ;;
- *)
- echo unknown request $KEY >&2
- ;;
- esac
-else
- echo Distribution not supported yet >&2
-fi
-
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on rootshell 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.
-
-: ${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"
-
-OPTIONS=$@
-if [ "$OPTIONS" = "" ] ; then
- OPTIONS=--login
-fi
-exec $SBINDIR/chbind --silent --ip 0.0.0.0 /bin/bash $OPTIONS
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on save_s_context 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.
-
-if [ $# -lt 1 ] ;then
- echo save_s_context file command
- echo Save the security context in file and execute a command
-else
- CTX=`grep ^s_context: /proc/self/status | sed s/s_context:// | (read a b; echo $a)`
- CTX=`eval expr $CTX + 0`
- echo S_CONTEXT=$CTX >$1
- echo S_PROFILE=$PROFILE >>$1
- shift
- exec "$@"
-fi
-
-
+++ /dev/null
-PKGLIBDIR='@PKGLIBDIR@'
-SBINDIR='@SBINDIR@'
-VROOTDIR='@VSERVERDIR@'
+++ /dev/null
-#!/usr/bin/perl -w
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on vkill by Philip Snyder
-#
-# 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.
-
-# kill wrapper for vserver.
-# Philip Snyder <psnyder@vizional.com>
-# 2002/02/06 19:00 PST
-
-
-$PROC = $ARGV[0];
-
-# Grab the output from a context query against this process id
-open(PH, "@SBINDIR@/chcontext --silent --ctx 1 cat /proc/$PROC/status 2>&1 |");
-
-# Loop through the output
-while (<PH>) {
-
- # Searching for a line that looks like this:
- # s_context: #
- if (/^s_context: ([0-9]+)/) {
-
- print "Process id $PROC was found in security context $1.\n";
-
- # Make sure the process is in a vserver context
- if ($1 > 0) {
-
- # Since we have the context and the process id, we can kill it
- print " + Killing... ";
- `@SBINDIR@/chcontext --ctx $1 kill $PROC`;
- print "[done]\n";
-
- } else {
-
- # Not in vserver context, so its a process on the actual server
- print " + Killing... ";
- `kill $PROC`;
- print "[done]\n";
-
- }
- exit;
- }
-}
-
-print "Process id $PROC not found.\n";
-exit
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on vprofile 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.
-
-# Prints or select the active profile for a vserver
-if [ $# != 1 -a $# != 2 ] ; then
- echo vprofile vserver [ profile-name ]
-else
- if [ ! -f /etc/vservers/$1.conf ] ; then
- echo vserver $1 does not exist >&2
- else
- unset PROFILE
- . /etc/vservers/$1.conf
- if [ $# = 1 ] ; then
- echo PROFILE=$PROFILE
- elif [ $# = 2 ] ; then
- grep .\*\) /etc/vservers/$1.conf
- fi
- fi
-fi
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on vps by Krischan Jodies
-#
-# 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.
-
-# Wrapper for ps. Adds security context number and name
-# to the PID column.
-#
-# (c) 2002 krischan.jodies@sernet.de
-# version 1.0
-
-# 1.1 Added error messages
-
-if ($ARGV[0] eq "--help") {
- exec("ps @ARGV");
- exit;
-}
-
-
-$lockdir = "/var/run/vservers";
-
-$pid_length = 5;
-get_server_names();
-$context=get_context("self");
-
-if ($context == -1) {
- print "Can not find my security context. Is this a ctx kernel?\n";
- exit;
-}
-if ($context != 1) {
- exec("@SBINDIR@/chcontext --silent --ctx 1 $0 @ARGV");
- print "Can not execute chcontext\n";
- exit; # not reached
-}
-
-
-if (! open PS, "ps @ARGV|") {
- print "Can not execute ps\n";
- exit;
-}
-while (<PS>) {
- chomp;
- push @ps,$_;
-}
-
-$header = shift @ps;
-$header =~ /(.*) PID(.+)/;
-$left = $1;
-$right = $2;
-$left_length = length($left);
-print "${left} PID CONTEXT ${right}\n";
-foreach $line (@ps) {
- $pid = substr $line,$left_length,$pid_length;
- print substr $line,0,$left_length;
- print "$pid";
- $context = get_context($pid);
- $context_name = getcontextname($context);
- printf " %-3s %-10s",$context,$context_name;
- print substr $line,$left_length + $pid_length;
- print "\n";
-
-}
-
-exit;
-
-sub get_context
-{
- my $pid = $_[0];
- $pid =~ s/ //g;
- open STATUS, "/proc/$pid/status";
- while (<STATUS>)
- {
- chomp;
- if (/s_context: (\d+)/) {
- close STATUS;
- return $1;
- }
- }
- close STATUS;
- return -1;
-}
-
-sub getcontextname {
- if (exists $name{$_[0]}) {
- return $name{$_[0]};
- }
- if ($_[0] == 1) {
- return "ALL_PROCS";
- }
- elsif ($_[0] == 0) {
- return "MAIN";
- }
- return "UNKNOWN";
-}
-
-
-sub get_server_names
-{
- opendir LOCKDIR, "$lockdir";
- while ($file=readdir(LOCKDIR)) {
- if (-f "$lockdir/$file") {
- open FILE, "$lockdir/$file";
- $file =~ s/(.+)\.ctx/$1/;
- while (<FILE>) {
- if (/S_CONTEXT=(\d+)/) {
- $name{$1} = $file;
- }
- }
- }
- }
-}
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Mark Lawrence <nomad@null.net>,
-# 2203,2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-#
-# 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.
-
-# Copy/Sync a virtual host from one machine to another
-#
-# History:
-#
-# 2003-04-04: Version 0.4 - Mark lawrence
-# - Set "ONBOOT=no" in the destination .conf file when --startstop
-# is not used, in case the destination roothost reboots. We don't
-# want two copies of a vserver running at the same time.
-#
-# 2003-03-04: Version 0.3 - Mark lawrence
-# - Changed all checks for [ "" != "$var" ] into [ -n|-z "$var" ]. "" doesn't
-# seem to work for bash on the Sparc architecture.
-# - Changed $ssh variable into $shcmd.
-#
-# 2003-02-23: Version 0.2 - Mark Lawrence
-# - Set ONBOOT to "no" in the original .conf file when the "-s" flag is
-# used so that if/when you reboot the source roothost you don't have the
-# same vserver and IP address running on two machines.
-
-: ${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"
-
-VERSION="0.4"
-umask 022
-me=${0##*/}
-
-mktemp="$(which mktemp 2>/dev/null) /tmp/vc.XXXXXX" || \
-mktemp=$(which tempfile 2>/dev/null) || {
- echo $"Can not find mktemp or tempfile" >&2
- exit 1
-}
-
-### Helper functions ###
-
-# Save stdin and stdout for later use
-exec 3>&1
-exec 4>&2
-
-noninteractive () {
- exec &> /dev/null
-}
-
-interactive () {
- exec 1>&3
- exec 2>&4
-}
-
-info () {
- ! $quiet && echo "I: $me: $1" >&3
-}
-
-warn () {
- ! $quiet && echo "W: $me: $1" >&4
-}
-
-error () {
- ! $quiet && echo "E: $me: $2" >&4
- exit $1
-}
-
-
-### Usage/Info functions ###
-
-usage () {
- cat <<EOF 1>&2
-Usage: $me [-hVvqidrRs] vserver newname
- $me [-hVvqidrRs] vserver host:[newname]
-EOF
-}
-
-full_usage () {
- usage
- cat <<EOF
-
-$me uses rsync to make a copy of a vserver. If the destination
-name contains a host specification the vserver will be synchronised to
-the remote destination over ssh/rsh.
-
-This can be used on a running vserver to make a warm backup. With the -s
-flag a vserver can even be operationally moved to different hardware within
-seconds.
-
-The -i and -d flags can be used to minimally reconfigure the destination
-vserver (rewrites /etc/vservers/newname.conf and $VROOTDIR/newname/etc/hosts)
-
-Options:
- -h, --help this help
- -V, --version copyright and version information
- -v, --verbose show all output
- -q, --quiet direct all output to /dev/null (no password
- prompt for logins on remote hosts!)
- -d, --domain [string] new dns domain (must be used with -i)
- -i, --ip [addr] new IP address (must be used with -d)
- -r, --vsroot location of "/vserver/" directory
- -R, --rsh use rsh (instead of default ssh) for
- network transport
- -s, --stopstart stop the local vserver before copying and start
- it on the destination host afterwards
-
-EOF
-}
-
-full_version () {
- cat <<EOF
-$me version $VERSION
-Copyright (c) 2002 Mark Lawrence <nomad@null.net>
-
-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 of the License, or (at
-your option) any later version.
-
-EOF
-}
-
-
-### Default values and Command line options ###
-
-stopstart=(false)
-verbose=(false)
-quiet=(false)
-shcmd="ssh"
-rsflag="-e"
-rsh=(false)
-colon=":"
-domain=""
-ip=""
-vsroot=$VROOTDIR
-
-if [ $# -eq 0 ]; then # Script invoked with no command-line args?
- usage
- exit 1
-fi
-
-temp=$(getopt -o hVvqd:i:rRs --long help,version,verbose,quiet,domain:,ip:,vsroot,rsh,stopstart, -n $me -- "$@")
-
-if [ $? -ne 0 ]; then
- echo " (See -h for help)"
- exit 1
-fi
-
-# Note the quotes around `$temp': they are essential!
-eval set -- "$temp"
-
-while true; do
- case "$1" in
- -h|--help) full_usage
- exit 1
- ;;
- -V|--version) full_version
- exit 1
- ;;
- -v|--verbose) verbose=(true)
- shift
- ;;
- -q|--quiet) quiet=(true)
- shift
- ;;
- -d|--domain) domain="$2"
- shift 2
- ;;
- -i|--ip) ip="$2"
- shift 2
- ;;
- -r|--vsroot) vsroot="$2"
- shift 2
- ;;
- -R|--rsh) rsh=(true)
- shift
- ;;
- -s|--stopstart) stopstart=(true)
- shift
- ;;
- --) shift
- break
- ;;
- *) echo "Internal error!"
- exit 1
- ;;
- esac
-done
-
-if [ $# -ne 2 ]; then
- usage
- exit 1
-fi
-
-
-### ###
-
-# By default we are reasonably quiet (ouput only via info, warn & error)
-if $verbose; then
- interactive
-else
- noninteractive
-fi
-
-now=$(date)
-info "called on $(hostname) at $now"
-
-
-vserver=$1
-vconf=/etc/vservers/$vserver.conf
-vroot=$vsroot/$vserver
-
-if $rsh; then
- shcmd="rsh"
-fi
-
-if (echo $2 | grep '^[a-z][a-z0-9]\+$'); then
- dhost=""
- newname=$2
- shcmd=""
- rsflag=""
- colon=""
- if $rsh; then
- warn "rsh is set but not used for a local copy"
- fi
-elif (echo $2 | grep '^[a-z].*[a-z0-9]:$'); then
- dhost=${2/:/}
- newname=$vserver
-elif (echo $2 | grep '^[a-z].*[a-z0-9]:[a-z].*[a-z0-9]$'); then
- dhost=${2/:*/}
- newname=${2/*:/}
-else
- error 1 "Second argument must be of the form \"[host:]name\" or \"host:\""
-fi
-
-target=$vsroot/$newname
-targetconf=/etc/vservers/$newname.conf
-
-
-### Perform some sanity checks ###
-
-if [ ! -d $vroot ]; then
- error 1 "Directory \"$vroot\" does not exist"
-fi
-
-if [ ! -e $vconf ]; then
- error 1 "Vserver file \"$vconf\" does not exist"
-fi
-
-if [ -z "$dhost" ] && [ "$vserver" == "$newname" ]; then
- error 1 "Source and destination names cannot be the same on the localhost"
-fi
-
-if [ -n "$dhost" ] && ! (host $dhost | grep 'has address'); then
- warn "$dhost does not resolve into an IP address"
-fi
-
-if [ \( -n "$ip" -a -z "$domain" \) -o \
- \( -z "$ip" -a -n "$domain" \) ]
-then
- error 1 "Both IP address and domain must be specified together"
-fi
-
-if [ -n "$ip" ] && \
-! (echo $ip | grep '^[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}$' ); then
- error 1 "\"$ip\" is not a valid IP address"
-fi
-
-# This works both locally and remote
-if ($shcmd $dhost $SBINDIR/vserver $newname running | grep 'is running'); then
- warn "destination vserver \"$newname\" is running"
- error 1 "Cannot copy over a running vserver"
-fi
-
-
-### Do the copy ###
-
-info "Attempting to copy $vserver to $dhost$colon$newname"
-
-if $stopstart; then
- info "Stopping virtual server \"$vserver\" on localhost"
- $SBINDIR/vserver $vserver stop
-fi
-
-test "$dhost" || {
- mkdir -p -m755 $target
- chattr -t $target
-}
-
-info "Syncing directories"
-# trailing slashes very important in the rsync!
-if ! rsync -avxz $rsflag $shcmd $vroot/ $dhost$colon$target/; then
- error 1 "rsync failed"
-fi
-
-if [ -n "$ip" -a -n "$domain" ]; then
- # Insert the new IPROOT/S_HOSTNAME values into the config file
- info "Modifying $targetconf"
- tmpf=$($mktemp)
- if (sed -e "s/^S_HOSTNAME=.*/S_HOSTNAME=\"$newname\"/" \
- -e "s/^IPROOT=.*/IPROOT=\"$ip\"/" $vconf > $tmpf)
- then
- if ! rsync -v $rsflag $shcmd $tmpf $dhost$colon$targetconf; then
- error $? "vserver config file copy/change failed"
- fi
-
- else
- warn "Unable to reconfigure virtual server config file"
- fi
-
- # create a new /etc/hostname
- info "Creating hostname file"
- echo $newname > $tmpf
- if ! rsync -v $rsflag $shcmd $tmpf $dhost$colon$target/etc/hostname; then
- error 1 "vserver /etc/hostname copy failed"
- fi
-
- info "Creating /etc/hosts"
- cat << EOF > $tmpf
-# /etc/hosts (automatically generated by $me)
-
-127.0.0.1 localhost
-$ip $newname.$domain $newname
-
-# The following lines are desirable for IPv6 capable hosts
-
-::1 ip6-localhost ip6-loopback
-fe00::0 ip6-localnet
-ff00::0 ip6-mcastprefix
-ff02::1 ip6-allnodes
-ff02::2 ip6-allrouters
-ff02::3 ip6-allhosts
-EOF
-
- # copy /etc/hosts
- if ! rsync -v $rsflag $shcmd $tmpf $dhost$colon$target/etc/hosts; then
- error 1 "vserver /etc/hosts copy failed"
- fi
- rm -f $tmpf
-
-else
- if ! $stopstart; then
- # Make sure that this vserver doesn't start on the
- # destination host if it reboots
- tmpf=$($mktemp)
- sed -e 's/^ONBOOT=.*/ONBOOT=no/' $vconf > $tmpf
- vconf=$tmpf
- fi
-
- # copy newname.conf unchanged
- info "Copying $targetconf"
- if ! rsync -v $rsflag $shcmd $vconf $dhost$colon$targetconf; then
- error 1 "vserver config file copy/change failed"
- fi
-
- rm -f $tmpf
-fi
-
-
-if $stopstart; then
- info "Starting virtual server \"$vserver\" on $dhost"
- $shcmd $dhost $SBINDIR/vserver $vserver start
- if ($shcmd $dhost $SBINDIR/vserver $vserver running | \
- grep 'not running'); then
- error 1 "Virtual server \"$vserver\" failed to start on $dhost"
- fi
-
- # Make sure that we don't start the original on next boot
- tmpf=$($mktemp)
- sed -e 's/^ONBOOT=.*/ONBOOT=no/' $vconf > $tmpf
- mv $tmpf $vconf
-fi
-
-exit 0
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on vserverkillall 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 kills all process it can finds
-# Only useful if you are using a security context.
-# It does nothing in context 0
-USR_LIB_VSERVER=$(dirname $0)
-CTX=`grep ^s_context /proc/self/status | sed s/s_context:// | (read a b; echo $a)`
-CTX=`eval expr $CTX + 0`
-if [ "$CTX" = 0 ] ; then
- echo Running in security context 0, do nothing
-else
- cd /proc
- for SIG in -TERM -TERM -TERM -9
- do
- ONE=0
- for dir in *
- do
- case $dir in
- 1)
- ;;
- $$)
- ;;
- [1-9]*)
- ONE=1
- echo kill $SIG "`$USR_LIB_VSERVER/readlink /proc/$dir/exe`"[$dir]
- kill $SIG $dir
- ;;
- *)
- ;;
- esac
- done
- if [ "$ONE" = 0 ] ; then
- break
- fi
- sleep 1
- done
- # Kill the fakeinit process. It is shown as process one, but can't
- # be killed this way
- INITPID=`cat /proc/self/status | grep initpid: | (read a b; expr $b)`
- if [ "$INITPID" != "0" ] ; then
- echo kill init, pid $INITPID
- kill -9 $INITPID
- fi
-fi
-
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-# based on vunify 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 scripts is used to unify the disk space used by vservers
-# It takes various RPM packages and hard link them together so all
-# vservers are sharing the same exact copy of the files.
-# After doing so, it set them immutable, so the vserver can't change them
-
-# This has the following advantages:
-# -You save disk space. If you have 100 vservers, each using 500 megs
-# (common linux server installation), you can unify 90% of that
-# -Memory usage. Since the exact same binary are loaded, including
-# the same shared object, you save some memory and this can increase
-# performance, especially the memory cache usage.
-#
-# On the down side, you are loosing some flexibility. The vserver
-# administrators can't upgrade package as they see fit, since the
-# files are immutable. On the other end, just unifying glibc is probably
-# a win.
-: ${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"
-
-if [ $# = 0 ] ; then
- echo vunify [ --undo ] ref-vserver vservers -- packages
-else
- undo=0
- if [ "$1" == "--undo" ] ; then
- undo=1
- shift
- fi
- ref=$1
- shift
- servers=
- while [ "$1" != "" -a "$1" != "--" ]
- do
- servers="$servers $1"
- shift
- done
- if [ "$servers" = "" ] ; then
- echo No vserver specified >&2
- exit 1
- elif [ "$1" != "--" ] ; then
- echo Missing -- marker >&2
- exit 1
- else
- shift
- if [ $# = 0 ] ; then
- echo No package specified >&2
- exit 1
- else
- if [ ! -d $VROOTDIR/$ref/. ] ; then
- echo No vserver $ref >&2
- exit 1
- else
- #echo ref=$ref
- #echo servers=$servers
- #echo packages=$*
- tmpfile=/var/run/vunifi.$$
- rm -f $tmpfile
- echo Extracting list of file to unify in $tmpfile
- for pkg in $*
- do
- $VROOTDIR/$ref/bin/rpm --root $VROOTDIR/$ref -ql --dump $pkg | \
- while read path size mtime md5 \
- mode owner group isconfig isdoc rdev symlink
- do
- if [ "$isconfig" = 0 ] ; then
- echo $path >>$tmpfile
- fi
- done
- done
- for serv in $servers
- do
- if [ "$undo" = 0 ] ; then
- echo Unifying server $serv
- cat $tmpfile | while read file
- do
- if [ ! -d $VROOTDIR/$ref/$file -a ! -L $VROOTDIR/$ref/$file ] ; then
- ln -f $VROOTDIR/$ref/$file $VROOTDIR/$serv/$file
- fi
- done
- cat $tmpfile | while read file
- do
- chattr +i $VROOTDIR/$ref/$file
- done
- else
- echo Differencing server $serv
- cat $tmpfile | while read file
- do
- chattr -i $VROOTDIR/$ref/$file
- if [ ! -d $VROOTDIR/$ref/$file ] ; then
- rm -f $VROOTDIR/$serv/$file
- cp -a $VROOTDIR/$ref/$file $VROOTDIR/$serv/$file
- fi
- done
- fi
- done
- rm -f $tmpfile
- fi
- fi
- fi
-fi
-
+++ /dev/null
-// $Id: ext2fs.h,v 1.1.2.2 2004/01/26 18:22:00 ensc Exp $ --*- c -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-//
-// 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; version 2 of the License.
-//
-// 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.
-
-
-#ifndef H_UTIL_VSERVER_SRC_EXT2FS_H
-#define H_UTIL_VSERVER_SRC_EXT2FS_H
-
-#ifdef ENSC_HAVE_EXT2FS_EXT2_FS_H
-# include <ext2fs/ext2_fs.h>
-#elif defined(ENSC_HAVE_LINUX_EXT2_FS_H)
-# include <linux/ext2_fs.h>
-#else
-# error Do not know how to include <ext2_fs.h>
-#endif
-
-#endif // H_UTIL_VSERVER_SRC_EXT2FS_H
+++ /dev/null
-// $Id: vbuild.cc,v 1.1.4.1 2004/02/09 22:55:00 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vbuild.cc 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 utility is used to build a new vserver using a reference vserver.
- It uses hard link whenever possible instead of duplicating files.
- Once done, it sets the immutable bits.
-*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
-
-#include <string>
-#include <vector>
-#include <list>
-#include <set>
-#include "vutil.h"
-
-using namespace std;
-
-struct EXCLDIR{
- string prefix;
- int len;
- EXCLDIR(const char *s)
- {
- prefix = s;
- prefix += '/';
- len = prefix.size();
- }
-};
-static vector<EXCLDIR> excldirs;
-
-
-static int ext2flags = EXT2_IMMUTABLE_FILE_FL | EXT2_IMMUTABLE_LINK_FL;
-static struct {
- int nblink;
- int nbcopy;
- long size_copy;
- int nbdir;
- int nbsymlink;
- int nbspc;
-} stats;
-
-
-static void usage()
-{
- cerr <<
- "vbuild version " << VERSION <<
- "\n\n"
- "vbuild [ options ] reference-server new-vservers\n"
- "\n"
- "--test: Show what will be done, do not do it.\n"
- "--debug: Prints some debugging messages.\n"
- "\n"
- "--excldir: None of the files under a given directory will be copied\n"
- "\tThe directory is expressed in absolute/logical form (relative\n"
- "\tto the vserver root (ex: /var/log)\n"
- "\n"
- "\n"
- "--noflags: Do not put any immutable flags on the file\n"
- "--immutable: Set the immutable_file bit on the files.\n"
- "--immutable-mayunlink: Sets the immutable_link flag on files.\n"
- "--stats: Produce statistics on the number of file linked\n"
- " copied and so on.\n"
- "\n"
- "By default, the immutable_file and immutable_link flags are\n"
- "set on the files. So if you want no immutable flags, you must\n"
- "use --noflags. If you want a single flag, you must use\n"
- "--noflags first, then the --immutable or --immutable-mayunlink\n"
- "flag.\n"
- ;
-}
-
-/*
- Return true if a directory lies inside a directory set
-*/
-static bool vbuild_inside (vector<EXCLDIR> &dirs, const char *path)
-{
- bool found = false;
- for (unsigned i=0; i<dirs.size(); i++){
- if (strncmp(dirs[i].prefix.c_str(),path,dirs[i].len)==0){
- found = true;
- break;
- }
- }
- return found;
-}
-
-
-
-static int vbuild_copy (
- string refserv,
- string newserv,
- dev_t dev, // We stay on the same volume
- string logical_dir,
- set<string> &files)
-{
- int ret = -1;
- if (debug > 0) printf ("Copying directory %s\n",logical_dir.c_str());
- DIR *dir = opendir (refserv.c_str());
- if (dir == NULL){
- fprintf (stderr,"Can't open directory %s (%s)\n",refserv.c_str()
- ,strerror(errno));
- }else{
- logical_dir += "/";
- bool copy_files = !vbuild_inside(excldirs,logical_dir.c_str());
- struct dirent *ent;
- ret = 0;
- while (ret == 0 && (ent=readdir(dir))!=NULL){
- if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0){
- continue;
- }
- string file = refserv + "/" + ent->d_name;
- struct stat st;
- if (vutil_lstat(file.c_str(),st) == -1){
- ret = -1;
- }else if (st.st_dev != dev){
- if (debug > 0) printf ("Ignore sub-directory %s\n",file.c_str());
- }else{
- string newfile = newserv + "/" + ent->d_name;
- if (S_ISDIR(st.st_mode)){
- if (vbuild_mkdir (newfile.c_str(),st.st_mode)==-1){
- fprintf (stderr,"Can't mkdir %s (%s)\n"
- ,newfile.c_str(),strerror(errno));
- ret = -1;
- }else{
- stats.nbdir++;
- if (vbuild_chown(newfile.c_str(),st.st_uid,st.st_gid)==-1){
- fprintf (stderr,"Can't chown %s (%s)\n"
- ,newfile.c_str(),strerror(errno));
- ret = -1;
- }
- ret |= vbuild_copy (file,newfile,dev
- ,logical_dir + ent->d_name,files);
- }
- }else if (S_ISLNK(st.st_mode)){
- char path[PATH_MAX];
- int len = readlink(file.c_str(),path,sizeof(path)-1);
- if (len < 0){
- fprintf (stderr,"Can't readlink %s (%s)\n"
- ,file.c_str(),strerror(errno));
- ret = -1;
- }else{
- path[len] = '\0';
- stats.nbsymlink++;
- if (vbuild_symlink (path,newfile.c_str())==-1){
- fprintf (stderr,"Can't symlink %s to %s (%s)\n",
- newfile.c_str(),path,strerror(errno));
- }
- }
- }else if (S_ISBLK(st.st_mode)
- || S_ISCHR(st.st_mode)
- || S_ISFIFO(st.st_mode)){
- stats.nbspc++;
- if (vbuild_mknod (newfile.c_str(),st.st_mode,st.st_rdev)==-1){
- fprintf (stderr,"Can't mknod %s (%s)\n"
- ,newfile.c_str(),strerror(errno));
- ret = -1;
- }
- }else if (S_ISSOCK(st.st_mode)){
- // Do nothing
- }else if (copy_files){
- // Ok, this is a file. We either copy it or do a link
- string logical_file = logical_dir + ent->d_name;
- if (files.find (logical_file)==files.end()){
- if (debug > 1) printf ("Copying file %s\n",file.c_str());
- if (vbuild_file_copy (file.c_str(),newfile.c_str(),st)==-1){
- fprintf (stderr,"Can't copy %s to %s (%s)\n",
- file.c_str(),newfile.c_str(),strerror(errno));
- ret = -1;
- }else{
- stats.size_copy += st.st_size;
- stats.nbcopy++;
- }
- }else{
- if (debug > 2) printf ("Linking file %s\n",file.c_str());
- setext2flag (file.c_str(),false,ext2flags);
- stats.nblink++;
- if (vbuild_link (file.c_str(),newfile.c_str())==-1){
- fprintf (stderr,"Can't link %s to %s (%s)\n",
- file.c_str(),newfile.c_str(),strerror(errno));
- ret = -1;
- }
- setext2flag (file.c_str(),true,ext2flags);
- }
- }
- }
- }
- closedir(dir);
- }
- return ret;
-}
-
-int main (int argc, char *argv[])
-{
- int ret = -1;
- bool statistics = false;
- int i;
- for (i=1; i<argc; i++){
- const char *arg = argv[i];
- //const char *opt = argv[i+1];
- if (strcmp(arg,"--test")==0){
- testmode = true;
- }else if (strcmp(arg,"--debug")==0){
- debug++;
- }else if (strcmp(arg,"--stats")==0){
- statistics = true;
- }else if (strcmp(arg,"--noflags")==0){
- ext2flags = 0;
- }else if (strcmp(arg,"--immutable")==0){
- ext2flags |= EXT2_IMMUTABLE_FILE_FL;
- }else if (strcmp(arg,"--immutable-mayunlink")==0){
- ext2flags |= EXT2_IMMUTABLE_LINK_FL;
- }else if (strcmp(arg,"--excldir")==0){
- i++;
- excldirs.push_back (EXCLDIR(argv[i]));
- }else{
- break;
- }
- }
- if (i!=argc-2){
- usage();
- }else{
- string refserv = argv[i++];
- string newserv = argv[i];
- list<PACKAGE> packages;
- // Load the files which are not configuration files from
- // the packages
- vutil_loadallpkg (refserv,packages);
- set<string> files;
- for (list<PACKAGE>::iterator it=packages.begin(); it!=packages.end(); it++){
- (*it).loadfiles(refserv,files);
- }
- // Now, we do a recursive copy of refserv into newserv
- umask (0);
- mkdir (newserv.c_str(),0755);
- setext2flag(newserv.c_str(), false, 0);
- // Check if it is on the same volume
- struct stat refst,newst;
- if (vutil_lstat(refserv,refst)!=-1
- && vutil_lstat(newserv,newst)!=1){
- if (refst.st_dev != newst.st_dev){
- fprintf (stderr,"Can't vbuild %s because it is not on the same volume as %s\n"
- ,newserv.c_str(),refserv.c_str());
- }else{
- stats.nbdir = stats.nblink = stats.nbcopy = stats.nbsymlink = 0;
- stats.nbspc = 0;
- stats.size_copy = 0;
- ret = vbuild_copy (refserv,newserv,refst.st_dev,"",files);
- if (statistics){
- printf ("Directory created: %d\n",stats.nbdir);
- printf ("Files copied : %d\n",stats.nbcopy);
- printf ("Bytes copied : %ld\n",stats.size_copy);
- printf ("Files linked : %d\n",stats.nblink);
- printf ("Files symlinked : %d\n",stats.nbsymlink);
- printf ("Special files : %d\n",stats.nbspc);
- }
- }
- }
- }
- return ret;
-}
-
-
+++ /dev/null
-// $Id: vcheck.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vcheck.cc 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 utility is used to compare two vservers. One is known to
- be clean and the other is potentially corrupted (cracked). The
- goal of this program is to run the rpm verify command, but using
- the RPM database of the first vserver.
-*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
-
-#include <string>
-#include <vector>
-#include <list>
-#include <set>
-#include "vutil.h"
-
-using namespace std;
-
-
-static void usage()
-{
- cerr <<
- "vcheck version " << VERSION <<
- "\n\n"
- "vcheck [ options ] reference-server chk-vservers\n"
- "\n"
- "--diffpkgs: Shows which package differ.\n"
- " + means the package only exists in chk-server.\n"
- " - means the package does not exist in chk-server.\n"
- " ! means the servers have different version.\n"
- "\n"
- "--verify: Execute an RPM verify on common packages.\n"
- "--debug: Turn on some (useless) debugging messages.\n"
- ;
-}
-
-typedef list<PACKAGE> PACKAGES;
-
-/*
- Delete a directory silently
-*/
-static int vcheck_deldir (const string &path)
-{
- int ret = -1;
- struct stat st;
- if (lstat(path.c_str(),&st)==-1){
- ret = 0;
- }else{
- if (!S_ISDIR(st.st_mode)){
- fprintf (stderr,"%s already exist and is not a directory\n"
- ,path.c_str());
- exit (-1);
- }else{
- DIR *d = opendir (path.c_str());
- if (d != NULL){
- struct dirent *ent;
- ret = 0;
- while ((ent=readdir(d))!=NULL){
- if (strcmp(ent->d_name,".")!=0
- && strcmp(ent->d_name,"..")!=0){
- string tmp = path + "/" + ent->d_name;
- if (unlink(tmp.c_str())==-1){
- fprintf (stderr,"Can't delete file %s (%s)\n",tmp.c_str()
- ,strerror(errno));
- ret = -1;
- break;
- }
- }
- }
- closedir (d);
- rmdir (path.c_str());
- }
- }
- }
- return ret;
-}
-
-
-static int vcheck_copydb (const string &refserv, const string &path)
-{
- int ret = -1;
- string refpath = refserv + "/var/lib/rpm";
- DIR *d = opendir (refpath.c_str());
- if (d == NULL){
- fprintf (stderr,"Can't open directory %s (%s)\n",refpath.c_str()
- ,strerror(errno));
- }else{
- ret = 0;
- struct dirent *ent;
- while ((ent=readdir(d))!=NULL){
- if (strcmp(ent->d_name,".")!=0
- && strcmp(ent->d_name,"..")!=0){
- string srcpath = refpath + "/" + ent->d_name;
- const char *spath = srcpath.c_str();
- struct stat st;
- if (stat(spath,&st)!=-1){
- string dstpath = path + "/" + ent->d_name;
- if (file_copy (spath,dstpath.c_str(),st) == -1){
- ret = -1;
- break;
- }
- }else{
- ret = -1;
- fprintf (stderr,"Can't stat %s (%s)\n",spath,strerror(errno));
- break;
- }
- }
- }
- closedir (d);
- }
- return ret;
-}
-
-class cmp_name{
-public:
- int operator()(const PACKAGE &p1, const PACKAGE &p2){
- return strcmp(p1.name.c_str(),p2.name.c_str());
- }
-};
-
-
-int main (int argc, char *argv[])
-{
- int ret = -1;
- bool diffpkg = false;
- bool verify = false;
- int i;
- for (i=1; i<argc; i++){
- const char *arg = argv[i];
- //const char *opt = argv[i+1];
- if (strcmp(arg,"--diffpkg")==0){
- diffpkg = true;
- }else if (strcmp(arg,"--verify")==0){
- verify = true;
- }else if (strcmp(arg,"--debug")==0){
- debug++;
- }else{
- break;
- }
- }
- if (i!=argc-2){
- usage();
- }else{
- string refserv = argv[i++];
- string chkserv = argv[i];
- PACKAGES refpkgs,chkpkgs;
- // Load the package list from both vservers
- vutil_loadallpkg (refserv,refpkgs);
- vutil_loadallpkg (chkserv,chkpkgs);
- PACKAGES common, differ, added, removed;
- // Find which package are different, missing and added
- // to chkserv
- for (PACKAGES::iterator it=refpkgs.begin(); it!=refpkgs.end(); it++){
- PACKAGES::iterator f = find_if(chkpkgs.begin(),chkpkgs.end(),same_name(*it));
- if (f == chkpkgs.end()){
- removed.push_back (*it);
- }else if (f->version != it->version){
- differ.push_back (*it);
- }else{
- common.push_back (*it);
- }
- }
- for (list<PACKAGE>::iterator it=chkpkgs.begin(); it!=chkpkgs.end(); it++){
- list<PACKAGE>::iterator f = find_if(refpkgs.begin(),refpkgs.end(),same_name(*it));
- if (f == refpkgs.end()){
- added.push_back (*it);
- }
- }
- differ.sort ();
- added.sort();
- removed.sort();
- common.sort ();
- bool something = false;
- if (diffpkg){
- for (PACKAGES::iterator it=removed.begin(); it!=removed.end(); it++){
- printf ("- %s\n",it->name.c_str());
- }
- for (PACKAGES::iterator it=added.begin(); it!=added.end(); it++){
- printf ("+ %s\n",it->name.c_str());
- }
- for (PACKAGES::iterator it=differ.begin(); it!=differ.end(); it++){
- printf ("! %s\n",it->name.c_str());
- }
- something = true;
- }
- if (verify){
- // We copy the rpm database from the reference vserver to
- // the target vserver
- string dbpath = chkserv + "/tmp/vcheck.db";
- vcheck_deldir (dbpath);
- if (mkdir (dbpath.c_str(),0)==-1){
- fprintf (stderr,"Can't create directory %s (%s)\n"
- ,dbpath.c_str(),strerror(errno));
- }else if (vcheck_copydb (refserv,dbpath) != -1){
- // We only compare the common package
- string cmd = "rpm --dbpath /tmp/vcheck.db --root " + chkserv + " -V";
- for (PACKAGES::iterator it=common.begin(); it!=common.end(); it++){
- //printf ("compare %s\n",it->name.c_str());
- cmd += " " + it->name;
- }
- if (debug) printf ("CMD: %s\n",cmd.c_str());
- system (cmd.c_str());
- }
- vcheck_deldir (dbpath);
- something = true;
- }
- if (!something){
- fprintf (stderr,"Nothing to do !!!\n\n");
- usage();
- }
- }
- return ret;
-}
-
-
-
+++ /dev/null
-// $Id: vfiles.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vfiles.cc 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 utility is used to extract the list of non unified files in
- a vserver.
-*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <dirent.h>
-
-#include <string>
-#include <list>
-#include <set>
-#include "vutil.h"
-
-using namespace std;
-
-static bool ignorelink = false;
-
-
-static void usage()
-{
- cerr <<
- "vfiles version " << VERSION <<
- "\n\n"
- "vfiles [ options ] reference-server vserver\n"
- "\n"
- "--debug: Prints some debugging messages.\n"
- "--ignorelink: Do not print symbolic links (they are never unified)\n"
- "\n"
- ;
-}
-
-
-static int vfiles_walk (
- string absdir,
- dev_t dev, // We stay on the same volume
- string logical_dir,
- set<string> &files)
-{
- int ret = -1;
- if (debug > 0) printf ("Entering directory %s\n",logical_dir.c_str());
- DIR *dir = opendir (absdir.c_str());
- if (dir == NULL){
- fprintf (stderr,"Can't open directory %s (%s)\n",absdir.c_str()
- ,strerror(errno));
- }else{
- struct dirent *ent;
- ret = 0;
- while (ret == 0 && (ent=readdir(dir))!=NULL){
- if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0){
- continue;
- }
- string file = absdir + "/" + ent->d_name;
- struct stat st;
- if (vutil_lstat(file,st) == -1){
- ret = -1;
- }else if (st.st_dev != dev){
- if (debug > 0) printf ("Ignore sub-directory %s\n",file.c_str());
- }else{
- if (S_ISDIR(st.st_mode)){
- ret |= vfiles_walk (file,dev
- ,logical_dir + "/" + ent->d_name,files);
- }else if (S_ISLNK(st.st_mode)){
- if (!ignorelink) printf ("%s\n",file.c_str());
- }else if (S_ISBLK(st.st_mode)
- || S_ISCHR(st.st_mode)
- || S_ISFIFO(st.st_mode)){
- printf ("%s\n",file.c_str());
- }else if (S_ISSOCK(st.st_mode)){
- // Do nothing
- }else{
- // Ok, this is a file. We either copy it or do a link
- string logical_file = logical_dir + "/" + ent->d_name;
- if (files.find (logical_file)==files.end()){
- printf ("%s\n",file.c_str());
- }
- }
- }
- }
- closedir(dir);
- }
- return ret;
-}
-
-int main (int argc, char *argv[])
-{
- int ret = -1;
- int i;
- for (i=1; i<argc; i++){
- const char *arg = argv[i];
- //const char *opt = argv[i+1];
- if (strcmp(arg,"--debug")==0){
- debug++;
- }else if (strcmp(arg,"--ignorelink")==0){
- ignorelink=true;
- }else{
- break;
- }
- }
- if (i!=argc-2){
- usage();
- }else{
- string refserv = argv[i++];
- string newserv = argv[i];
- list<PACKAGE> packages;
- // Load the files which are not configuration files from
- // the packages
- vutil_loadallpkg (refserv,packages);
- set<string> files;
- for (list<PACKAGE>::iterator it=packages.begin(); it!=packages.end(); it++){
- (*it).loadfiles(refserv,files);
- }
- struct stat st;
- if (vutil_lstat(newserv,st)!=-1){
- // Now, we do a recursive walk of newserv and prints
- // all files not unifiable
- ret = vfiles_walk (newserv,st.st_dev,"",files);
- }
- }
- return ret;
-}
-
-
-
+++ /dev/null
-// $Id: vunify.cc,v 1.1.4.1 2003/10/30 15:16:30 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vunify.cc 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 utility is used to unify (using hard links) two or more
- virtual servers.
- It compares the each vserver with the first one and for every
- common package (RPM, same version), it does a hard link on non
- configuration file. It turns the file immutable after that.
-*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <string>
-#include <vector>
-#include <list>
-#include <algorithm>
-#include <iostream>
-#include "vutil.h"
-
-using namespace std;
-
-static bool undo = false;
-
-static int ext2flags = EXT2_IMMUTABLE_FILE_FL | EXT2_IMMUTABLE_LINK_FL;
-struct EXCLDIR{
- string prefix;
- int len;
- EXCLDIR(const char *s)
- {
- prefix = s;
- prefix += '/';
- len = prefix.size();
- }
-};
-static vector<EXCLDIR> excldirs;
-static vector<EXCLDIR> incldirs;
-
-
-static void usage()
-{
- cerr <<
- "vunify version " << VERSION <<
- "\n\n"
- "vunify [ options ] reference-server vservers ... -- packages\n"
- "vunify [ options ] reference-server vservers ... -- ALL\n"
- "\n"
- "--test: Show what will be done, do not do it.\n"
- "--undo: Put back the file in place, using copies from the\n"
- " reference server.\n"
- "--debug: Prints some debugging messages.\n"
- "--noflags: Do not put any immutable flags on the file\n"
- "--immutable: Set the immutable_file bit on the files.\n"
- "--immutable-mayunlink: Sets the immutable_link flag on files.\n"
- "\n"
- "--excldir: None of the files under a given directory will be unified\n"
- "\tThe directory is expressed in absolute/logical form (relative\n"
- "\tto the vserver root (ex: /var/log)\n"
- "\n"
- "--incldir: All the files under a given directory will be unified\n"
- "\tThe directory is expressed in absolute/logical form (relative\n"
- "\tto the vserver root (ex: /var/log)\n"
- "\n"
- "By default, the immutable_file and immutable_link flags are\n"
- "set on the files. So if you want no immutable flags, you must\n"
- "use --noflags. If you want a single flag, you must use\n"
- "--noflags first, then the --immutable or --immutable-mayunlink\n"
- "flag.\n"
- ;
-}
-
-static bool vunify_inside (vector<EXCLDIR> &dirs, const char *path)
-{
- bool found = false;
- for (unsigned i=0; i<dirs.size(); i++){
- if (strncmp(dirs[i].prefix.c_str(),path,dirs[i].len)==0){
- found = true;
- break;
- }
- }
- return found;
-}
-
-class PACKAGE_UNI: public PACKAGE{
-public:
- list<string> files; // Files to unify
- // This is loaded on demand
- PACKAGE_UNI(string &_name, string &_version)
- : PACKAGE(_name,_version)
- {
- }
- PACKAGE_UNI(const char *_name, const char *_version)
- : PACKAGE (_name,_version)
- {
- }
- PACKAGE_UNI(const string &line)
- : PACKAGE (line)
- {
- }
- // Load the file member of the package, but exclude configuration file
- void loadfiles(const string &ref)
- {
- if (files.empty()){
- if (debug) cout << "Loading files for package " << name << endl;
- string namever;
- namever = name + '-' + version;
- FILE *fin = vutil_execdistcmd (K_UNIFILES,ref,namever.c_str());
- if (fin != NULL){
- char tmp[1000];
- while (fgets(tmp,sizeof(tmp)-1,fin)!=NULL){
- int last = strlen(tmp)-1;
- if (last >= 0 && tmp[last] == '\n') tmp[last] = '\0';
- bool must_unify = false;
- int type = 0; // K_UNIFILES only report unify-able files
- if(type == 0 && !vunify_inside(excldirs,tmp)){
- must_unify = true;
- }else if(vunify_inside(incldirs,tmp)){
- must_unify = true;
- }
- if (must_unify){
- files.push_front (tmp);
- }else if (debug){
- cout << "Package " << name << " exclude " << tmp << endl;
- }
- }
- }
- if (debug) cout << "Done\n";
- }
- }
-};
-
-
-static ostream & operator << (ostream &c, const PACKAGE_UNI &p)
-{
- return c << p.name << "-" << p.version;
-}
-
-template<class T>
- void printit(T a){
- cout << "xx " << a << endl;
- }
-
-template<class T>
- class printer{
- string title;
- public:
- printer (const char *_title): title(_title){}
- void operator()(T a){
- cout << title << " " << a << endl;
- }
- };
-
-
-/*
- Load the list of all packages in a vserver
-*/
-static void vunify_loadallpkg (string &refserver, list<PACKAGE_UNI> &packages)
-{
- FILE *fin = vutil_execdistcmd (K_PKGVERSION,refserver,NULL);
- if (fin != NULL){
- char line[1000];
- while (fgets(line,sizeof(line)-1,fin)!=NULL){
- // fprintf (stderr,"line: %s",line);
- int last = strlen(line)-1;
- if (last >= 0 && line[last] == '\n') line[last] = '\0';
- packages.push_back (PACKAGE_UNI(line));
- }
- pclose (fin);
- }
-}
-
-/*
- Object to unify a file
- The file is first removed, then a hard link is made and then
- the immutable flag is done
-*/
-class file_unifier{
- string &ref_server,&target_server;
- int &ret;
- public:
- file_unifier(string &_ref, string &_target, int &_ret)
- : ref_server(_ref),target_server(_target), ret(_ret)
- {}
- void operator()(const string &file)
- {
- string refpath = VROOTDIR "/" + ref_server + file;
- string dstpath = VROOTDIR "/" + target_server + file;
- if (debug) cout << "Unify " << refpath << " -> " << dstpath << endl;
- struct stat st;
- if (stat(refpath.c_str(),&st)==-1){
- if (debug) cout << "File " << refpath << " does not exist, ignored\n";
- }else if (setext2flag(refpath.c_str(),false,ext2flags)==-1){
- ret = -1;
- }else if (vbuild_unlink(dstpath.c_str())==-1){
- ret = -1;
- cerr << "Can't delete file " << dstpath
- << " (" << strerror(errno) << ")\n";
- }else{
- if (undo){
- if (vbuild_file_copy(refpath.c_str(),dstpath.c_str(),st)==-1){
- ret = -1;
- cerr << "Can't copy file " << refpath << " to " << dstpath
- << " (" << strerror(errno) << ")\n";
- }
- }else{
- if (vbuild_link(refpath.c_str(),dstpath.c_str())==-1){
- ret = -1;
- cerr << "Can't link file " << refpath << " to " << dstpath
- << " (" << strerror(errno) << ")\n";
- }
- }
- // We put back the original immutable because other vservers
- // may be unified on it.
- if (setext2flag(refpath.c_str(),true,ext2flags)==-1){
- ret = -1;
- }
- }
- }
-};
-#if 0
-// Check if two package have the same name (but potentially different version)
-class same_name{
- PACKAGE_UNI &pkg;
-public:
- same_name(PACKAGE_UNI &_pkg) : pkg(_pkg) {}
- bool operator()(const PACKAGE_UNI &p)
- {
- return pkg.name == p.name;
- }
-};
-#endif
-// Predicate to decide if a package must be unified
-class package_unifier{
-public:
- string &ref_server,&target_server;
- list<PACKAGE_UNI> &target_packages;
- int &ret;
- package_unifier(string &_ref,
- string &_target,
- list<PACKAGE_UNI> &_target_packages,
- int &_ret)
- : ref_server(_ref),target_server(_target)
- , target_packages(_target_packages) , ret(_ret)
- {}
- void operator()(PACKAGE_UNI &pkg)
- {
- if (find(target_packages.begin(),target_packages.end(),pkg)
- !=target_packages.end()){
- // Ok, the package is also in the target vserver
- cout << "Unify pkg " << pkg << " from " << ref_server << " to "
- << target_server << endl;
-
- if (!testmode || debug){
- pkg.loadfiles(ref_server);
- for_each (pkg.files.begin(),pkg.files.end()
- ,file_unifier(ref_server,target_server,ret));
- }
- }else if (testmode){
- // The package is missing, in test mode we provide more information
- if (find_if(target_packages.begin(),target_packages.end(),same_name(pkg))
- !=target_packages.end()){
- cout << pkg << " exist in server " << target_server << " not unified\n";
- }else{
- cout << pkg << " does not exist in server " << target_server << endl;
- }
- }
- }
-};
-
-// For each vserver, find the common packages and unify them
-class server_unifier{
-public:
- list<PACKAGE_UNI> &ref_packages;
- string &ref_server;
- int &ret;
- server_unifier(string _ref_server, list<PACKAGE_UNI> &_packages, int &_ret)
- : ref_packages(_packages),ref_server(_ref_server), ret(_ret)
- {}
- void operator()(string serv)
- {
- list<PACKAGE_UNI> pkgs;
- vunify_loadallpkg (serv,pkgs);
- for_each(ref_packages.begin(),ref_packages.end()
- ,package_unifier(ref_server,serv,pkgs,ret));
- }
-};
-class deleteif{
-public:
- char **argv0,**argvn;
- deleteif(char **_argv0, char **_argvn): argv0(_argv0),argvn(_argvn){}
- bool operator()(const PACKAGE_UNI &pkg)
- {
- bool found = false;
- for (char **pt = argv0; pt < argvn; pt++){
- if (pkg.name == *pt){
- found = true;
- break;
- }
- }
- return !found;
- }
-};
-
-int main (int argc, char *argv[])
-{
- int ret = -1;
- int i;
- for (i=1; i<argc; i++){
- const char *arg = argv[i];
- //const char *opt = argv[i+1];
- if (strcmp(arg,"--test")==0){
- testmode = true;
- }else if (strcmp(arg,"--undo")==0){
- undo = true;
- }else if (strcmp(arg,"--debug")==0){
- debug++;
- }else if (strcmp(arg,"--noflags")==0){
- ext2flags = 0;
- }else if (strcmp(arg,"--immutable")==0){
- ext2flags |= EXT2_IMMUTABLE_FILE_FL;
- }else if (strcmp(arg,"--immutable-mayunlink")==0){
- ext2flags |= EXT2_IMMUTABLE_LINK_FL;
- }else if (strcmp(arg,"--excldir")==0){
- i++;
- //excldirs[excldirs.size()] = EXCLDIR(argv[i]);
- excldirs.push_back (EXCLDIR(argv[i]));
- }else if (strcmp(arg,"--incldir")==0){
- i++;
- incldirs.push_back (EXCLDIR(argv[i]));
- }else{
- break;
- }
- }
- if (i==argc){
- usage();
- }else{
- string refserv = argv[i++];
- list<string> vservers;
- for (; i<argc && strcmp(argv[i],"--")!=0; i++){
- vservers.push_front (argv[i]);
- }
- for_each (vservers.begin(),vservers.end(),printer<string>("vservers"));
- if (i == argc || strcmp(argv[i],"--")!=0){
- usage();
- }else{
- i++;
- if (i < argc){
- list<PACKAGE_UNI> packages;
- vunify_loadallpkg (refserv,packages);
- if (i != argc-1 || strcmp(argv[i],"ALL")!=0){
- // We keep only the packages supplied on the command line
- packages.remove_if(deleteif (argv+i,argv+argc));
- }
- ret = 0;
- umask (0);
- for_each (vservers.begin(),vservers.end(),server_unifier(refserv,packages,ret));
- }else{
- usage();
- }
- }
- }
- return ret;
-}
-
-
-
-
+++ /dev/null
-// $Id: vutil.cc,v 1.1.4.2 2003/11/18 22:30:44 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.cc 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.
-
-#pragma implementation
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include "compat.h"
-
-#undef PACKAGE
-
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <utime.h>
-#include "vutil.h"
-#include <sys/ioctl.h>
-
-#include "ext2fs.h"
-
-
-bool testmode;
-int debug;
-
-int file_copy (const char *src, const char *dst, struct stat &st)
-{
- int ret = -1;
- FILE *fin = fopen (src,"r");
- if (fin == NULL){
- fprintf (stderr,"Can't open file %s (%s)\n",src,strerror(errno));
- }else{
- FILE *fout = fopen (dst,"w");
- if (fout == NULL){
- fprintf (stderr,"Can't open file %s (%s)\n",dst,strerror(errno));
- }else{
- char buf[8192];
- int len;
- while ((len=fread(buf,1,sizeof(buf),fin))>0){
- fwrite (buf,1,len,fout);
- }
- fflush (fout);
- ret = 0;
- if (fchown (fileno(fout),st.st_uid,st.st_gid)==-1){
- fprintf (stderr,"Can't chown file %s (%s)\n"
- ,dst,strerror(errno));
- ret = -1;
- }else if (fchmod (fileno(fout),st.st_mode)==-1){
- fprintf (stderr,"Can't chmod file %s (%s)\n"
- ,dst,strerror(errno));
- ret = -1;
- }
- fclose(fout);
- struct utimbuf timbuf;
- timbuf.modtime = st.st_mtime;
- timbuf.actime = st.st_atime;
- if (utime (dst,&timbuf)==-1){
- fprintf (stderr,"Can't set time stamp on file %s (%s)\n"
- ,dst,strerror(errno));
- }
- }
- fclose (fin);
- }
- return ret;
-}
-
-/*
- Set the immutable flag on a file
-*/
-int setext2flag (const char *fname, bool set, int ext2flags)
-{
- int ret = -1;
- if (testmode){
- ret = 0;
- }else{
- int fd = open (fname,O_RDONLY);
- if (fd == -1){
- fprintf (stderr,"Can't open file %s (%s)\n",fname
- ,strerror(errno));
- }else{
- int flags = set ? ext2flags : 0;
- ret = ioctl (fd,EXT2_IOC_SETFLAGS,&flags);
- close (fd);
- if (ret == -1){
- fprintf (stderr,"Can't %s immutable flag on file %s (%s)\n"
- ,(set ? "set" : "unset")
- ,fname
- ,strerror(errno));
- }
- }
- }
- return ret;
-}
-
-int vbuild_mkdir (const char *path, mode_t mode)
-{
- int ret = -1;
- if (testmode){
- printf ("mkdir %s; chmod %o %s\n",path,mode,path);
- ret = 0;
- }else{
- ret = mkdir (path,mode);
- if (ret == -1 && errno == EEXIST){
- struct stat st;
- if (lstat(path,&st)!=-1 && S_ISDIR(st.st_mode)){
- ret = chmod (path,mode);
- }
- }
- }
- return ret;
-}
-
-int vbuild_mknod(const char *path, mode_t mode, dev_t dev)
-{
- int ret = -1;
- if (testmode){
- printf ("mknod %s %o %02x:%02x\n",path,mode,major(dev),minor(dev));
- ret = 0;
- }else{
- ret = mknod (path,mode,dev);
- if (ret == -1 && errno == EEXIST){
- struct stat st;
- lstat(path,&st);
- if (lstat(path,&st)!=-1
- && (st.st_mode & S_IFMT) == (mode & S_IFMT)
- && st.st_rdev == dev){
- ret = chmod (path,mode);
- }
- }
- }
- return ret;
-}
-int vbuild_symlink(const char *src, const char *dst)
-{
- int ret = -1;
- if (testmode){
- printf ("ln -s %s %s\n",src,dst);
- ret = 0;
- }else{
- ret = symlink (src,dst);
- }
- return ret;
-}
-
-int vbuild_link(const char *src, const char *dst)
-{
- int ret = -1;
- if (testmode){
- printf ("ln %s %s\n",src,dst);
- ret = 0;
- }else{
- ret = link (src,dst);
- }
- return ret;
-}
-
-int vbuild_unlink(const char *path)
-{
- int ret = -1;
- if (testmode){
- printf ("unlink %s\n",path);
- ret = 0;
- }else{
- ret = unlink (path);
- }
- return ret;
-}
-
-int vbuild_chown(const char *path, uid_t uid, gid_t gid)
-{
- int ret = -1;
- if (testmode){
- printf ("chown %d.%d %s\n",uid,gid,path);
- ret = 0;
- }else{
- ret = chown (path,uid,gid);
- }
- return ret;
-}
-
-int vbuild_file_copy(
- const char *src,
- const char *dst,
- struct stat &st)
-{
- int ret = -1;
- if (testmode){
- printf ("cp -a %s %s\n",src,dst);
- ret = 0;
- }else{
- ret = file_copy (src,dst,st);
- }
- return ret;
-}
-
-/*
- Load the list of all packages in a vserver
-*/
-void vutil_loadallpkg (string &refserver, list<PACKAGE> &packages)
-{
- FILE *fin = vutil_execdistcmd (K_PKGVERSION,refserver,NULL);
- if (fin != NULL){
- char line[1000];
- while (fgets(line,sizeof(line)-1,fin)!=NULL){
- int last = strlen(line)-1;
- if (last >= 0 && line[last] == '\n') line[last] = '\0';
- packages.push_back (PACKAGE(line));
- }
- pclose (fin);
- }
-}
-
-int vutil_lstat (string path, struct stat &st)
-{
- int ret = 0;
- if (lstat(path.c_str(),&st) == -1){
- fprintf (stderr,"Can't lstat file %s (%s)\n"
- ,path.c_str(),strerror(errno));
- ret = -1;
- }
- return ret;
-}
-
-const char K_PKGVERSION[]="pkgversion";
-const char K_DUMPFILES[]="dumpfiles";
-const char K_UNIFILES[]="unifiles";
-
-FILE *vutil_execdistcmd (const char *key, const string &vserver, const char *args)
-{
- string cmd = PKGLIBDIR "/distrib-info ";
- cmd += vserver;
- cmd += " ";
- cmd += key;
- if (args != NULL){
- cmd += " ";
- cmd += args;
- }
- FILE *ret = popen (cmd.c_str(),"r");
- if (ret == NULL){
- fprintf (stderr,"Can't execute command %s\n",cmd.c_str());
- }else{
- #if 0
- char buf[1000];
- while (fgets(buf,sizeof(buf)-1,fin)!=NULL){
- int last = strlen(buf)-1;
- if (last >= 0) buf[last] = '\0';
- ret = buf;
- break;
- }
- pclose (fin);
- #endif
- }
- return ret;
-}
-
+++ /dev/null
-// $Id: vutil.h,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.h 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.
-
-#pragma interface
-#ifndef VUTIL_H
-#define VUTIL_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <string>
-#include <set>
-#include <algorithm>
-#include <iostream>
-#include <list>
-
-using namespace std;
-
-extern int debug;
-extern bool testmode;
-
-// Patch to help compile this utility on unpatched kernel source
-#ifndef EXT2_IMMUTABLE_FILE_FL
- #define EXT2_IMMUTABLE_FILE_FL 0x00000010
- #define EXT2_IMMUTABLE_LINK_FL 0x00008000
-#endif
-
-
-FILE *vutil_execdistcmd (const char *, const string &, const char *);
-extern const char K_DUMPFILES[];
-extern const char K_UNIFILES[];
-extern const char K_PKGVERSION[];
-
-class PACKAGE{
-public:
- string name;
- string version; // version + release
- PACKAGE(string &_name, string &_version)
- : name (_name), version(_version)
- {
- }
- PACKAGE(const char *_name, const char *_version)
- : name (_name), version(_version)
- {
- }
- PACKAGE(const string &line)
- {
- *this = line;
- }
- PACKAGE & operator = (const string &_line)
- {
- string line (_line);
- string::iterator pos = find (line.begin(),line.end(),'=');
- if (pos != line.end()){
- name = string(line.begin(),pos);
- version = string(pos + 1,line.end());
- }
- return *this;
- }
- PACKAGE (const PACKAGE &pkg)
- {
- name = pkg.name;
- version = pkg.version;
- }
- bool operator == (const PACKAGE &v) const
- {
- return name == v.name && version == v.version;
- }
- bool operator < (const PACKAGE &v) const
- {
- bool ret = false;
- if (name < v.name){
- ret = true;
- }else if (name == v.name && version < v.version){
- ret = true;
- }
- return ret;
- }
- // Load the file member of the package, but exclude configuration file
- void loadfiles(const string &ref, set<string> &files)
- {
- if (debug > 2) cout << "Loading files for package " << name << endl;
- string namever = name + '-' + version;
- FILE *fin = vutil_execdistcmd (K_UNIFILES,ref,namever.c_str());
- if (fin != NULL){
- char tmp[1000];
- while (fgets(tmp,sizeof(tmp)-1,fin)!=NULL){
- int last = strlen(tmp)-1;
- if (last >= 0 && tmp[last] == '\n') tmp[last] = '\0';
- files.insert (tmp);
- }
- }
- if (debug > 2) cout << "Done\n";
- }
- #if 0
- bool locate(const string &path)
- {
- return find (files.begin(),files.end(),path) != files.end();
- }
- #endif
-};
-
-// Check if two package have the same name (but potentially different version)
-class same_name{
- const PACKAGE &pkg;
-public:
- same_name(const PACKAGE &_pkg) : pkg(_pkg) {}
- bool operator()(const PACKAGE &p)
- {
- return pkg.name == p.name;
- }
-};
-
-
-#include "vutil.p"
-
-#endif
-
+++ /dev/null
-// $Id: vutil.p,v 1.1 2003/09/29 22:01:57 ensc Exp $ --*- c++ -*--
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on vutil.p 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.
-
-
-/* vutil.cc 11/04/2003 14.22.04 */
-int file_copy (const char *src, const char *dst, struct stat&st);
-int setext2flag (const char *fname, bool set, int ext2flags);
-int vbuild_mkdir (const char *path, mode_t mode);
-int vbuild_mknod (const char *path, mode_t mode, dev_t dev);
-int vbuild_symlink (const char *src, const char *dst);
-int vbuild_link (const char *src, const char *dst);
-int vbuild_unlink (const char *path);
-int vbuild_chown (const char *path, uid_t uid, gid_t gid);
-int vbuild_file_copy (const char *src,
- const char *dst,
- struct stat&st);
-void vutil_loadallpkg (string&refserver, list<PACKAGE>&packages);
-int vutil_lstat (string path, struct stat&st);
-FILE *vutil_execdistcmd (const char *key,
- const string&vserver,
- const char *args);
-/* syscall.cc 18/07/2003 09.50.10 */
-extern "C" int call_new_s_context (int nbctx,
- int ctxs[],
- int remove_cap,
- int flags);
-extern "C" int call_set_ipv4root (unsigned long ip[],
- int nb,
- unsigned long bcast,
- unsigned long mask[]);
-extern "C" int call_chrootsafe (const char *dir);
-extern "C" int has_chrootsafe (void);
-extern "C" int call_set_ctxlimit (int res, long limit);
+++ /dev/null
-#!/bin/sh
-# chkconfig: - 98 10
-# description: The rebootmgr service is monitoring all virtual servers \
-# and restart them as need. Virtual servers are using \
-# the /sbin/vreboot command to talk with the reboot manager
-# processname: rebootmgr
-# config: /etc/vservers
-
-VROOTDIR=/vservers
-USR_SBIN=/usr/sbin
-PIDFILE=/var/run/rebootmgr.pid
-# See how we were called.
-case "$1" in
- start)
- echo "Starting the reboot manager"
- cd /etc/vservers
- VSERVERS=
- for serv in *.conf
- do
- test -f "$serv" || continue
-
- serv=`basename $serv .conf`
- if [ -d $VROOTDIR/$serv ] ; then
- VSERVERS="$VSERVERS $serv"
- fi
- done
- $USR_SBIN/rebootmgr --pidfile $PIDFILE $VSERVERS &
- touch /var/lock/subsys/rebootmgr
- ;;
- stop)
- echo "Stopping the reboot manager"
- kill `cat $PIDFILE`
- rm -f /var/lock/subsys/rebootmgr
- rm -f $PIDFILE
- ;;
- restart|force-reload)
- $0 stop
- $0 start
- ;;
- reload)
- echo Not implemented
- ;;
- status)
- if [ -f $PIDFILE ] ; then
- if kill -0 `cat $PIDFILE`
- then
- echo rebootmgr is running
- else
- echo rebootmgr is NOT running
- fi
- fi
- ;;
- *)
- echo "Usage: rebootmgr {start|stop|restart|reload|status}"
- exit 1
-esac
-
-exit 0
-
-
-
-
-
+++ /dev/null
-#!/bin/sh
-# chkconfig: 345 98 10
-# description: The vservers service is used to start and stop all
-# the virtual servers.
-
-USR_SBIN=/usr/sbin
-
-
-# Print the vserver name in priority/alpha order
-sortserver(){
- (
- cd /etc/vservers
- for serv in *.conf
- do
- test -f "$serv" || continue
-
- PRIORITY=100
- . $serv
- printf "%03d %s\n" $PRIORITY `basename $serv .conf`
- done
- ) | sort $* | (while read a b; do echo $b; done)
-}
-
-startservers(){
- echo "Starting the virtual servers"
- cd /etc/vservers
- for name in `sortserver`
- do
- ONBOOT=
- . $name.conf
- if [ "$ONBOOT" = "yes" ] ; then
- $USR_SBIN/vserver $name start
- else
- echo virtual server $name not configured for on boot start
- fi
- done
-}
-
-BACKGROUND=off
-if [ -f /etc/vservers.conf ] ; then
- . /etc/vservers.conf
-fi
-
-
-# See how we were called.
-case "$1" in
- start)
- if [ "$BACKGROUND" = "yes" ] ; then
- startservers >/dev/tty8 </dev/tty8 2>/dev/tty8 &
- else
- startservers
- fi
- touch /var/lock/subsys/vservers
- ;;
- stop)
- echo "Stopping the virtual servers"
- cd /etc/vservers
- for name in `sortserver -r`
- do
- $USR_SBIN/vserver $name stop
- done
- rm -f /var/lock/subsys/vservers
- ;;
- restart|force-reload)
- $0 stop
- $0 start
- ;;
- reload)
- echo Not implemented
- ;;
- status)
- cd /etc/vservers
- for serv in *.conf
- do
- ONBOOT=no
- name=`basename $serv .conf`
- . $serv
- echo -n ONBOOT=$ONBOOT " "
- $USR_SBIN/vserver $name running
- done
- ;;
- *)
- echo "Usage: vservers {start|stop|restart|reload|status}"
- exit 1
-esac
-
-exit 0
-
-
-
-
+++ /dev/null
-// $Id: escaperoot.cc,v 1.1.4.1 2003/10/30 15:12:34 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on tests/escaperoot.cc 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 program tries to escape out of a vserver using chroot flaws.
- Once escaped, it exec a shell.
-
- None of this works on 2.4.13.
-*/
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <wait.h>
-#include <limits.h>
-
-static void print_pwd()
-{
- char path[PATH_MAX];
- if (getcwd(path,sizeof(path)-1)!=NULL){
- printf ("PWD: %s\n",path);
- }
-}
-/*
- Just set a chroot in a sub-directory and keep the
- current directory behind
-*/
-static void test1()
-{
- printf ("test1\n");
- print_pwd();
- mkdir ("dummy_dir",0755);
- if (chroot ("dummy_dir")==-1){
- fprintf (stderr,"Can't chroot into dummy_dir (%s)\n",strerror(errno));
- }else{
- // Try to chdir into the real root
- for (int i=0; i<1000; i++) chdir("..");
- print_pwd();
- if (execl ("/bin/sh","/bin/sh",NULL)==-1){
- fprintf (stderr,"execl /bin/sh failed (%s)\n",strerror(errno));
- }
- }
-}
-
-/*
- Same as test1, except we open the current directory and do
- a fchdir() to it before trying to escape to the real root.
-*/
-static void test2()
-{
- printf ("test2\n");
- print_pwd();
- mkdir ("dummy_dir",0755);
- int fd = open (".",O_RDONLY);
- if (fd == -1){
- fprintf (stderr,"Can't open current directory (%s)\n",strerror(errno));
- }else if (chroot ("dummy_dir")==-1){
- fprintf (stderr,"Can't chroot into dummy_dir (%s)\n",strerror(errno));
- }else if (fchdir(fd)==-1){
- fprintf (stderr,"Can't fchdir to the current directory (%s)\n"
- ,strerror(errno));
- }else{
- // Try to chdir into the real root
- for (int i=0; i<1000; i++) chdir("..");
- print_pwd();
- if (execl ("/bin/sh","/bin/sh",NULL)==-1){
- fprintf (stderr,"execl /bin/sh failed (%s)\n",strerror(errno));
- }
- }
-}
-
-/*
- Perform the test in a sub-process so it won't affect the current one
-*/
-static void dotest (void (*f)())
-{
- pid_t pid = fork();
- if (pid == 0){
- f();
- _exit (0);
- }else if (pid == -1){
- fprintf (stderr,"Can't fork (%s)\n",strerror(errno));
- }else{
- int status;
- wait (&status);
- }
-}
-
-int main (int, char *[])
-{
- dotest (test1);
- dotest (test2);
- printf ("All attempts failed\n");
- return 0;
-}
-
-
+++ /dev/null
-// $Id: forkbomb.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on tests/forkbomb.cc 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.
-
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <stdio.h>
-
-enum MODE {MODE_SLEEP,MODE_LOOP,MODE_FORK, MODE_FORKSHELL};
-
-
-static void forkbomb_userfork (MODE mode)
-{
- pid_t pid = fork();
- if (pid==-1){
- fprintf (stderr,"Fork failed (%s)\n",strerror(errno));
- }else if (pid == 0){
- if (mode == MODE_SLEEP){
- sleep(20);
- }else if (mode == MODE_LOOP){
- int k=0;
- while (1) k++;
- }else if (mode == MODE_FORKSHELL){
- system ("/bin/false");
- }
- _exit (0);
- }
-}
-
-
-int main (int argc, char *argv[])
-{
- if (argc != 4){
- fprintf (stderr,"formboom N M mode\n"
- "where N is the number of process to start\n"
- "and M is the number of user to start\n"
- "Each user will try to start N process\n"
- "\n"
- "mode is:\n"
- " sleep: Each process sleeps for 20 seconds and exits\n"
- " loop: Each process loops forever\n"
- " fork: Each process exits immediatly and is restarted\n"
- " by the parent\n"
- " forkshell: Each process runs /bin/false in a shell and\n"
- " exits, then the parent start a new one\n"
- );
- }else{
- MODE mode;
- if (strcmp(argv[3],"sleep")==0){
- mode = MODE_SLEEP;
- }else if (strcmp(argv[3],"loop")==0){
- mode = MODE_LOOP;
- }else if (strcmp(argv[3],"fork")==0){
- mode = MODE_FORK;
- }else if (strcmp(argv[3],"forkshell")==0){
- mode = MODE_FORKSHELL;
- }else{
- fprintf (stderr,"Invalid mode\n");
- exit (-1);
- }
- for (int i=0; i<atoi(argv[2]); i++){
- if (fork()==0){
- if (setuid (i+1)==-1){
- fprintf (stderr,"Can't setuid to uid %d (%s)\n",i+1
- ,strerror(errno));
- }else{
- for (int j=0; j<atoi(argv[1]); j++){
- forkbomb_userfork (mode);
- }
- if (mode == MODE_FORK || mode == MODE_FORKSHELL){
- // Ok, all processes are started, in MODE_FORK
- // we create a new one all the time
- int status;
- while (wait(&status)!=-1) forkbomb_userfork(mode);
- }
- }
- _exit (0);
- }
- }
- system ("ps ax | wc -l");
- printf ("All the process are running now\n");
- printf ("Exit to end all processes\n");
- system ("/bin/sh");
- system ("killall forkbomb");
- }
- return 0;
-}
-
+++ /dev/null
-// $Id: testipc.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on tests/testipc.cc 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.
-
-/*
- Test to see isolation of the various IPC resources
- between security context
-*/
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-
-int main (int argc, char *argv[])
-{
- int ret = -1;
- if (argc < 2){
- fprintf (stderr,
- "testipc createshm\n"
- );
- }else if(strcmp(argv[1],"createshm")==0){
- int id = shmget (1,1024,IPC_CREAT|0666);
- if (id == -1){
- fprintf (stderr,"shmget failed (%s)\n",strerror(errno));
- }else{
- printf ("shmget id %d\n",id);
- void *pt = shmat (id,NULL,0);
- if (pt == NULL){
- fprintf (stderr,"can't shmat to id %d (%s)\n",id,strerror(errno));
- }else{
- strcpy ((char*)pt,"original string");
-
- printf ("Letting a sub-program attach to this memory\n");
- char tmp[100];
- sprintf (tmp,"./testipc accessshm %d",id);
- int ok = system (tmp);
- printf ("\tSub-program returned %d\n",ok);
-
- printf ("\tThe segment now hold :%s:\n",(char*)pt);
- shmdt (pt);
-
- printf ("A sub-program in another context can't attach\n");
- sprintf (tmp,"/usr/sbin/chcontext ./testipc accessshm %d",id);
- ok = system (tmp);
- printf ("\tSub-program returned %d\n",ok);
-
- printf ("Executing a sub-shell\n");
- system ("/bin/sh");
- }
- printf ("Delete the share memory segment\n");
- if (shmctl (id,IPC_RMID,NULL)==-1){
- fprintf (stderr,"shmctl failed (%s)\n",strerror(errno));
- }else{
- ret = 0;
- }
- }
- }else if(strcmp(argv[1],"accessshm")==0){
- int id = atoi(argv[2]);
- void *pt = shmat (id,NULL,0);
- if (pt == (void*)-1){
- fprintf (stderr,"can't shmat to id %d (%s)\n",id,strerror(errno));
- }else{
- printf ("\tWriting hello in share memory\n");
- strcpy ((char*)pt,"hello");
- ret = 0;
- }
- }else if(strcmp(argv[1],"createsem")==0){
- int id = semget (1,1,IPC_CREAT|0666);
- if (id == -1){
- fprintf (stderr,"semget failed (%s)\n",strerror(errno));
- }else{
- printf ("semget id %d\n",id);
-
- printf ("Letting a sub-program play with this semaphore\n");
- char tmp[100];
- sprintf (tmp,"./testipc accesssem %d",id);
- int ok = system (tmp);
- printf ("\tSub-program returned %d\n",ok);
-
- printf ("A sub-program in another context can't use the semaphore\n");
- sprintf (tmp,"/usr/sbin/chcontext ./testipc accesssem %d",id);
- ok = system (tmp);
- printf ("\tSub-program returned %d\n",ok);
-
- printf ("Executing a sub-shell\n");
- system ("/bin/sh");
-
- printf ("Delete the semaphore\n");
- if (semctl (id,0,IPC_RMID,NULL)==-1){
- fprintf (stderr,"semctl failed (%s)\n",strerror(errno));
- }else{
- ret = 0;
- }
- }
- }else if(strcmp(argv[1],"accesssem")==0){
- int id = atoi(argv[2]);
- struct sembuf ops[]={
- {0,0,0}
- };
- if (semop (id,ops,1) == -1){
- fprintf (stderr,"can't semop with id %d (%s)\n",id,strerror(errno));
- }else{
- ret = 0;
- }
- }
- return ret;
-}
-
-
+++ /dev/null
-// $Id: testlimit.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on tests/testlimit.cc 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.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-int main (int argc, char *argv[])
-{
- if (argc != 3){
- fprintf (stderr,"testlimit nbprocess malloc_size\n");
- }else{
- int nbproc = atoi(argv[1]);
- int size = atoi(argv[2]);
- for (int i=0; i<nbproc; i++){
- if (fork()==0){
- void *pt = malloc(size);
- if (pt == NULL){
- fprintf (stderr,"Child %d: can't malloc (%s)\n"
- ,i,strerror(errno));
- }else{
- memset (pt,1,size);
- }
- sleep (100);
- _exit (0);
- }
- }
- int status;
- while (wait(&status)!=-1);
- }
- return 0;
-}
-
+++ /dev/null
-// $Id: testopenf.cc,v 1.1 2003/09/29 22:01:57 ensc Exp $
-
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-// based on tests/testopenf.cc 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.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-int main (int argc, char *argv[])
-{
- if (argc != 3){
- fprintf (stderr,"testlimit nbprocess nbopen\n");
- }else{
- int nbproc = atoi(argv[1]);
- int nbopen = atoi(argv[2]);
- for (int i=0; i<nbproc; i++){
- if (fork()==0){
- int j;
- for (j=0; j<nbopen; j++){
- FILE *fin = fopen ("/proc/self/status","r");
- if (fin == NULL){
- fprintf (stderr,"Can't open %d (%s)\n",errno,strerror(errno));
- break;
- }
- }
- printf ("%d open files, sleeping\n",j);
- sleep (100);
- _exit (0);
- }
- }
- int status;
- while (wait(&status)!=-1);
- }
- return 0;
-}
-