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