Contents of /branches/magellan-next/core/udev/udev-172-r1.smage2
Parent Directory | Revision Log
Revision 8414 -
(show annotations)
(download)
Mon Jul 18 17:19:45 2011 UTC (12 years, 10 months ago) by niro
File size: 8151 byte(s)
Mon Jul 18 17:19:45 2011 UTC (12 years, 10 months ago) by niro
File size: 8151 byte(s)
auto added: ver bump to 172-r1
1 | # $Id$ |
2 | |
3 | PNAME="udev" |
4 | PVER="172" |
5 | PBUILD="r1" |
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 | >= virtual/initscripts |
19 | >= dev-libs/glib2-2.28" |
20 | |
21 | SDEPEND=">= virtual/kernel-sources |
22 | >= dev-util/gperf-3.0.4" |
23 | |
24 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
25 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
26 | |
27 | CONFIG_SRCFILE="config-${PNAME}-${PVER}-${PBUILD}.tar.bz2" |
28 | CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-${PBUILD}" |
29 | |
30 | # global var: ${LINUX_SOURCES} |
31 | # location where they are |
32 | [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux" |
33 | |
34 | sminclude mtools multilib |
35 | |
36 | SRC_URI=( |
37 | http://www.kernel.org/pub/linux/utils/kernel/hotplug/${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 allowd 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 | --with-systemdsystemunitdir=/lib/systemd/system \ |
72 | || die |
73 | |
74 | mmake || die |
75 | } |
76 | |
77 | src_install() |
78 | { |
79 | mmake DESTDIR=${BINDIR} install || die |
80 | minstalldocs COPYING ChangeLog NEWS README TODO || die |
81 | |
82 | # install our config |
83 | cd ${CONFIG_SRCDIR} |
84 | make DESTDIR=${BINDIR} install || die |
85 | |
86 | # create symlinks for these utilities to /sbin |
87 | # where multipath-tools expect them to be |
88 | mlink ../lib/udev/scsi_id /sbin/ || die |
89 | |
90 | # mark some dirs undeletable |
91 | mkeepdir /etc/udev/rules.d || die |
92 | mkeepdir /lib/udev/state || die |
93 | mkeepdir /lib/udev/devices || die |
94 | mkeepdir /lib/udev/devices/net || die |
95 | mkeepdir /lib/udev/devices/pts || die |
96 | mkeepdir /lib/udev/devices/shm || die |
97 | mkeepdir /lib/udev/devices/hugepages || die |
98 | |
99 | # CONFIG_PROTECT_MASK for /etc/udev/rules.d |
100 | minstalldir /etc/env.d || die |
101 | echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die |
102 | |
103 | # create some nodes that we know we need |
104 | mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die |
105 | chmod 666 ${BINDIR}/lib/udev/devices/null || die |
106 | # hey, that's my birthday :) |
107 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die |
108 | |
109 | mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die |
110 | chmod 666 ${BINDIR}/lib/udev/devices/zero || die |
111 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die |
112 | |
113 | mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die |
114 | chmod 600 ${BINDIR}/lib/udev/devices/console || die |
115 | chown root:tty ${BINDIR}/lib/udev/devices/console || die |
116 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die |
117 | |
118 | mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die |
119 | chmod 666 ${BINDIR}/lib/udev/devices/urandom || die |
120 | touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die |
121 | } |
122 | |
123 | preinstall() |
124 | { |
125 | if [[ ! -z $(magequery -n hotplug) ]] |
126 | then |
127 | echo -e ${COLRED} |
128 | echo -e "Error: sys-apps/hotplug is installed!!" |
129 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." |
130 | echo -e "Please uninstall sys-apps/hotplug first!" |
131 | echo -e ${COLDEFAULT} |
132 | die "sys-apps/hotplug found!" |
133 | fi |
134 | |
135 | if [[ -d ${MROOT}/lib/udev-state ]] |
136 | then |
137 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/ |
138 | rm -r ${MROOT}/lib/udev-state |
139 | fi |
140 | |
141 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && |
142 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] |
143 | then |
144 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules |
145 | fi |
146 | |
147 | # delete the old udev.hotplug symlink if it is present |
148 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] |
149 | then |
150 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug |
151 | fi |
152 | |
153 | # delete the old wait_for_sysfs.hotplug symlink if it is present |
154 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] |
155 | then |
156 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug |
157 | fi |
158 | |
159 | # delete the old 10-udev.hotplug symlink if it is present |
160 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] |
161 | then |
162 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug |
163 | fi |
164 | |
165 | # delete the deprectated udev-late rc-script |
166 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late |
167 | |
168 | # delete obsolete hotplug.dev script |
169 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] |
170 | then |
171 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev |
172 | fi |
173 | |
174 | # delete deprecated pnp-aliases |
175 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] |
176 | then |
177 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases |
178 | fi |
179 | |
180 | # delete deprecated blacklist |
181 | if [[ -f ${MROOT}/etc/udev/blacklist ]] |
182 | then |
183 | rm -f ${MROOT}/etc/udev/blacklist |
184 | fi |
185 | |
186 | # delete all udev.rules which are moved from /etc/udev to /lib/udev |
187 | local rule |
188 | for rule in 40-arch-s390.rules \ |
189 | 61-persistent-storage-edd.rules \ |
190 | 75-persistent-net-generator.rules \ |
191 | 64-md-raid.rules \ |
192 | 65-permissions.rules \ |
193 | 64-device-mapper.rules \ |
194 | 40-alsa.rules \ |
195 | 40-zaptel.rules \ |
196 | 60-persistent-input.rules \ |
197 | 40-arch-ia64.rules \ |
198 | 05-udev-early.rules \ |
199 | 40-arch-ppc.rules \ |
200 | 60-cdrom_id.rules \ |
201 | 40-pilot-links.rules \ |
202 | 95-udev-late.rules \ |
203 | 40-magellan.rules \ |
204 | 50-udev-default.rules \ |
205 | 80-drivers.rules \ |
206 | 30-kernel-compat.rules \ |
207 | 40-video.rules \ |
208 | 60-persistent-storage-tape.rules \ |
209 | 75-cd-aliases-generator.rules \ |
210 | 60-persistent-storage.rules |
211 | do |
212 | # delete obsolete hotplug.dev script |
213 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] |
214 | then |
215 | rm -f ${MROOT}/etc/udev/rules.d/${rule} |
216 | fi |
217 | done |
218 | } |
219 | |
220 | postinstall() |
221 | { |
222 | # create some nodes that we need if they not exist |
223 | [[ ! -e ${MROOT}/lib/udev/devices/null ]] && |
224 | mknod ${MROOT}/lib/udev/devices/null c 1 3 |
225 | chmod 666 ${MROOT}/lib/udev/devices/null |
226 | touch -t 198002220222 ${MROOT}/lib/udev/devices/null |
227 | |
228 | [[ ! -e ${MROOT}/lib/udev/devices/zero ]] && |
229 | mknod ${MROOT}/lib/udev/devices/zero c 1 5 |
230 | chmod 666 ${MROOT}/lib/udev/devices/zero |
231 | touch -t 198002220222 ${MROOT}/lib/udev/devices/zero |
232 | |
233 | [[ ! -e ${MROOT}/lib/udev/devices/console ]] && |
234 | mknod ${MROOT}/lib/udev/devices/console c 5 1 |
235 | chmod 600 ${MROOT}/lib/udev/devices/console |
236 | chown root:tty ${MROOT}/lib/udev/devices/console |
237 | touch -t 198002220222 ${MROOT}/lib/udev/devices/console |
238 | |
239 | [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] && |
240 | mknod ${MROOT}/lib/udev/devices/urandom c 1 9 |
241 | chmod 666 ${MROOT}/lib/udev/devices/urandom |
242 | touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom |
243 | |
244 | [[ ! -d ${MROOT}/run ]] && install -d ${MROOT}/run |
245 | |
246 | # systemd |
247 | if [[ -x /bin/systemctl ]] |
248 | then |
249 | # reload config |
250 | systemctl daemon-reload |
251 | |
252 | # try to kill |
253 | if ! systemctl stop udev.service udev-control.socket udev-kernel.socket >/dev/null 2>&1 |
254 | then |
255 | # kill daemon if we are not in a chroot |
256 | if [[ /proc/1/exe ]] && [[ -d /proc/1/root ]] |
257 | then |
258 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
259 | then |
260 | udevadm control --exit 2>&1 |
261 | fi |
262 | fi |
263 | fi |
264 | # start the daemon |
265 | if ! systemctl start udev.service >/dev/null 2>&1 |
266 | then |
267 | # start daemon if we are not in a chroot |
268 | if [[ -f /proc/1/exe ]] && [[ -d /proc/1/root ]] |
269 | then |
270 | if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]] |
271 | then |
272 | /sbin/udevd --daemon |
273 | fi |
274 | fi |
275 | fi |
276 | |
277 | # sysV |
278 | else |
279 | # after install/uprade, udev *must* be reloaded if already running |
280 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && |
281 | [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
282 | then |
283 | echo "MROOT=/; restarting udev daemon ..." |
284 | killall -15 udevd &> /dev/null |
285 | sleep 1 |
286 | killall -9 udevd &> /dev/null |
287 | /sbin/udevd --daemon |
288 | fi |
289 | fi |
290 | } |