3 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 # based on distrib-info by Jacques Gelinas
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # This scripts knows about every possible distribution (well, it should)
22 # It is passed a vserver name and a key (a command). The key represent a task.
23 # It executes the command and output on stdout.
25 # distrib-info vserver1 pkgversion
26 # If vserver1 is a redhat system, it executes
27 # rpm -qa --queryformat "%{name}=%{version}-%{release}
28 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
29 test -e "$UTIL_VSERVER_VARS" || {
30 echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
33 . "$UTIL_VSERVER_VARS"
35 if [ "$1" = "" ] ; then
36 echo distrib-info vserver-name command [ args ... ] >&2
37 echo Commands are: >&2
38 echo dumpfiles: Shows all files owned by a package >&2
39 echo pkgversion: reports all packages and their version/release >&2
40 echo unifiles: reports all unify-able file of a package >&2
43 if [ "$1" = "/" ] ; then
46 elif [ -d "$1" ] ; then
48 CHROOTCMD="$__SBINDIR/chroot $DISTDIR"
50 DISTDIR=$__DEFAULT_VSERVERDIR/$1
51 CHROOTCMD="$__SBINDIR/chroot $DISTDIR"
56 if [ -f $DIRDIR/etc/redhat-release -o -f $DISTDIR/etc/mandrake-release ] ; then
59 $CHROOTCMD /bin/rpm -qa --queryformat "%{name}=%{version}-%{release}\n"
62 # We remove /etc and /var/log to make sure no special file
63 # there will be unified
64 $CHROOTCMD /bin/rpm -ql --dump $* \
65 | $_PARSERPMDUMP /etc/
68 $CHROOTCMD /bin/rpm -ql $*
71 echo unknown request $KEY >&2
75 echo Distribution not supported yet >&2