summaryrefslogtreecommitdiff
blob: 5bfea4e0c52a35c52c07929c80fb672033e309de (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
149
150
151
152
153
154
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-wireless/linux-wlan-ng/linux-wlan-ng-0.2.2.ebuild,v 1.1 2005/10/01 14:50:58 betelgeuse Exp $

#The configure script needs prepared sources.
inherit linux-mod

DESCRIPTION="Programs/files needed for Prism2/2.5/3 based wireless LAN products"
HOMEPAGE="http://linux-wlan.org"
SRC_URI="ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/${P}.tar.bz2"

LICENSE="MPL-1.1"
SLOT="0"
KEYWORDS="~x86"

IUSE="debug doc pcmcia"

DEPEND="~net-wireless/linux-wlan-ng-modules-${PV}
		~net-wireless/linux-wlan-ng-utils-${PV}
		~net-wireless/linux-wlan-ng-firmware-${PV}"

RDEPEND=${DEPEND}

#relative to src/
COMPILE_DIRS="mkmeta wlanctl wland nwepgen wlancfg prism2/download"
INSTALL_DIRS="${COMPILE_DIRS} ../etc"

CONFIG_FILE="${S}/default.config"
CONFIG_DIR="/etc/conf.d"

config_by_usevar() {
	local config=${3}
	[[ -z ${config} ]] && config=${CONFIG_FILE}

	if use ${2}; then
		echo "${1}=y" >> ${config}
	else
		echo "${1}=n" >> ${config}
	fi
}

set_option() {
	local config=${3}
	[[ -z ${config} ]] && config=${CONFIG_FILE}

	echo "${1}=${2}" >> ${config}
}

src_unpack() {
	local config=${CONFIG_FILE}

	unpack ${A}

	rm ${S}/doc/rh71notes

	cd ${S}/etc
	mv rc.wlan rc.wlan.orig
	cp ${FILESDIR}/${PN}-gentoo-init rc.wlan

	#IMHO this should not be done but better to not upset users at this point
	sed -i -e "s:/etc/wlan:/etc/conf.d:g" ${S}/etc/wlan/Makefile
	sed -i -e "s:/etc/wlan/wlan.conf:/etc/conf.d/wlan.conf:g" \
		   -e "s:/etc/wlan/wlancfg:/etc/conf.d/wlancfg:g" \
		${S}/etc/wlan/shared

	cp ${S}/config.in ${config}

	set_option TARGET_ROOT_ON_HOST	${D}
	set_option LINUX_SRC			${KERNEL_DIR}
	set_option PRISM2_USB 	 		n
	set_option PRISM2_PCI 	 		n
	set_option PRISM2_PLX 	 		n
	set_option PRISM2_PCMCIA		n

	if kernel_is gt 2 4; then
		set_option KERN_25 y
	fi

	config_by_usevar WLAN_DEBUG debug
}

src_compile() {
	set_arch_to_kernel
	emake default_config || die "emake default_config failed"
	set_arch_to_portage

	CONFIG_FILE="config.mk"

	set_option       FIRMWARE_DIR  "/lib/firmware"
	config_by_usevar PRISM2_PCMCIA  pcmcia

	#For the scripts that go to /etc
	set_option TARGET_PCMCIA_DIR	${D}/etc/pcmcia

	cd ${S}/src/
	for dir in ${COMPILE_DIRS}; do
		pushd ${dir}
		make || die "make in ${dir} failed"
		popd
	done
}

src_install() {
	cd ${S}/man
	doman *.1

	for dir in ${INSTALL_DIRS}; do
		pushd ${S}/src/${dir}
		make install || die "make install in ${dir} failed"
		popd
	done

	cd ${S}

	dodir etc/wlan
	mv ${D}/etc/conf.d/shared ${D}/etc/wlan/

	if use doc; then
		insinto /usr/share/doc/${PF}/
		pushd ${S}/doc
		for file in $(ls); do
			[[ "${file}" != "Makefile" ]] && doins -r ${file}
		done
		popd
	fi

	dodoc CHANGES FAQ README THANKS TODO
}

pkg_postinst() {
	einfo "/etc/init.d/wlan is used to control startup and shutdown of non-PCMCIA devices."
	if use pcmcia; then
		einfo "/etc/init.d/pcmcia from pcmcia-cs is used to control startup and shutdown of"
		einfo "PCMCIA devices."
	fi
	einfo ""
	einfo "Modify ${CONFIG_DIR}/wlan.conf to set global parameters."
	einfo "Modify ${CONFIG_DIR}/wlancfg-* to set individual card parameters."
	einfo "There are detailed instructions in these config files."
	einfo ""
	einfo "Three keygen programs are included: nwepgen, keygen, and lwepgen."
	einfo "keygen seems provide more usable keys at the moment."
	einfo "You can change the keygen in your wlancfg-* files."
	einfo ""
	einfo "Be sure to add iface_wlan0 parameters to /etc/conf.d/net."
	einfo ""
	if use pcmcia; then
		ewarn "Wireless cards which you want to use drivers other than wlan-ng for"
		ewarn "need to have the appropriate line removed from /etc/pcmcia/wlan-ng.conf"
		ewarn "Do 'cardctl info' to see the manufacturer ID and remove the corresponding"
		ewarn "line from that file."
	fi
}