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 USR_LIB_VSERVER=$(dirname $0)
30 if [ "$1" = "" ] ; then
31 echo distrib-info vserver-name command [ args ... ] >&2
32 echo Commands are: >&2
33 echo dumpfiles: Shows all files owned by a package >&2
34 echo pkgversion: reports all packages and their version/release >&2
35 echo unifiles: reports all unify-able file of a package >&2
38 if [ "$1" = "/" ] ; then
41 elif [ -d "$1" ] ; then
43 CHROOTCMD="/usr/sbin/chroot $DISTDIR"
46 CHROOTCMD="/usr/sbin/chroot $DISTDIR"
51 if [ -f $DIRDIR/etc/redhat-release -o -f $DISTDIR/etc/mandrake-release ] ; then
54 $CHROOTCMD /bin/rpm -qa --queryformat "%{name}=%{version}-%{release}\n"
57 # We remove /etc and /var/log to make sure no special file
58 # there will be unified
59 $CHROOTCMD /bin/rpm -ql --dump $* \
60 | $USR_LIB_VSERVER/parserpmdump /etc/
63 $CHROOTCMD /bin/rpm -ql $*
66 echo unknown request $KEY >&2
70 echo Distribution not supported yet >&2