From 4594caec9341d17a10db3f9a8c96ec2a9b2c87a6 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 5 Jun 2017 02:56:15 +0100 Subject: give userspace packages a more, userspace name --- sys-fs/zfs-utils/Manifest | 1 + sys-fs/zfs-utils/files/bash-completion | 232 ++++++++++++++++++ sys-fs/zfs-utils/files/bash-completion-r1 | 391 ++++++++++++++++++++++++++++++ sys-fs/zfs-utils/files/zed | 25 ++ sys-fs/zfs-utils/files/zfs-init.sh.in | 29 +++ sys-fs/zfs-utils/files/zfs.service.in | 16 ++ sys-fs/zfs-utils/zfs-utils-0.6.5.9.ebuild | 122 ++++++++++ 7 files changed, 816 insertions(+) create mode 100644 sys-fs/zfs-utils/Manifest create mode 100644 sys-fs/zfs-utils/files/bash-completion create mode 100644 sys-fs/zfs-utils/files/bash-completion-r1 create mode 100644 sys-fs/zfs-utils/files/zed create mode 100644 sys-fs/zfs-utils/files/zfs-init.sh.in create mode 100644 sys-fs/zfs-utils/files/zfs.service.in create mode 100644 sys-fs/zfs-utils/zfs-utils-0.6.5.9.ebuild (limited to 'sys-fs/zfs-utils') diff --git a/sys-fs/zfs-utils/Manifest b/sys-fs/zfs-utils/Manifest new file mode 100644 index 00000000..01dbebe5 --- /dev/null +++ b/sys-fs/zfs-utils/Manifest @@ -0,0 +1 @@ +DIST zfs-0.6.5.9.tar.gz 2610650 SHA256 b724b57dbddae59246fdc15f88f1224061c712945bb36412a2087e0c7760d77f SHA512 6e175f32421cf0f9e13429f12f0fac0564dc7059ab076831d0ebc4f6a17412160ca3526ebdf894bc7666e82580355b08701dd01c411d3177f82e7330b4529a37 WHIRLPOOL 149d730a26363b50691363b314669756d218c4a16e6d06e319c2b0866c5f8ed6e2da2396a516297c127d3343d51d78072d8b7371e3f4d327d30fa43c90be5cd3 diff --git a/sys-fs/zfs-utils/files/bash-completion b/sys-fs/zfs-utils/files/bash-completion new file mode 100644 index 00000000..1b9428bf --- /dev/null +++ b/sys-fs/zfs-utils/files/bash-completion @@ -0,0 +1,232 @@ +# Copyright (c) 2010, Aneurin Price + +# 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-utils/files/bash-completion-r1 b/sys-fs/zfs-utils/files/bash-completion-r1 new file mode 100644 index 00000000..b1aded36 --- /dev/null +++ b/sys-fs/zfs-utils/files/bash-completion-r1 @@ -0,0 +1,391 @@ +# Copyright (c) 2013, Aneurin Price + +# 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. + +#if [[ -w /dev/zfs ]]; then + __ZFS_CMD="zfs" + __ZPOOL_CMD="zpool" +#else +# __ZFS_CMD="sudo zfs" +# __ZPOOL_CMD="sudo zpool" +#fi + +__zfs_get_commands() +{ + $__ZFS_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | cut -f1 -d '|' | uniq +} + +__zfs_get_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all name space +} + +__zfs_get_editable_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}' +} + +__zfs_get_inheritable_properties() +{ + $__ZFS_CMD get 2>&1 | awk '$3 == "YES" {print $1}' +} + +__zfs_list_datasets() +{ + $__ZFS_CMD list -H -o name -t filesystem,volume +} + +__zfs_list_filesystems() +{ + $__ZFS_CMD list -H -o name -t filesystem +} + +__zfs_match_snapshot() +{ + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset + else + $__ZFS_CMD list -H -o name -t filesystem,volume | awk '{print $1"@"}' + fi +} + +__zfs_match_explicit_snapshot() +{ + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset + fi +} + +__zfs_match_multiple_snapshots() +{ + local existing_opts=$(expr "$cur" : '\(.*\)[%,]') + if [[ $existing_opts ]] + then + local base_dataset=${cur%@*} + if [[ $base_dataset != $cur ]] + then + local cur=${cur##*,} + if [[ $cur =~ ^%|%.*% ]] + then + # correct range syntax is start%end + return 1 + fi + local range_start=$(expr "$cur" : '\(.*%\)') + $__ZFS_CMD list -H -o name -t snapshot -d 1 $base_dataset | sed 's$.*@$'$range_start'$g' + fi + else + __zfs_match_explicit_snapshot; __zfs_list_datasets + fi +} + +__zfs_list_volumes() +{ + $__ZFS_CMD list -H -o name -t volume +} + +__zfs_argument_chosen() +{ + local word property + for word in $(seq $((COMP_CWORD-1)) -1 2) + do + local prev="${COMP_WORDS[$word]}" + if [[ ${COMP_WORDS[$word-1]} != -[tos] ]] + then + if [[ "$prev" == [^,]*,* ]] || [[ "$prev" == *[@:]* ]] + then + return 0 + fi + for property in $@ + do + if [[ $prev == "$property" ]] + then + return 0 + fi + done + fi + 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_multiple_options() +{ + local options=$1 + local cur=$2 + + COMPREPLY=($(compgen -W "$options" -- "${cur##*,}")) + local existing_opts=$(expr "$cur" : '\(.*,\)') + if [[ $existing_opts ]] + then + COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" ) + fi +} + +__zfs_complete_switch() +{ + local options=$1 + if [[ ${cur:0:1} == - ]] + then + COMPREPLY=($(compgen -W "-{$options}" -- "$cur")) + return 0 + else + return 1 + fi +} + +__zfs_complete() +{ + local cur prev cmd cmds + COMPREPLY=() + # Don't split on colon + _get_comp_words_by_ref -n : -c cur -p prev -w COMP_WORDS -i COMP_CWORD + cmd="${COMP_WORDS[1]}" + + if [[ ${prev##*/} == zfs ]] + then + cmds=$(__zfs_get_commands) + COMPREPLY=($(compgen -W "$cmds -?" -- "$cur")) + return 0 + fi + + case "${cmd}" in + clone) + case "${prev}" in + -o) + COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "o,p" + then + if __zfs_argument_chosen + then + COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur")) + else + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + fi + ;; + esac + ;; + get) + case "${prev}" in + -d) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + -t) + __zfs_complete_multiple_options "filesystem volume snapshot all" "$cur" + ;; + -s) + __zfs_complete_multiple_options "local default inherited temporary none" "$cur" + ;; + -o) + __zfs_complete_multiple_options "name property value source received all" "$cur" + ;; + *) + if ! __zfs_complete_switch "H,r,p,d,o,t,s" + then + if __zfs_argument_chosen $(__zfs_get_properties) + then + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + else + __zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur" + fi + fi + ;; + esac + ;; + inherit) + if ! __zfs_complete_switch "r" + then + __zfs_complete_ordered_arguments "$(__zfs_get_inheritable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur + fi + ;; + list) + case "${prev}" in + -d) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + -t) + __zfs_complete_multiple_options "filesystem volume snapshot all" "$cur" + ;; + -o) + __zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur" + ;; + -s|-S) + COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "H,r,d,o,t,s,S" + then + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + fi + ;; + esac + ;; + promote) + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur")) + ;; + rollback) + if ! __zfs_complete_switch "r,R,f" + then + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + ;; + send) + if ! __zfs_complete_switch "d,n,P,p,R,v,i,I" + then + COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur")) + fi + ;; + snapshot) + case "${prev}" in + -o) + COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "o,r" + then + COMPREPLY=($(compgen -W "$(__zfs_list_datasets | awk '{print $1"@"}')" -- "$cur")) + fi + ;; + esac + ;; + set) + __zfs_complete_ordered_arguments "$(__zfs_get_editable_properties)" "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" $cur + ;; + upgrade) + case "${prev}" in + -a|-V|-v) + COMPREPLY=($(compgen -W "" -- "$cur")) + ;; + *) + if ! __zfs_complete_switch "a,V,v,r" + then + COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur")) + fi + ;; + esac + ;; + destroy) + if ! __zfs_complete_switch "d,f,n,p,R,r,v" + then + __zfs_complete_multiple_options "$(__zfs_match_multiple_snapshots)" $cur + fi + ;; + *) + COMPREPLY=($(compgen -W "$(__zfs_match_explicit_snapshot) $(__zfs_list_datasets)" -- "$cur")) + ;; + esac + __ltrim_colon_completions "$cur" + return 0 +} + +__zpool_get_commands() +{ + $__ZPOOL_CMD 2>&1 | awk '/^\t[a-z]/ {print $1}' | uniq +} + +__zpool_get_properties() +{ + $__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" || $2 == "NO" {print $1}'; echo all +} + +__zpool_get_editable_properties() +{ + $__ZPOOL_CMD get 2>&1 | awk '$2 == "YES" {print $1"="}' +} + +__zpool_list_pools() +{ + $__ZPOOL_CMD 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]}" + + if [[ ${prev##*/} == zpool ]] + then + cmds=$(__zpool_get_commands) + 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 [[ $prev == -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 -F __zpool_complete zpool diff --git a/sys-fs/zfs-utils/files/zed b/sys-fs/zfs-utils/files/zed new file mode 100644 index 00000000..d46acfac --- /dev/null +++ b/sys-fs/zfs-utils/files/zed @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need zfs +} + +start() { + ebegin "Starting ZFS Event daemon" + + checkpath -q -d -m 0755 /var/run/zed + + start-stop-daemon --start -q \ + --exec /sbin/zed -- -M \ + -p /var/run/zed/pid + eend $? + +} + +stop() { +ebegin "Stopping ZFS Event daemon" + start-stop-daemon --stop -q --pidfile /var/run/zed/pid +eend $? +} diff --git a/sys-fs/zfs-utils/files/zfs-init.sh.in b/sys-fs/zfs-utils/files/zfs-init.sh.in new file mode 100644 index 00000000..ed84585c --- /dev/null +++ b/sys-fs/zfs-utils/files/zfs-init.sh.in @@ -0,0 +1,29 @@ +#!/bin/sh + +ZFS="@sbindir@/zfs" +ZPOOL="@sbindir@/zpool" +ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache" + +if [ -f "${ZPOOL_CACHE}" ]; then + "${ZPOOL}" import -c "${ZPOOL_CACHE}" -aN 2>/dev/null + if [ "${?}" != "0" ]; then + echo "Failed to import not-yet imported pools." >&2 + fi +fi + +echo "Mounting ZFS filesystems" +"${ZFS}" mount -a +if [ "${?}" != "0" ]; then + echo "Failed to mount ZFS filesystems." >&2 + exit 1 +fi + +echo "Exporting ZFS filesystems" +"${ZFS}" share -a +if [ "${?}" != "0" ]; then + echo "Failed to export ZFS filesystems." >&2 + exit 1 +fi + +exit 0 + diff --git a/sys-fs/zfs-utils/files/zfs.service.in b/sys-fs/zfs-utils/files/zfs.service.in new file mode 100644 index 00000000..c390a480 --- /dev/null +++ b/sys-fs/zfs-utils/files/zfs.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=ZFS filesystems setup +Before=network.target +After=systemd-udev-settle.target local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStartPre=/sbin/modprobe zfs +ExecStartPre=/usr/bin/test -c /dev/zfs +ExecStart=/usr/libexec/zfs-init.sh +ExecStop=@sbindir@/zfs umount -a + +[Install] +WantedBy=multi-user.target + diff --git a/sys-fs/zfs-utils/zfs-utils-0.6.5.9.ebuild b/sys-fs/zfs-utils/zfs-utils-0.6.5.9.ebuild new file mode 100644 index 00000000..527ced05 --- /dev/null +++ b/sys-fs/zfs-utils/zfs-utils-0.6.5.9.ebuild @@ -0,0 +1,122 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="5" +PYTHON_COMPAT=( python{2_7,3_4,3_5} ) + +inherit autotools-utils bash-completion-r1 flag-o-matic linux-info python-r1 systemd toolchain-funcs udev + +MY_PN="zfs" +MY_P="${MY_PN}-${PV}" + +SRC_URI="https://github.com/zfsonlinux/${MY_PN}/releases/download/${MY_P}/${MY_P}.tar.gz" + +DESCRIPTION="Userland utilities for ZFS Linux kernel module" +HOMEPAGE="http://zfsonlinux.org/" + +LICENSE="BSD-2 CDDL MIT" +SLOT="0" +KEYWORDS="amd64" +IUSE="debug +rootfs test-suite" + +RESTRICT="test" + +S="${WORKDIR}/${MY_P}" + +COMMON_DEPEND="sys-apps/util-linux + sys-libs/zlib + virtual/awk" +DEPEND="${COMMON_DEPEND} + virtual/pkgconfig" +RDEPEND="${COMMON_DEPEND} + !=sys-apps/grep-2.13* + !sys-fs/zfs-fuse + !prefix? ( virtual/udev ) + test-suite? ( + sys-apps/util-linux + sys-devel/bc + sys-block/parted + sys-fs/lsscsi + sys-fs/mdadm + sys-process/procps + virtual/modutils + ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + !" + eerror " Block devices --->" + eerror " [ ] Loopback device support" + fi + fi + fi + fi + +} + +src_prepare() { + # Update paths + sed -e "s|/sbin/lsmod|/bin/lsmod|" \ + -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \ + -e "s|/sbin/parted|/usr/sbin/parted|" \ + -i scripts/common.sh.in + + autotools-utils_src_prepare +} + +src_configure() { + local myeconfargs=( + --bindir="${EPREFIX}/bin" + --sbindir="${EPREFIX}/sbin" + --with-config=user + --with-dracutdir="/usr/$(get_libdir)/dracut" + --with-udevdir="$(get_udevdir)" + --with-blkid + $(use_enable debug) + ) + autotools-utils_src_configure + + # prepare systemd unit and helper script + cat "${FILESDIR}/zfs.service.in" | \ + sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ + -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ + > "${T}/zfs.service" || die + cat "${FILESDIR}/zfs-init.sh.in" | \ + sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ + -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ + > "${T}/zfs-init.sh" || die +} + +src_install() { + autotools-utils_src_install + gen_usr_ldscript -a uutil nvpair zpool zfs zfs_core + use test-suite || rm -rf "${ED}usr/share/zfs" + + newbashcomp "${FILESDIR}/bash-completion-r1" zfs + bashcomp_alias zfs zpool + + exeinto /usr/libexec + doexe "${T}/zfs-init.sh" + systemd_dounit "${T}/zfs.service" +} -- cgit v1.2.3