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