| 1 |
tetromino |
1.1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
mgorny |
1.3 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/vhba/vhba-20120422.ebuild,v 1.2 2012/07/16 07:20:03 tetromino Exp $
|
| 4 |
tetromino |
1.1 |
|
| 5 |
|
|
EAPI="4"
|
| 6 |
|
|
|
| 7 |
|
|
inherit linux-mod user
|
| 8 |
|
|
|
| 9 |
|
|
MY_P=vhba-module-${PV}
|
| 10 |
|
|
DESCRIPTION="Virtual (SCSI) Host Bus Adapter kernel module for the CDEmu suite"
|
| 11 |
|
|
HOMEPAGE="http://cdemu.org"
|
| 12 |
|
|
SRC_URI="mirror://sourceforge/cdemu/${MY_P}.tar.bz2"
|
| 13 |
|
|
|
| 14 |
|
|
LICENSE="GPL-2"
|
| 15 |
|
|
SLOT="0"
|
| 16 |
|
|
KEYWORDS="~amd64 ~hppa ~x86"
|
| 17 |
|
|
IUSE=""
|
| 18 |
|
|
|
| 19 |
mgorny |
1.3 |
RDEPEND="|| ( >=sys-fs/udev-125 >=sys-apps/systemd-187 )"
|
| 20 |
tetromino |
1.1 |
DEPEND=""
|
| 21 |
|
|
|
| 22 |
|
|
S=${WORKDIR}/${MY_P}
|
| 23 |
|
|
MODULE_NAMES="vhba(block:${S})"
|
| 24 |
|
|
BUILD_TARGETS=all
|
| 25 |
|
|
|
| 26 |
|
|
pkg_setup() {
|
| 27 |
|
|
CONFIG_CHECK="~BLK_DEV_SR ~CHR_DEV_SG"
|
| 28 |
|
|
check_extra_config
|
| 29 |
|
|
BUILD_PARAMS="KDIR=${KV_DIR}"
|
| 30 |
|
|
linux-mod_pkg_setup
|
| 31 |
|
|
|
| 32 |
|
|
enewgroup cdemu
|
| 33 |
|
|
}
|
| 34 |
|
|
|
| 35 |
|
|
src_prepare() {
|
| 36 |
tetromino |
1.2 |
# Avoid "make jobserver unavailable" warning and -Werror problems
|
| 37 |
|
|
sed -e 's:\t$(KMAKE):\t+$(KMAKE):g' \
|
| 38 |
|
|
-e '/EXTRA_CFLAGS/s/-Werror$/-Wall/' \
|
| 39 |
|
|
-i Makefile || die "sed failed"
|
| 40 |
tetromino |
1.1 |
}
|
| 41 |
|
|
|
| 42 |
|
|
src_install() {
|
| 43 |
|
|
dodoc AUTHORS ChangeLog README
|
| 44 |
|
|
linux-mod_src_install
|
| 45 |
|
|
|
| 46 |
|
|
einfo "Generating udev rules ..."
|
| 47 |
|
|
dodir /lib/udev/rules.d/
|
| 48 |
|
|
cat > "${D}"/lib/udev/rules.d/70-vhba.rules <<-EOF || die
|
| 49 |
|
|
# do not edit this file, it will be overwritten on update
|
| 50 |
|
|
#
|
| 51 |
|
|
KERNEL=="vhba_ctl", MODE="0660", OWNER="root", GROUP="cdemu"
|
| 52 |
|
|
EOF
|
| 53 |
|
|
}
|
| 54 |
|
|
|
| 55 |
|
|
pkg_postinst() {
|
| 56 |
|
|
elog "Don't forget to add your user to the cdemu group if you want to"
|
| 57 |
|
|
elog "be able to use virtual cdemu devices."
|
| 58 |
|
|
|
| 59 |
|
|
# Older versions of vhba installed their rule file in /etc/udev/rules.d,
|
| 60 |
|
|
# which overrides rules in /lib/udev/rules.d. We remove the old file
|
| 61 |
|
|
# automatically if it is identical to the default one installed by
|
| 62 |
|
|
# vhba-1.2.1 or 20101015-r1. Note that the comment at the top of the rules
|
| 63 |
|
|
# file states that it can be automatically overwritten by the system.
|
| 64 |
|
|
old_rules="${ROOT}etc/udev/rules.d/70-vhba.rules"
|
| 65 |
|
|
if [[ -f "${old_rules}" ]]; then
|
| 66 |
|
|
case "$(md5sum ${old_rules})" in
|
| 67 |
|
|
2959b3cf61cfe6e466cc3516a7bc19de* | 1e7a7e5d6d28c811eeec98ec26ed5d28* )
|
| 68 |
|
|
elog
|
| 69 |
|
|
elog "Removing old ${old_rules} ..."
|
| 70 |
|
|
rm -f "${old_rules}" ||
|
| 71 |
|
|
eerror "Failed, please remove ${old_rules} manually."
|
| 72 |
|
|
;;
|
| 73 |
|
|
* )
|
| 74 |
|
|
ewarn
|
| 75 |
|
|
ewarn "The ${old_rules} file from a previous"
|
| 76 |
|
|
ewarn "installation of ${PN} is overriding ${P}'s"
|
| 77 |
|
|
ewarn "udev rules. Unless you had deliberately customized it,"
|
| 78 |
|
|
ewarn "you should remove it."
|
| 79 |
|
|
ewarn
|
| 80 |
|
|
;;
|
| 81 |
|
|
esac
|
| 82 |
|
|
fi
|
| 83 |
|
|
|
| 84 |
|
|
linux-mod_pkg_postinst
|
| 85 |
|
|
}
|