/[gentoo-x86]/eclass/linux-mod.eclass
Gentoo

Diff of /eclass/linux-mod.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 Revision 1.12
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.11 2004/12/18 16:00:10 johnm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.12 2004/12/18 16:22:13 johnm Exp $
4 4
5# Description: This eclass is used to interface with linux-info in such a way 5# Description: This eclass is used to interface with linux-info in such a way
6# to provide the functionality required and initial functions 6# to provide the functionality required and initial functions
7# required to install external modules against a kernel source 7# required to install external modules against a kernel source
8# tree. 8# tree.
22# BUILD_TARGETS <string> clean modules The build targets to pass to make. 22# BUILD_TARGETS <string> clean modules The build targets to pass to make.
23# MODULE_NAMES <string> This is the modules which are 23# MODULE_NAMES <string> This is the modules which are
24# to be built automatically using the 24# to be built automatically using the
25# default pkg_compile/install. They 25# default pkg_compile/install. They
26# are explained properly below. 26# are explained properly below.
27# NO_MODULESD <string> Set this to something to prevent
28# modulesd file generation
27 29
28 30
29# MODULE_NAMES - Detailed Overview 31# MODULE_NAMES - Detailed Overview
30# 32#
31# The structure of each MODULE_NAMES entry is as follows: 33# The structure of each MODULE_NAMES entry is as follows:
125 local selectedmodule selectedmodule_full selectedmodulevars parameter modinfop arg xifs temp 127 local selectedmodule selectedmodule_full selectedmodulevars parameter modinfop arg xifs temp
126 local module_docs module_opts module_aliases module_config 128 local module_docs module_opts module_aliases module_config
127 129
128 for arg in ${@} 130 for arg in ${@}
129 do 131 do
132 selectedmodule_full="${arg}"
133 # strip the directory
134 selectedmodule="${selectedmodule_full/*\//}"
130 # convert the modulename to uppercase 135 # convert the modulename to uppercase
131 selectedmodule_full="${arg}"
132 selectedmodule="${selectedmodule_full/*\//}"
133 selectedmodule="$(echo ${selectedmodule} | tr '[:lower:]' '[:upper:]')" 136 selectedmodule="$(echo ${selectedmodule} | tr '[:lower:]' '[:upper:]')"
134 137
135 module_docs="MODULESD_${selectedmodule}_DOCS" 138 module_docs="MODULESD_${selectedmodule}_DOCS"
136 module_aliases="$(eval echo \$\{#MODULESD_${selectedmodule}_ALIASES[*]\})" 139 module_aliases="$(eval echo \$\{#MODULESD_${selectedmodule}_ALIASES[*]\})"
140 [ ${module_aliases} == 0 ] && unset module_aliases
137 module_docs="${!module_docs}" 141 module_docs="${!module_docs}"
142 modinfop="$(modinfo -p ${selectedmodule_full}.${KV_OBJ})"
138 143
144 # By now we know if there is anything we can use to generate a file with
145 # so unset empty vars and bail out if we find nothing.
139 for parameter in ${!module_*} 146 for parameter in ${!module_*}
140 do 147 do
141 [ -z "${!parameter}" ] && unset ${parameter} 148 [ -z "${!parameter}" ] && unset ${parameter}
142 done 149 done
143
144 # OK, so now ${!module_*} only contains stuff from the ebuild.
145 # now we can do some proper work!
146 [ -z "${!module_*}" ] && return 150 [ -z "${!module_*}" -a -z "${modinfop}" ] && return
147 151
152 #so now we can set the configfilevar
148 module_config="${T}/modulesd-${selectedmodule}" 153 module_config="${T}/modulesd-${selectedmodule}"
149 154
155 # and being working on things.
150 ebegin "Preparing file for modules.d" 156 ebegin "Preparing file for modules.d"
151 echo "# modules.d config file for ${selectedmodule}" >> ${module_config} 157 echo "# modules.d config file for ${selectedmodule}" >> ${module_config}
152 echo "# this file was automatically generated from linux-mod.eclass" >> ${module_config} 158 echo "# this file was automatically generated from linux-mod.eclass" >> ${module_config}
153 echo "# on behalf of ${EBUILD/*\//}" >> ${module_config} 159 echo "# on behalf of ${EBUILD/*\//}" >> ${module_config}
154 for temp in ${module_docs} 160 for temp in ${module_docs}
155 do 161 do
156 echo "# Please read ${temp/*\//} for more info" >> ${module_config} 162 echo "# Please read ${temp/*\//} for more info" >> ${module_config}
157 done 163 done
158 164
165 # like inserting any aliases
159 if [ ${module_aliases} -gt 0 ]; 166 if [ ${module_aliases} > 0 ];
160 then 167 then
161 echo "# Internal Aliases - Do not edit" >> ${module_config} 168 echo "# Internal Aliases - Do not edit" >> ${module_config}
162 echo "# ------------------------------" >> ${module_config} 169 echo "# ------------------------------" >> ${module_config}
163 170
164 (( module_aliases-- )) 171 (( module_aliases-- ))
165 for temp in $(seq 0 ${module_aliases}) 172 for temp in $(seq 0 ${module_aliases})
166 do 173 do
167 echo "alias $(eval echo \$\{MODULESD_${selectedmodule}_ALIASES[$temp]\})" >> ${module_config} 174 echo "alias $(eval echo \$\{MODULESD_${selectedmodule}_ALIASES[$temp]\})" >> ${module_config}
168
169 done 175 done
170 fi 176 fi
171 177
172 modinfop="$(modinfo -p ${selectedmodule_full}.${KV_OBJ})" 178 # and then stating any module parameters defined from the module
173 if [ -n "${modinfop}" ]; 179 if [ -n "${modinfop}" ];
174 then 180 then
175 echo >> ${module_config} 181 echo >> ${module_config}
176 echo "# Configurable module parameters" >> ${module_config} 182 echo "# Configurable module parameters" >> ${module_config}
177 echo "# ------------------------------" >> ${module_config} 183 echo "# ------------------------------" >> ${module_config}
188 echo -e "# ${parameter%%:*}:\t${parameter#*:}" >> ${module_config} 194 echo -e "# ${parameter%%:*}:\t${parameter#*:}" >> ${module_config}
189 done 195 done
190 IFS="${xifs}" 196 IFS="${xifs}"
191 fi 197 fi
192 198
199 # and any examples we can gather from them
193 if [ -n "${module_opts}" ]; 200 if [ -n "${module_opts}" ];
194 then 201 then
195 echo >> ${module_config} 202 echo >> ${module_config}
196 echo "# For Example..." >> ${module_config} 203 echo "# For Example..." >> ${module_config}
197 echo "# ------------------------------" >> ${module_config} 204 echo "# ------------------------------" >> ${module_config}
199 do 206 do
200 echo "# options ${selectedmodule_full/*\//} ${parameter//:*}=${parameter//*:}" >> ${module_config} 207 echo "# options ${selectedmodule_full/*\//} ${parameter//:*}=${parameter//*:}" >> ${module_config}
201 done 208 done
202 fi 209 fi
203 210
211 # then we install it
204 insinto /etc/modules.d 212 insinto /etc/modules.d
205 newins ${module_config} ${selectedmodule_full/*\//} 213 newins ${module_config} ${selectedmodule_full/*\//}
206 214
215 # and install any documentation we might have.
207 [ -n "${module_docs}" ] && dodoc ${module_docs} 216 [ -n "${module_docs}" ] && dodoc ${module_docs}
208 done 217 done
209 eend 0 218 eend 0
210} 219}
211 220
290 einfo "Installing ${modulename} module" 299 einfo "Installing ${modulename} module"
291 cd ${sourcedir} 300 cd ${sourcedir}
292 insinto /lib/modules/${KV_FULL}/${moduledir} 301 insinto /lib/modules/${KV_FULL}/${moduledir}
293 doins ${modulename}.${KV_OBJ} 302 doins ${modulename}.${KV_OBJ}
294 303
295 generate_modulesd ${sourcedir}/${modulename} 304 [ -z "${NO_MODULESD}" ] && generate_modulesd ${sourcedir}/${modulename}
296 done 305 done
297} 306}
298 307
299linux-mod_pkg_postinst() { 308linux-mod_pkg_postinst() {
300 update_depmod; 309 update_depmod;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20