summaryrefslogtreecommitdiff
blob: b13bbd70b2e54066cd226a527a01ae58c4aa5928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/ltmodem/ltmodem-8.31_alpha10-r3.ebuild,v 1.7 2007/07/02 14:45:03 peper Exp $

inherit linux-mod eutils

MY_P="${P/_alpha/a}"
MY_ALK_VER="2.6-alk-8"

DESCRIPTION="Winmodems with Lucent Apollo (ISA) and Mars (PCI) chipsets"
HOMEPAGE="http://www.heby.de/ltmodem/"
SRC_URI="http://www.physcip.uni-stuttgart.de/heby/ltmodem/${MY_P}.tar.gz
	http://www.sfu.ca/~cth/ltmodem/${MY_P}.tar.gz
	http://linmodems.technion.ac.il/packages/ltmodem/kernel-2.6/ltmodem-${MY_ALK_VER}.tar.bz2"

LICENSE="GPL-2"
KEYWORDS="x86"
IUSE=""

RESTRICT="userpriv"

S="${WORKDIR}/${PN}-${MY_ALK_VER}"
S_2_4="${WORKDIR}/${MY_P}"

DEPEND="sys-apps/util-linux"

pkg_setup() {
	if kernel_is 2 4; then
		MODULE_NAMES="lt_modem(lt_modem:) lt_serial(lt_modem:)"
		MODULESD_LTMODEM_ALIASES=( "char-major-62 lt_serial"
			"/dev/tts/LT0  lt_serial"
			"/dev/modem lt_serial" )
		CONFIG_CHECK="SERIAL"
		SERIAL_8250_ERROR="This driver requires you to compile your kernel with serial core (CONFIG_SERIAL) support."
	else
		MODULE_NAMES="ltmodem(ltmodem:) ltserial(ltmodem:)"
		MODULESD_LTMODEM_ALIASES=( "char-major-62 ltserial"
			"/dev/tts/LT0  ltserial"
			"/dev/modem ltserial" )
		CONFIG_CHECK="SERIAL_8250"
		SERIAL_8250_ERROR="This driver requires you to compile your kernel with serial core (CONFIG_SERIAL_8250) support."
	fi
	linux-mod_pkg_setup

	BUILD_TARGETS="module"
	BUILD_PARAMS="KERNEL_DIR='${KV_DIR}'"
}

src_unpack() {
	unpack ${A}
	epatch "${FILESDIR}/${PN}-${MY_ALK_VER}-kernel-changes.patch"
	convert_to_m "${S}/Makefile"
}

src_compile() {
	if kernel_is 2 4; then
		cd "${S_2_4}"
		sed -i -e 's:make -e:make:' -e 's:read -p:echo:' build_module
		FAST="1" ./build_module ${KV_FULL} || die "Compilation filed"
	else
		linux-mod_src_compile
	fi
}

src_install() {
	# install docs
	cd "${S_2_4}/DOCs"
	dohtml *.html

	rm -rf *.html Installers build* Build* gcc3.txt Examples Suse*
	rm -rf fixscript* slackware srcprep.man scanmodem.man conf*

	rename .man .1 *.man
	doman *.1
	rm -rf *.1

	dodoc ../1ST-READ *
	cd ..

	# install utilities
	mv utils/unloading utils/lt_unloading
	dosbin utils/lt_*

	# Add configuration for devfs, udev
	insinto /etc/devfs.d/; newins "${FILESDIR}/ltmodem_devfs" ltmodem
	insinto /etc/udev/rules.d/; newins "${FILESDIR}/ltmodem_udev" 55-ltmodem.rules

	# install kernel module
	if kernel_is 2 4; then
		cd source
		make install "ROOTDIR=${D}" || die "Cannot install drivers"
	else
		linux-mod_src_install
	fi
}

pkg_preinst() {
	linux-mod_pkg_preinst

	# Remove obsolete devfs configuration files if the box use udev
	if [ -e "${ROOT}/dev/.udev" ]; then
		rm -r "${D}/etc/devfs.d"
	fi
}

pkg_postinst() {
	linux-mod_pkg_postinst

	if [ "$ROOT" = "/" ]; then
		[ -x /sbin/update-modules ] && /sbin/update-modules || /sbin/modules-update
	fi

	# Make some devices if we aren't using devfs
	if [ -e "${ROOT}/dev/.devfsd" ]; then
		ebegin "Restarting devfsd to reread devfs rules"
			killall -HUP devfsd
		eend $?

		elog "Use /dev/tts/LT0 or /dev/ttyLT0 to access modem"
	elif [ -e "${ROOT}/dev/.udev" ]; then
		ebegin "Restarting udev to reread udev rules"
			udevstart
		eend $?

		elog "Use /dev/ttyLTM0 to access modem"
	else
		mknod --mode=0660 /dev/ttyLTM0 c 62 64 && chgrp dialout /dev/ttyLTM0

		elog "Use /dev/ttyLTM0 to access modem"
	fi

	echo
	ewarn "Remember, in order to access the modem,"
	ewarn "you have to be in the 'dialout' group."
	ewarn "Also, if your dialing application use locking mechanism (e.g wvdial),"
	ewarn "you should have write access to /var/lock directory."

	if linux_chkconfig_present SMP ; then
		ewarn
		ewarn "Please note that Linux support for SMP (symmetric multi processor)"
		ewarn "is reported to be incompatible with this driver!"
		ewarn "In case it doesn't work, you should try first to disable CONFIG_SMP in your kernel."
	fi

	elog
	elog "If you have problems, read this doc:"
	elog "/usr/share/doc/${PF}/html/post-install.html"
}