vshost-util-vserver

Build script and sources for util-vserver.
git clone https://ccx.te2000.cz/git/vshost-util-vserver
Log | Files | Refs

vurpm (2461B)


      1 #! /bin/bash
      2 # $Id$
      3 
      4 # Copyright (C) 2011 Daniel Hokka Zakrisson <daniel@hozac.com>
      5 # Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
      6 #  
      7 # This program is free software; you can redistribute it and/or modify
      8 # it under the terms of the GNU General Public License as published by
      9 # the Free Software Foundation; version 2 of the License.
     10 #  
     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.
     15 #  
     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.
     19 
     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
     23     exit 1
     24 }
     25 . "$UTIL_VSERVER_VARS"
     26 . "$_LIB_FUNCTIONS"
     27 
     28 
     29 function showHelp()
     30 {
     31     echo \
     32 $"Usage: $0 <command> <vserver-name>* [--all] -- <params>+
     33 
     34 <command> is any of urpmi/urpme/urpmi.update/urpmf/etc
     35 
     36 Report bugs to <$PACKAGE_BUGREPORT>."
     37     exit 0
     38 }
     39 
     40 function showVersion()
     41 {
     42     echo \
     43 $"vurpm $PACKAGE_VERSION -- urpmi/urpme for vservers
     44 This program is part of $PACKAGE_STRING
     45 
     46 Copyright (C) 2005 Enrico Scholz
     47 This program is free software; you may redistribute it under the terms of
     48 the GNU General Public License.  This program has absolutely no warranty."
     49     exit 0
     50 }
     51 
     52 tmp=$(getopt -o +q --long help,version,debug,quiet,all -n "$0" -- "$@") || exit 1
     53 eval set -- "$tmp"
     54 
     55 declare -a send_through urpmi_opts
     56 
     57 while true; do
     58     case "$1" in
     59 	(--help)    	showHelp $0 ;;
     60 	(--version) 	showVersion ;;
     61 	(--debug)	send_through=( "${send_through[@]}" "$1" ); set -x;;
     62 	(--quiet|-q)	send_through=( "${send_through[@]}" "$1" );;
     63 	(--all)         urpmi_opts=( "${yum_opts[@]}" "$1" );;
     64 	(--)		shift; break;;
     65 	(*)	   	echo $"vurpm: internal error; arg=='$1'" >&2; exit 1;;
     66     esac
     67     shift
     68 done
     69 
     70 VSOMETHING_TITLE=vurpm
     71 VSOMETHING_WORKER=$_VURPM_WORKER
     72 VSOMETHING_PKGMGMT=1
     73 
     74 export VSOMETHING_TITLE VSOMETHING_WORKER VSOMETHING_PKGMGMT
     75 
     76 cmd="$1"
     77 export VURPM_CMD="$cmd"
     78 shift
     79 
     80 test ${#urpmi_opts[@]} -eq 0 || urpmi_opts=( "${urpmi_opts[@]}" -- )
     81 exec $_VSOMETHING "${send_through[@]}" "$cmd" "${urpmi_opts[@]}" "$@"