Contents of /branches/magellan-next/core/udev/udev-171-r1.smage2
Parent Directory | Revision Log
Revision 7599 -
(show annotations)
(download)
Fri May 27 14:05:26 2011 UTC (13 years, 4 months ago) by niro
File size: 7372 byte(s)
Fri May 27 14:05:26 2011 UTC (13 years, 4 months ago) by niro
File size: 7372 byte(s)
-multilib fix
1 | # $Id$ |
2 | |
3 | PNAME="udev" |
4 | PVER="171" |
5 | PBUILD="r1" |
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 | >= sys-apps/initscripts-0.5 |
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}-${PBUILD}.tar.bz2" |
29 | CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-${PBUILD}" |
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 | --with-systemdsystemunitdir=/lib/systemd/system \ |
77 | || die |
78 | |
79 | mmake || die |
80 | } |
81 | |
82 | src_install() |
83 | { |
84 | mmake DESTDIR=${BINDIR} install || die |
85 | minstalldocs COPYING ChangeLog NEWS README TODO || die |
86 | |
87 | # install our config |
88 | cd ${CONFIG_SRCDIR} |
89 | make DESTDIR=${BINDIR} install || die |
90 | |
91 | # create symlinks for these utilities to /sbin |
92 | # where multipath-tools expect them to be |
93 | mlink ../lib/udev/scsi_id /sbin/ || die |
94 | |
95 | # mark some dirs undeletable |
96 | mkeepdir /etc/udev/rules.d || die |
97 | mkeepdir /lib/udev/state || die |
98 | mkeepdir /lib/udev/devices || die |
99 | |
100 | # CONFIG_PROTECT_MASK for /etc/udev/rules.d |
101 | minstalldir /etc/env.d || die |
102 | echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die |
103 | |
104 | # create some nodes that we know we need |
105 | mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die |
106 | chmod 666 ${BINDIR}/lib/udev/devices/null || die |
107 | # hey, that's my birthday :) |
108 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die |
109 | |
110 | mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die |
111 | chmod 666 ${BINDIR}/lib/udev/devices/zero || die |
112 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die |
113 | |
114 | mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die |
115 | chmod 600 ${BINDIR}/lib/udev/devices/console || die |
116 | chown root:tty ${BINDIR}/lib/udev/devices/console || die |
117 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die |
118 | |
119 | mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die |
120 | chmod 666 ${BINDIR}/lib/udev/devices/urandom || die |
121 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die |
122 | } |
123 | |
124 | preinstall() |
125 | { |
126 | if [[ ! -z $(magequery -n hotplug) ]] |
127 | then |
128 | echo -e ${COLRED} |
129 | echo -e "Error: sys-apps/hotplug is installed!!" |
130 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." |
131 | echo -e "Please uninstall sys-apps/hotplug first!" |
132 | echo -e ${COLDEFAULT} |
133 | die "sys-apps/hotplug found!" |
134 | fi |
135 | |
136 | if [[ -d ${MROOT}/lib/udev-state ]] |
137 | then |
138 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/ |
139 | rm -r ${MROOT}/lib/udev-state |
140 | fi |
141 | |
142 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && |
143 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] |
144 | then |
145 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules |
146 | fi |
147 | |
148 | # delete the old udev.hotplug symlink if it is present |
149 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] |
150 | then |
151 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug |
152 | fi |
153 | |
154 | # delete the old wait_for_sysfs.hotplug symlink if it is present |
155 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] |
156 | then |
157 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug |
158 | fi |
159 | |
160 | # delete the old 10-udev.hotplug symlink if it is present |
161 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] |
162 | then |
163 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug |
164 | fi |
165 | |
166 | # delete the deprectated udev-late rc-script |
167 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late |
168 | |
169 | # delete obsolete hotplug.dev script |
170 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] |
171 | then |
172 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev |
173 | fi |
174 | |
175 | # delete deprecated pnp-aliases |
176 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] |
177 | then |
178 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases |
179 | fi |
180 | |
181 | # delete all udev.rules which are moved from /etc/udev to /lib/udev |
182 | local rule |
183 | for rule in 40-arch-s390.rules \ |
184 | 61-persistent-storage-edd.rules \ |
185 | 75-persistent-net-generator.rules \ |
186 | 64-md-raid.rules \ |
187 | 65-permissions.rules \ |
188 | 64-device-mapper.rules \ |
189 | 40-alsa.rules \ |
190 | 40-zaptel.rules \ |
191 | 60-persistent-input.rules \ |
192 | 40-arch-ia64.rules \ |
193 | 05-udev-early.rules \ |
194 | 40-arch-ppc.rules \ |
195 | 60-cdrom_id.rules \ |
196 | 40-pilot-links.rules \ |
197 | 95-udev-late.rules \ |
198 | 40-magellan.rules \ |
199 | 50-udev-default.rules \ |
200 | 80-drivers.rules \ |
201 | 30-kernel-compat.rules \ |
202 | 40-video.rules \ |
203 | 60-persistent-storage-tape.rules \ |
204 | 75-cd-aliases-generator.rules \ |
205 | 60-persistent-storage.rules |
206 | do |
207 | # delete obsolete hotplug.dev script |
208 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] |
209 | then |
210 | rm -f ${MROOT}/etc/udev/rules.d/${rule} |
211 | fi |
212 | done |
213 | } |
214 | |
215 | postinstall() |
216 | { |
217 | # create some nodes that we need if they not exist |
218 | [[ ! -e ${MROOT}/lib/udev/devices/null ]] && |
219 | mknod ${MROOT}/lib/udev/devices/null c 1 3 |
220 | chmod 666 ${MROOT}/lib/udev/devices/null |
221 | touch -t 198002220222 ${MROOT}/lib/udev/devices/null |
222 | |
223 | [[ ! -e ${MROOT}/lib/udev/devices/zero ]] && |
224 | mknod ${MROOT}/lib/udev/devices/zero c 1 5 |
225 | chmod 666 ${MROOT}/lib/udev/devices/zero |
226 | touch -t 198002220222 ${MROOT}/lib/udev/devices/zero |
227 | |
228 | [[ ! -e ${MROOT}/lib/udev/devices/console ]] && |
229 | mknod ${MROOT}/lib/udev/devices/console c 5 1 |
230 | chmod 600 ${MROOT}/lib/udev/devices/console |
231 | chown root:tty ${MROOT}/lib/udev/devices/console |
232 | touch -t 198002220222 ${MROOT}/lib/udev/devices/console |
233 | |
234 | [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] && |
235 | mknod ${MROOT}/lib/udev/devices/urandom c 1 9 |
236 | chmod 666 ${MROOT}/lib/udev/devices/urandom |
237 | touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom |
238 | |
239 | # after install/uprade, udev *must* be reloaded if already running |
240 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && |
241 | [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
242 | then |
243 | echo "MROOT=/; restarting udev daemon ..." |
244 | killall -15 udevd &> /dev/null |
245 | sleep 1 |
246 | killall -9 udevd &> /dev/null |
247 | /sbin/udevd --daemon |
248 | fi |
249 | } |