summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2012-07-01 12:29:44 +0000
committerRichard Yao <ryao@gentoo.org>2012-07-01 12:29:44 +0000
commitbd899441d880445562dfa621f4df5d7f71c35a38 (patch)
tree2ca6aa41a03ba9af6f3f0be3a57f8f0034b6b75b /sys-fs/zfs
parentStable amd64, x86 for newer stabilized hardened-sources, bug #424351 (diff)
downloadgentoo-2-bd899441d880445562dfa621f4df5d7f71c35a38.tar.gz
gentoo-2-bd899441d880445562dfa621f4df5d7f71c35a38.tar.bz2
gentoo-2-bd899441d880445562dfa621f4df5d7f71c35a38.zip
Import bash-completion from zfs-fuse
(Portage version: 2.1.10.65/cvs/Linux x86_64)
Diffstat (limited to 'sys-fs/zfs')
-rw-r--r--sys-fs/zfs/ChangeLog6
-rw-r--r--sys-fs/zfs/files/bash-completion232
-rw-r--r--sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild6
-rw-r--r--sys-fs/zfs/zfs-0.6.0_rc9.ebuild8
-rw-r--r--sys-fs/zfs/zfs-9999.ebuild13
5 files changed, 252 insertions, 13 deletions
diff --git a/sys-fs/zfs/ChangeLog b/sys-fs/zfs/ChangeLog
index bbcb4f42bdaf..de0749aca678 100644
--- a/sys-fs/zfs/ChangeLog
+++ b/sys-fs/zfs/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-fs/zfs
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.32 2012/06/25 21:19:41 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.33 2012/07/01 12:29:44 ryao Exp $
+
+ 01 Jul 2012; Richard Yao <ryao@gentoo.org> +files/bash-completion,
+ zfs-0.6.0_rc9-r3.ebuild, zfs-0.6.0_rc9.ebuild, zfs-9999.ebuild:
+ Import bash-completion from zfs-fuse
25 Jun 2012; Richard Yao <ryao@gentoo.org> zfs-0.6.0_rc9-r3.ebuild,
zfs-9999.ebuild:
diff --git a/sys-fs/zfs/files/bash-completion b/sys-fs/zfs/files/bash-completion
new file mode 100644
index 000000000000..1b9428bf8602
--- /dev/null
+++ b/sys-fs/zfs/files/bash-completion
@@ -0,0 +1,232 @@
+# Copyright (c) 2010, Aneurin Price <aneurin.price@gmail.com>
+
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+__zfs_get_commands()
+{
+ zfs 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq
+}
+
+__zfs_get_properties()
+{
+ zfs get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all
+}
+
+__zfs_get_editable_properties()
+{
+ zfs get 2>&1 | awk '$2 == "YES" {printf("%s=\n", $1)}'
+}
+
+__zfs_get_inheritable_properties()
+{
+ zfs get 2>&1 | awk '$3 == "YES" {print $1}'
+}
+
+__zfs_list_datasets()
+{
+ zfs list -H -o name
+}
+
+__zfs_list_filesystems()
+{
+ zfs list -H -o name -t filesystem
+}
+
+__zfs_list_snapshots()
+{
+ zfs list -H -o name -t snapshot
+}
+
+__zfs_list_volumes()
+{
+ zfs list -H -o name -t volume
+}
+
+__zfs_argument_chosen()
+{
+ for word in $(seq $((COMP_CWORD-1)) -1 2)
+ do
+ local prev="${COMP_WORDS[$word]}"
+ for property in $@
+ do
+ if [ "x$prev" = "x$property" ]
+ then
+ return 0
+ fi
+ done
+ done
+ return 1
+}
+
+__zfs_complete_ordered_arguments()
+{
+ local list1=$1
+ local list2=$2
+ local cur=$3
+ local extra=$4
+ if __zfs_argument_chosen $list1
+ then
+ COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur"))
+ else
+ COMPREPLY=($(compgen -W "$list1 $extra" -- "$cur"))
+ fi
+}
+
+__zfs_complete()
+{
+ local cur prev cmd cmds
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ cmd="${COMP_WORDS[1]}"
+ cmds=$(__zfs_get_commands)
+
+ if [ "${prev##*/}" = "zfs" ]
+ then
+ COMPREPLY=($(compgen -W "$cmds -?" -- "$cur"))
+ return 0
+ fi
+
+ case "${cmd}" in
+ clone)
+ __zfs_complete_ordered_arguments "$(__zfs_list_snapshots)" "$(__zfs_list_filesystems) $(__zfs_list_volumes)" $cur
+ return 0
+ ;;
+ get)
+ __zfs_complete_ordered_arguments "$(__zfs_get_properties)" "$(__zfs_list_datasets)" "$cur" "-H -r -p"
+ return 0
+ ;;
+ inherit)
+ __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_list_datasets)" $cur
+ return 0
+ ;;
+ list)
+ if [ "x$prev" = "x-o" ]
+ then
+ COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "${cur##*,}"))
+ local existing_opts=$(expr "$cur" : '\(.*,\)')
+ if [ ! "x$existing_opts" = "x" ]
+ then
+ COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
+ fi
+ else
+ COMPREPLY=($(compgen -W "$(__zfs_list_datasets) -H -r -o" -- "$cur"))
+ fi
+ return 0
+ ;;
+ promote)
+ COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
+ return 0
+ ;;
+ rollback|send)
+ COMPREPLY=($(compgen -W "$(__zfs_list_snapshots)" -- "$cur"))
+ return 0
+ ;;
+ snapshot)
+ COMPREPLY=($(compgen -W "$(__zfs_list_filesystems) $(__zfs_list_volumes)" -- "$cur"))
+ return 0
+ ;;
+ set)
+ __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_list_filesystems) $(__zfs_list_volumes)" $cur
+ return 0
+ ;;
+ *)
+ COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur"))
+ return 0
+ ;;
+ esac
+
+}
+
+__zpool_get_commands()
+{
+ zpool 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq
+}
+
+__zpool_get_properties()
+{
+ zpool get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all
+}
+
+__zpool_get_editable_properties()
+{
+ zpool get 2>&1 | awk '$2 == "YES" {printf("%s=\n", $1)}'
+}
+
+__zpool_list_pools()
+{
+ zpool list -H -o name
+}
+
+__zpool_complete()
+{
+ local cur prev cmd cmds
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ cmd="${COMP_WORDS[1]}"
+ cmds=$(__zpool_get_commands)
+
+ if [ "${prev##*/}" = "zpool" ]
+ then
+ COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
+ return 0
+ fi
+
+ case "${cmd}" in
+ get)
+ __zfs_complete_ordered_arguments "$(__zpool_get_properties)" "$(__zpool_list_pools)" $cur
+ return 0
+ ;;
+ import)
+ if [ "x$prev" = "x-d" ]
+ then
+ _filedir -d
+ else
+ COMPREPLY=($(compgen -W "$(__zpool_list_pools) -d" -- "$cur"))
+ fi
+ return 0
+ ;;
+ set)
+ __zfs_complete_ordered_arguments "$(__zpool_get_editable_properties)" "$(__zpool_list_pools)" $cur
+ return 0
+ ;;
+ add|attach|clear|create|detach|offline|online|remove|replace)
+ local pools="$(__zpool_list_pools)"
+ if __zfs_argument_chosen $pools
+ then
+ _filedir
+ else
+ COMPREPLY=($(compgen -W "$pools" -- "$cur"))
+ fi
+ return 0
+ ;;
+ *)
+ COMPREPLY=($(compgen -W "$(__zpool_list_pools)" -- "$cur"))
+ return 0
+ ;;
+ esac
+
+}
+
+complete -F __zfs_complete zfs
+complete -o filenames -F __zpool_complete zpool
diff --git a/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild b/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild
index 4e9acca2483b..e1117019e010 100644
--- a/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild
+++ b/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild,v 1.2 2012/06/25 21:19:41 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.0_rc9-r3.ebuild,v 1.3 2012/07/01 12:29:44 ryao Exp $
EAPI="4"
@@ -8,7 +8,7 @@ AT_M4DIR="config"
AUTOTOOLS_AUTORECONF="1"
AUTOTOOLS_IN_SOURCE_BUILD="1"
-inherit flag-o-matic linux-mod toolchain-funcs autotools-utils
+inherit bash-completion-r1 flag-o-matic linux-mod toolchain-funcs autotools-utils
if [ ${PV} == "9999" ] ; then
inherit git-2
@@ -130,6 +130,8 @@ src_install() {
doexe "${FILESDIR}/linuxrc"
fi
+ newbashcomp "${FILESDIR}/bash-completion" zfs
+
}
pkg_postinst() {
diff --git a/sys-fs/zfs/zfs-0.6.0_rc9.ebuild b/sys-fs/zfs/zfs-0.6.0_rc9.ebuild
index 56b9ed2068c5..7eb180e3d2c1 100644
--- a/sys-fs/zfs/zfs-0.6.0_rc9.ebuild
+++ b/sys-fs/zfs/zfs-0.6.0_rc9.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.0_rc9.ebuild,v 1.5 2012/06/18 15:19:14 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.0_rc9.ebuild,v 1.6 2012/07/01 12:29:44 ryao Exp $
EAPI="4"
@@ -8,7 +8,7 @@ AT_M4DIR="config"
AUTOTOOLS_AUTORECONF="1"
AUTOTOOLS_IN_SOURCE_BUILD="1"
-inherit flag-o-matic linux-mod toolchain-funcs autotools-utils
+inherit bash-completion-r1 flag-o-matic linux-mod toolchain-funcs autotools-utils
if [ ${PV} == "9999" ] ; then
inherit git-2
@@ -26,7 +26,7 @@ HOMEPAGE="http://zfsonlinux.org/"
LICENSE="CDDL GPL-2"
SLOT="0"
-IUSE="custom-cflags debug dracut +rootfs test test-suite static-libs"
+IUSE="bash-completion custom-cflags debug dracut +rootfs test test-suite static-libs"
DEPEND="
=sys-kernel/spl-${PV}*
@@ -127,6 +127,8 @@ src_install() {
doexe "${FILESDIR}/linuxrc"
fi
+ newbashcomp "${FILESDIR}/bash-completion" zfs
+
}
pkg_postinst() {
diff --git a/sys-fs/zfs/zfs-9999.ebuild b/sys-fs/zfs/zfs-9999.ebuild
index 82f35e385b05..4059e0764d3b 100644
--- a/sys-fs/zfs/zfs-9999.ebuild
+++ b/sys-fs/zfs/zfs-9999.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.25 2012/06/25 21:19:41 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.26 2012/07/01 12:29:44 ryao Exp $
EAPI="4"
@@ -8,7 +8,7 @@ AT_M4DIR="config"
AUTOTOOLS_AUTORECONF="1"
AUTOTOOLS_IN_SOURCE_BUILD="1"
-inherit flag-o-matic linux-mod toolchain-funcs autotools-utils
+inherit bash-completion-r1 flag-o-matic linux-mod toolchain-funcs autotools-utils
if [ ${PV} == "9999" ] ; then
inherit git-2
@@ -26,7 +26,7 @@ HOMEPAGE="http://zfsonlinux.org/"
LICENSE="CDDL GPL-2"
SLOT="0"
-IUSE="custom-cflags debug dracut +rootfs test test-suite static-libs"
+IUSE="bash-completion custom-cflags debug dracut +rootfs test test-suite static-libs"
DEPEND="
=sys-kernel/spl-${PV}*
@@ -64,9 +64,7 @@ pkg_setup() {
MODULES
ZLIB_DEFLATE
ZLIB_INFLATE"
- use rootfs && \
- CONFIG_CHECK="${CONFIG_CHECK} BLK_DEV_INITRD
- DEVTMPFS"
+ use rootfs && CONFIG_CHECK="${CONFIG_CHECK} DEVTMPFS"
kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
check_extra_config
}
@@ -86,7 +84,6 @@ src_prepare() {
epatch "${FILESDIR}/${P}-remove-pfmalloc-1-of-3.patch"
epatch "${FILESDIR}/${P}-remove-pfmalloc-2-of-3.patch"
epatch "${FILESDIR}/${P}-remove-pfmalloc-3-of-3.patch"
- epatch "${FILESDIR}/${P}-range-lock-caller-allocate.patch"
fi
autotools-utils_src_prepare
@@ -130,6 +127,8 @@ src_install() {
doexe "${FILESDIR}/linuxrc"
fi
+ newbashcomp "${FILESDIR}/bash-completion" zfs
+
}
pkg_postinst() {