3 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 # based on vrpm 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.
20 # Wrapper to update/install package in many vservers at once
22 : ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
23 test -e "$UTIL_VSERVER_VARS" || {
24 echo "Can not find util-vserver installation; aborting..."
27 . "$UTIL_VSERVER_VARS"
30 echo vrpm: Install/Updates packages in several vservers at once
31 echo vrpm vservers ... -- rpm options and packages
32 echo vrpm \[--unify\] ALL -- rpm options and packages
33 echo vrpm \[--unify\] server1 server2 -- -Uvh package.rpm
35 echo vrpm is executed in the root server
36 echo "--unify run vunify on the vserver for the updated packages"
39 if [ "$1" = "--unify" ] ; then
47 while [ $# -gt 0 -a "$1" != "--" ]
49 if [ "$1" = "ALL" ] ; then
50 SERVERS=`cd /vservers && ls`
56 if [ "$1" != "--" ] ; then
58 elif [ "$SERVERS" = "" ] ; then
59 echo no server specified
66 # We try to run the rpm command in the same security
67 # context than the vserver, if running.
68 # This way, process operations will be done in the proper
70 # If the vserver is not running, chcontext will
73 CTXFILE=/var/run/vservers/$serv.ctx
74 if [ -f $CTXFILE ] ; then
76 CTXOPT="--ctx $S_CONTEXT"
78 #echo rpm --root /vservers/$serv $*
79 echo Updating server $serv
80 /usr/sbin/chcontext --silent $CTXOPT rpm --root /vservers/$serv $*
82 if [ "$UNIFY" = "yes" ] ; then
94 pkg=`rpm -qp $pkg --queryformat %{name}`
95 PACKAGES="$PACKAGES $pkg"
100 $PKGLIBDIR/vunify --excldir /var/log $SERVERS -- $PACKAGES