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