# Distributed under the terms of the GNU General Public License v2
inherit kernel-mod eutils
MY_PV=${PV}-9
MY_P=${PN}-${MY_PV}
S=${WORKDIR}/${MY_P}
DESCRIPTION="Linux driver for PCTel-base linmodems"
HOMEPAGE="http://linmodems.technion.ac.il/pctel-linux/"
SRC_URI="http://linmodems.technion.ac.il/pctel-linux/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
S="${WORKDIR}/${MY_P}"
DEPEND=""
RDEPEND=""
pkg_setup () {
kernel-mod_getversion
if ! kernel-mod_is_2_4_kernel; then
eerror "This version of ${PN} will only compile against Linux 2.4.x"
eerror "Please change where /usr/src/linux points to, or export the KERNEL_DIR"
eerror "environment variable like this:"
eerror
eerror " KERNEL_DIR=\"
\" emerge ${PN}"
die "${P} only works with Linux 2.4"
fi
}
src_unpack() {
unpack ${A}
cd ${S}
epatch ${FILESDIR}/${P}-82801DB-gentoo.diff
}
src_compile() {
cd ${S}/src
sed -e "s:kernel_inc=/usr/src/linux:kernel_inc=${KERNEL_DIR}:" \
-e "s:\`uname -r\`:${KV_DIR_VERSION_FULL}:" \
configure > configure.gentoo
sh configure.gentoo -auto || die
emake || die
}
src_install() {
cd "${S}/src"
insinto /lib/modules/${KV_DIR_VERSION_FULL}/misc
doins ptmodule.o ptserial.o
insinto /etc/modules.d
newins "${FILESDIR}/pctel.modules" pctel
dodir /dev
mknod ${D}/dev/ttyS15 c 62 79
fperms 660 "/dev/ttyS15"
fowners root:dialout "/dev/ttyS15"
}
pkg_postinst()
{
einfo "The modem is accessible with /dev/ttyS15"
einfo "You need to edit /etc/modules.d/pctel and run modules-update."
einfo "You must be in the dialout group to use the modem."
}