Magellan Linux

Contents of /branches/magellan-next/core/udev/udev-171-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7916 - (show annotations) (download)
Sat Jun 4 00:08:03 2011 UTC (12 years, 11 months ago) by niro
File size: 7421 byte(s)
-missed edd floppy and action_modeswitch
1 # $Id$
2
3 PNAME="udev"
4 PVER="171"
5 PBUILD="r2"
6
7 PCATEGORIE="sys-fs"
8 STATE="unstable"
9
10 DESCRIPTION="A Userspace Implementation for dynamic /dev nodes."
11 HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
12
13 DEPEND=">= virtual/glibc
14 >= dev-libs/libusb-compat-0.1.3
15 >= sys-apps/util-linux-2.19
16 >= sys-apps/acl-2.2
17 >= sys-apps/usbutils-0.86
18 >= sys-apps/pciutils-3.1
19 >= virtual/initscripts
20 >= dev-libs/glib2-2.28"
21
22 SDEPEND=">= virtual/kernel-sources
23 >= dev-util/gperf-3.0.4"
24
25 SRCFILE="${PNAME}-${PVER}.tar.bz2"
26 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
27
28 CONFIG_SRCFILE="config-${PNAME}-${PVER}-r1.tar.bz2"
29 CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-r1"
30
31 # global var: ${LINUX_SOURCES}
32 # location where they are
33 [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux"
34
35 sminclude mtools multilib
36
37 SRC_URI=(
38 http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE}
39 mirror://${PNAME}/${SRCFILE}
40 mirror://${PNAME}/${CONFIG_SRCFILE}
41 mirror://${PNAME}/${PNAME}-${PVER}-static-audio-nodes-permissions.patch
42 )
43
44 UP2DATE="updatecmd http://www.kernel.org/pub/linux/utils/kernel/hotplug | grep ${PNAME}- | lasttarball"
45
46 src_prepare()
47 {
48 munpack ${SRCFILE} || die
49 oldmunpack ${CONFIG_SRCFILE} || die
50
51 # apply 'audio' group of the static snd/{seq,timer} nodes
52 # a hotfix which gets included in udev-172
53 #see: http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;h=3e227830ad6494700e18ae03297e8fb833ff26bf
54 cd ${CONFIG_SRCDIR}
55 oldmpatch ${PNAME}-${PVER}-static-audio-nodes-permissions.patch || die
56 }
57
58 src_compile()
59 {
60 # using /lib/udev as libexecdir also on multilib systems
61 # to have one common rules/script directory!
62 # same with the systemd units dir!
63 #
64 # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units
65 # variables are not allowd in the beginning of ExecStart
66 # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50
67 mconfigure \
68 --exec-prefix= \
69 --bindir=/bin \
70 --sbindir=/sbin \
71 --with-libdir-name='$(mlibdir)' \
72 --libexecdir=/lib/udev \
73 --enable-logging \
74 --without-selinux \
75 --disable-introspection \
76 --enable-edd \
77 --enable-floppy \
78 --enable-action_modeswitch \
79 --with-systemdsystemunitdir=/lib/systemd/system \
80 || die
81
82 mmake || die
83 }
84
85 src_install()
86 {
87 mmake DESTDIR=${BINDIR} install || die
88 minstalldocs COPYING ChangeLog NEWS README TODO || die
89
90 # install our config
91 cd ${CONFIG_SRCDIR}
92 make DESTDIR=${BINDIR} install || die
93
94 # create symlinks for these utilities to /sbin
95 # where multipath-tools expect them to be
96 mlink ../lib/udev/scsi_id /sbin/ || die
97
98 # mark some dirs undeletable
99 mkeepdir /etc/udev/rules.d || die
100 mkeepdir /lib/udev/state || die
101 mkeepdir /lib/udev/devices || die
102
103 # CONFIG_PROTECT_MASK for /etc/udev/rules.d
104 minstalldir /etc/env.d || die
105 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die
106
107 # create some nodes that we know we need
108 mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die
109 chmod 666 ${BINDIR}/lib/udev/devices/null || die
110 # hey, that's my birthday :)
111 touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die
112
113 mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die
114 chmod 666 ${BINDIR}/lib/udev/devices/zero || die
115 touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die
116
117 mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die
118 chmod 600 ${BINDIR}/lib/udev/devices/console || die
119 chown root:tty ${BINDIR}/lib/udev/devices/console || die
120 touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die
121
122 mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die
123 chmod 666 ${BINDIR}/lib/udev/devices/urandom || die
124 touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die
125 }
126
127 preinstall()
128 {
129 if [[ ! -z $(magequery -n hotplug) ]]
130 then
131 echo -e ${COLRED}
132 echo -e "Error: sys-apps/hotplug is installed!!"
133 echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore."
134 echo -e "Please uninstall sys-apps/hotplug first!"
135 echo -e ${COLDEFAULT}
136 die "sys-apps/hotplug found!"
137 fi
138
139 if [[ -d ${MROOT}/lib/udev-state ]]
140 then
141 mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/
142 rm -r ${MROOT}/lib/udev-state
143 fi
144
145 if [[ -f ${MROOT}/etc/udev/udev.config ]] &&
146 [[ ! -f ${MROOT}/etc/udev/udev.rules ]]
147 then
148 mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules
149 fi
150
151 # delete the old udev.hotplug symlink if it is present
152 if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]]
153 then
154 rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug
155 fi
156
157 # delete the old wait_for_sysfs.hotplug symlink if it is present
158 if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]]
159 then
160 rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
161 fi
162
163 # delete the old 10-udev.hotplug symlink if it is present
164 if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]]
165 then
166 rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug
167 fi
168
169 # delete the deprectated udev-late rc-script
170 [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late
171
172 # delete obsolete hotplug.dev script
173 if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]]
174 then
175 rm -f ${MROOT}/etc/dev.d/net/hotplug.dev
176 fi
177
178 # delete deprecated pnp-aliases
179 if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]]
180 then
181 rm -f ${MROOT}/etc/modprobe.d/pnp-aliases
182 fi
183
184 # delete all udev.rules which are moved from /etc/udev to /lib/udev
185 local rule
186 for rule in 40-arch-s390.rules \
187 61-persistent-storage-edd.rules \
188 75-persistent-net-generator.rules \
189 64-md-raid.rules \
190 65-permissions.rules \
191 64-device-mapper.rules \
192 40-alsa.rules \
193 40-zaptel.rules \
194 60-persistent-input.rules \
195 40-arch-ia64.rules \
196 05-udev-early.rules \
197 40-arch-ppc.rules \
198 60-cdrom_id.rules \
199 40-pilot-links.rules \
200 95-udev-late.rules \
201 40-magellan.rules \
202 50-udev-default.rules \
203 80-drivers.rules \
204 30-kernel-compat.rules \
205 40-video.rules \
206 60-persistent-storage-tape.rules \
207 75-cd-aliases-generator.rules \
208 60-persistent-storage.rules
209 do
210 # delete obsolete hotplug.dev script
211 if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]]
212 then
213 rm -f ${MROOT}/etc/udev/rules.d/${rule}
214 fi
215 done
216 }
217
218 postinstall()
219 {
220 # create some nodes that we need if they not exist
221 [[ ! -e ${MROOT}/lib/udev/devices/null ]] &&
222 mknod ${MROOT}/lib/udev/devices/null c 1 3
223 chmod 666 ${MROOT}/lib/udev/devices/null
224 touch -t 198002220222 ${MROOT}/lib/udev/devices/null
225
226 [[ ! -e ${MROOT}/lib/udev/devices/zero ]] &&
227 mknod ${MROOT}/lib/udev/devices/zero c 1 5
228 chmod 666 ${MROOT}/lib/udev/devices/zero
229 touch -t 198002220222 ${MROOT}/lib/udev/devices/zero
230
231 [[ ! -e ${MROOT}/lib/udev/devices/console ]] &&
232 mknod ${MROOT}/lib/udev/devices/console c 5 1
233 chmod 600 ${MROOT}/lib/udev/devices/console
234 chown root:tty ${MROOT}/lib/udev/devices/console
235 touch -t 198002220222 ${MROOT}/lib/udev/devices/console
236
237 [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] &&
238 mknod ${MROOT}/lib/udev/devices/urandom c 1 9
239 chmod 666 ${MROOT}/lib/udev/devices/urandom
240 touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom
241
242 # after install/uprade, udev *must* be reloaded if already running
243 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] &&
244 [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
245 then
246 echo "MROOT=/; restarting udev daemon ..."
247 killall -15 udevd &> /dev/null
248 sleep 1
249 killall -9 udevd &> /dev/null
250 /sbin/udevd --daemon
251 fi
252 }