From 663c0330e9dcbac8f916d18511e52b8a80a642e7 Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 23 May 2006 12:36:46 +0000 Subject: [PATCH] 2006-05-23 12:36:46 by steve Allow tab-completion on the available distributions provided by rpmstrap. --- misc/xen-tools | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/misc/xen-tools b/misc/xen-tools index cfa2e69..b525808 100644 --- a/misc/xen-tools +++ b/misc/xen-tools @@ -20,7 +20,7 @@ # -- # http://www.steve.org.uk # -# $Id: xen-tools,v 1.21 2006-05-08 20:55:39 steve Exp $ +# $Id: xen-tools,v 1.22 2006-05-23 12:36:46 steve Exp $ # @@ -33,25 +33,32 @@ # _xen_create_image() { - local cur prev ip roles + local cur prev ip roles dists COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - opts='--broadcast --boot --debug --debootstrap --dhcp --dir --dist --force --fs --gateway --help --hostname --ip --initrd --kernel --manual --memory --mirror --passwd --role --size --swap --volume --version' + opts='--broadcast --boot --debug --debootstrap --dhcp --dir --dist --force --fs --gateway --help --hostname --ip --initrd --kernel --manual --memory --mirror --passwd --role --rpmstrap --size --swap --volume --version' # # Complete the initial part of the IP in the configuration file. ip=`grep ^gateway /etc/xen-tools/xen-tools.conf | awk -F'= ' '{print $2}'` + # + # Available distributions, from rpmstrap + # + if [ -d /usr/lib/rpmstrap/scripts ]; then + dists=`ls -1 /usr/lib/rpmstrap/scripts` + fi + case "$prev" in --dir) _filedir -d return 0 ;; --dist) - COMPREPLY=( $( compgen -W 'sid sarge etch' -- "${COMP_WORDS[COMP_CWORD]}" ) ) + COMPREPLY=( $( compgen -W '${dists} sid sarge etch' -- "${COMP_WORDS[COMP_CWORD]}" ) ) return 0 ;; --fs)