--- /dev/null
+--reinstall
+
+filesystem
+coreutils
--- /dev/null
+coreutils
+setup
--- /dev/null
+[development]
+name=Fedora Core 3 - Development Tree
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/development/$basearch/
+mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-rawhide
+enabled=0
--- /dev/null
+[updates-testing]
+name=Fedora Core 3 - $basearch - Test Updates
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/testing/3/$basearch/
+mirrorlist=http://fedora.redhat.com/download/mirrors/updates-testing-fc3
+enabled=0
+gpgcheck=1
--- /dev/null
+[updates-released]
+name=Fedora Core 3 - $basearch - Released Updates
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/3/$basearch/
+mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc3
+enabled=1
+gpgcheck=1
--- /dev/null
+[base]
+name=Fedora Core 3 - $basearch - Base
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/3/$basearch/os/
+mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-3
+enabled=1
+gpgcheck=1
--- /dev/null
+[main]
+cachedir=@YUMCACHEDIR@
+reposdir=@YUMETCDIR@/yum.repos.d
+debuglevel=1
+logfile=@YUMLOGDIR@/log
+pkgpolicy=newest
+distroverpkg=redhat-release
--- /dev/null
+# $Id$ --*- sh -*--
+
+# 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.
+
+function yum.installBasePackages
+{
+ local name="$1"
+ local dir="$2"
+
+ test "$dir" != / || return 0
+ for filelist in "$dir"/*; do
+ test -f "$filelist" || continue
+ local idx=0
+ local can_fail=false
+ local flags=
+
+ set -- $(<$filelist)
+ while test "$#" -gt 0; do
+ case "$1" in
+ --reinstall) flags='';;
+ --can-fail) can_fail=true;;
+ *) break;;
+ esac
+ shift
+ done
+ "$_VYUM" "$name" -- -y install $flags $* || $can_fail
+ done
+}
+
+function yum.initVariables
+{
+ findDir YUMREPOSDEFAULT \
+ "$CONFDIR/.distributions/$DISTRIBUTION/yum.repos.d" \
+ "$DISTRIBDIR/$DISTRIBUTION/yum.repos.d" \
+ ''
+}
+
+function yum.initFilesystem
+{
+ mkdir -p "$PKGCFGDIR"/yum/{etc,cache}
+
+ populateDirectory "$PKGCFGDIR/yum/etc" \
+ "$DISTRIBDIR/defaults/yum" \
+ "$DISTRIBDIR/$DISTRIBUTION/yum" \
+ "$CONFDIR/.distributions/$DISTRIBUTION/yum"
+
+ ## workaround for yum's automatism to search the configuration in the chroot
+ local prefix='/../../../../../../../../../../../../'
+ local f="$PKGCFGDIR"/yum/etc/yum.conf
+ if test -e "$f"; then
+ $_SED -e "s!@YUMETCDIR@!$prefix$PKGCFGDIR/yum/etc!g;
+ s!@YUMCACHEDIR@!$prefix$PKGCFGDIR/yum/cache!g;
+ s!@YUMLOGDIR@!$prefix$PKGCFGDIR/yum!g;
+ " "$f" >"$f.tmp"
+ $_CMP -s "$f" "$f.tmp" || $_CAT "$f.tmp" >"$f"
+ $_RM -f "$f.tmp"
+ fi
+
+ test -z "$YUMREPOSDEFAULT" -o -e "$PKGCFGDIR/yum/etc/yum.repos.d" || \
+ $_LN_S "$YUMREPOSDEFAULT" "$PKGCFGDIR/yum/etc/yum.repos.d"
+}
--- /dev/null
+# $Id$ --*- sh -*--
+
+# Copyright (C) 2005 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.
+
+tmp=$(getopt -o +d: --long debug -n "$0" -- "$@") || exit 1
+eval set -- "$tmp"
+
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_RPM"
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_YUM"
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT"
+
+while true; do
+ case "$1" in
+ (-d) DISTRIBUTION=$2; shift;;
+ (--debug) set -x;;
+ (--) shift; break ;;
+ (*) echo "vserver-build.yum-rpm: internal error: unrecognized option '$1'" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+getDistribution
+
+base.initVariables
+pkgmgmt.initVariables
+rpm.initVariables
+yum.initVariables
+
+base.initFilesystem "$OPTION_FORCE"
+pkgmgmt.initFilesystem "$OPTION_FORCE"
+rpm.initFilesystem
+yum.initFilesystem
+
+setup_writeOption "$VSERVER_NAME"
+setup_writeInitialFstab
+
+test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
+rpm.importGPGPubKeys "$SETUP_CONFDIR" "$CONFDIR/.distributions/$DISTRIBUTION/pubkeys" "$DISTRIBDIR/$DISTRIBUTION/pubkeys"
+rpm.initDB "$SETUP_CONFDIR"
+yum.installBasePackages "$SETUP_CONFDIR" "$PKGDIR"
+$_VYUM "$SETUP_CONFDIR" -- clean all
+test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
--- /dev/null
+#! /bin/bash
+# $Id$
+
+# Copyright (C) 2005 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.
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+. "$_LIB_FUNCTIONS"
+
+
+function showHelp()
+{
+ echo \
+$"Usage: $0 [--quiet|-q] [--debug] <cmd> [--] <vserver-name>* [--all] -- <params>+
+
+Execute <cmd> <vserver> <params>* foreach vserver.
+
+Report bugs to <$PACKAGE_BUGREPORT>."
+ exit 0
+}
+
+function showVersion()
+{
+ echo \
+$"vsomething $PACKAGE_VERSION -- execute something for a set of vservers
+This program is part of $PACKAGE_STRING
+
+Copyright (C) 2005 Enrico Scholz
+This program is free software; you may redistribute it under the terms of
+the GNU General Public License. This program has absolutely no warranty."
+ exit 0
+}
+
+
+is_quiet=
+declare -a vservers=()
+
+tmp=$(getopt -o +q --long help,version,debug,quiet -n "$0" -- "$@") || exit 1
+eval set -- "$tmp"
+
+while true; do
+ case "$1" in
+ (--help) showHelp $0 ;;
+ (--version) showVersion ;;
+ (--debug) set -x;;
+ (--quiet|-q) is_quiet=1 ;;
+ (--) shift; break;;
+ (*) echo $"vserver: internal error; arg=='$1'" >&2; exit 1;;
+ esac
+ shift
+done
+
+test "$#" -ge 1 || \
+ panic $"vsomething: no operation specified; try '--help' for more information"
+
+cmd=$1
+title=${VSOMETHING_TITLE:-$cmd}
+shift
+
+while test "$#" -ge 1; do
+ case "$1" in
+ --) shift; break;;
+ --all)
+ getAllVservers tmp
+ vservers=( "${vservers[@]}" "${tmp[@]}" )
+ ;;
+ *) vservers=( "${vservers[@]}" "$1" )
+ esac
+ shift
+done
+
+
+test "${#vservers[@]}" -ne 1 || is_quiet=1
+
+
+cnt=0
+res=255
+for i in "${vservers[@]}"; do
+ cnt=$[ cnt + 1 ]
+
+ test "$is_quiet" || {
+ colorize bold echo -n "$title: operating on vserver "
+ colorize bold colorize emph echo "$i"
+ xtermTitle "$title: operating on vserver '$i' [$cnt/${#vservers[@]}]"
+ }
+
+ if test "$VSOMETHING_PKGMGMT"; then
+ if pkgmgmt.isInternal "$i"; then
+ $_VSERVER "$i" exec "$cmd" "$@"
+ else
+ callInNamespace "$i" \
+ "$_VNAMESPACE" --new -- "$VSOMETHING_WORKER" "$i" "$@"
+ fi
+ else
+ "$cmd" "$i" "$@"
+ fi
+
+ res=$?
+
+ test $res -eq 0 -o "$is_quiet" || {
+ colorize error echo -n $"$title failed on vserver '$i' with errorcode $res"
+ echo
+ }
+
+ test "$is_quiet" || echo
+done
+
+test "$cnt" -ge 0 || warning $"No vservers specified"
+exit $res
--- /dev/null
+#! /bin/bash
+# $Id$
+
+# Copyright (C) 2005 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.
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+. "$_LIB_FUNCTIONS"
+
+
+function showHelp()
+{
+ echo \
+$"Usage: $0 <vserver-name>* [--all] -- <params>+
+
+Report bugs to <$PACKAGE_BUGREPORT>."
+ exit 0
+}
+
+function showVersion()
+{
+ echo \
+$"vyum $PACKAGE_VERSION -- yum for vservers
+This program is part of $PACKAGE_STRING
+
+Copyright (C) 2005 Enrico Scholz
+This program is free software; you may redistribute it under the terms of
+the GNU General Public License. This program has absolutely no warranty."
+ exit 0
+}
+
+tmp=$(getopt -o +q --long help,version,debug,quiet -n "$0" -- "$@") || exit 1
+eval set -- "$tmp"
+
+declare -a send_through
+
+while true; do
+ case "$1" in
+ (--help) showHelp $0 ;;
+ (--version) showVersion ;;
+ (--debug) send_through=( "${send_through[@]}" "$1" ); set -x;;
+ (--quiet|-q) send_through=( "${send_through[@]}" "$1" );;
+ (--) shift; break;;
+ (*) echo $"vyum: internal error; arg=='$1'" >&2; exit 1;;
+ esac
+ shift
+done
+
+VSOMETHING_TITLE=vyum
+VSOMETHING_WORKER=$_VYUM_WORKER
+VSOMETHING_PKGMGMT=1
+
+export VSOMETHING_TITLE VSOMETHING_WORKER VSOMETHING_PKGMGMT
+
+exec $_VSOMETHING "${send_through[@]}" yum "$@"
--- /dev/null
+#! /bin/bash
+# $Id$
+
+# 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.
+
+set -e
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+. "$_LIB_FUNCTIONS"
+
+vserver="$1"
+shift
+
+pkgInit "$vserver" rpm yum
+rpmFake.init "$vserver"
+
+rpmFake.exec ${_YUM:-yum} \
+ -c "$YUMETCDIR/yum.conf" \
+ --installroot="$VDIR" \
+ "$@"
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2005 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 "util.h"
+
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <limits.h>
+
+#define ENSC_WRAPPERS_PREFIX "check-unixfile: "
+#define ENSC_WRAPPERS_FCNTL 1
+#define ENSC_WRAPPERS_UNISTD 1
+#include <wrappers.h>
+
+int wrapper_exit_code = 255;
+
+static void
+showHelp(int fd, char const *cmd)
+{
+ WRITE_MSG(fd, "Usage: ");
+ WRITE_STR(fd, cmd);
+ WRITE_MSG(fd,
+ " [--] <file>+\n\n"
+ "Please report bugs to " PACKAGE_BUGREPORT "\n");
+ exit(0);
+}
+
+static void
+showVersion()
+{
+ WRITE_MSG(1,
+ "check-unixfile " VERSION " -- execute some basic fileformat checks\n"
+ "This program is part of " PACKAGE_STRING "\n\n"
+ "Copyright (C) 2005 Enrico Scholz\n"
+ VERSION_COPYRIGHT_DISCLAIMER);
+ exit(0);
+}
+
+static bool
+checkFile(char const *fname)
+{
+ int fd = Eopen(fname, O_RDONLY, 0);
+ off_t l = Elseek(fd, 0, SEEK_END);
+ char const * data = 0;
+ bool res = true;
+
+ if (l>100*1024*1024) {
+ WRITE_MSG(2, "WARNING: '");
+ WRITE_STR(2, fname);
+ WRITE_STR(2, "' is too large for a vserver configuration file\n");
+ res = false;
+ }
+ else if (l>0) {
+ data = mmap(0, l, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (data==0) {
+ perror("mmap()");
+ exit(wrapper_exit_code);
+ }
+
+ if (data[l-1]!='\n') {
+ WRITE_MSG(2, "WARNING: '");
+ WRITE_STR(2, fname);
+ WRITE_MSG(2, "' does not end on newline\n");
+ res = false;
+ }
+
+ munmap(const_cast(char *)(data), l);
+ }
+
+ Eclose(fd);
+
+ return res;
+}
+
+int main(int argc, char *argv[])
+{
+ int idx = 1;
+ bool ok = true;
+ bool passed = false;
+
+ if (argc>=2) {
+ if (strcmp(argv[1], "--help") ==0) showHelp(1, argv[0]);
+ if (strcmp(argv[1], "--version")==0) showVersion();
+ if (strcmp(argv[1], "--") ==0) ++idx;
+ }
+
+ for (; idx<argc; ++idx)
+ if (checkFile(argv[idx])) passed = true;
+ else ok = false;
+
+ if (ok) return 0;
+ else if (passed) return 2;
+ else return 1;
+}