4 # Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
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.
20 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
21 test -e "$UTIL_VSERVER_VARS" || {
22 echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
25 . "$UTIL_VSERVER_VARS"
31 $"Usage: $0 <vserver-name> <tag>
33 Report bugs to <$PACKAGE_BUGREPORT>."
37 function showVersion()
40 vpkg $PACKAGE_VERSION -- shows information about packages in vservers
41 This program is part of $PACKAGE_STRING
43 Copyright (C) 2004 Enrico Scholz
44 This program is free software; you may redistribute it under the terms of
45 the GNU General Public License. This program has absolutely no warranty."
51 (--help) showHelp $(basename $0);;
52 (--version) showVersion ;;
55 test "$1" -a "$2" || {
56 echo $"No vserver and/or tag given; use '--help' for more information" >&2
65 get-conffiles|install) ;;
66 *) echo $"Unsupport tag '$tag'" >&2; exit 1;;
69 cfgdir=$($_VSERVER_INFO "$vserver" APPDIR pkgmgmt) || :
70 vdir=$($_VSERVER_INFO "$1" VDIR) || :
74 pkgmgmt.guessStyle "$vserver" style || exit 2
75 pkgmgmt.isInternal "$vserver" || is_external=1
84 ## rpm outputs sometimes '(contains no files)', so return
85 ## only the valid output
87 rpm_param=( -qac --pipe "$_SED '\!^/!p;d'" );;
89 rpm_param=( -Uvh "$@" )
90 apt_param=( install "$@" )
94 if test -n "$is_external"; then
96 test -d "$cfgdir"/base/apt -o -d "$cfgdir"/aptetc || have_apt=
99 for i in /bin /usr/bin /usr/local/bin; do
100 test ! -x "$vdir$i"/apt-get || { have_apt=1; break; }
104 if test -n "$is_external"; then
105 if test "$have_apt" -a "$apt_param"; then
106 cmd=( "$_VAPT_GET" "$vserver" -- "${apt_param[@]}" )
108 cmd=( "$_VRPM" "$vserver" -- "${rpm_param[@]}" )
111 if test "$have_apt" -a "$apt_param"; then
112 cmd=( "$_VSERVER" --silent "$vserver" exec apt-get "${apt_param[@]}" )
114 cmd=( "$_VSERVER" --silent "$vserver" exec rpm "${rpm_param[@]}" )
121 cmd=( sh -c "cat /var/lib/dpkg/info/*.conffiles 2>/dev/null" )
124 cmd=( apt-get install "$@" )
128 if test -n "$is_external"; then
129 echo $"'external' packagemanagement is not supported for Debian" >&2
132 cmd=( "$_VSERVER" --silent "$vserver" exec "${cmd[@]}" )
136 echo $"Packagemanagement is not supported for '$style' style" >&2