Annotation of /smage/trunk/core/udev/udev-175-r1.smage2
Parent Directory | Revision Log
Revision 1980 -
(hide annotations)
(download)
Wed Nov 9 17:04:56 2011 UTC (12 years, 6 months ago) by niro
File size: 7602 byte(s)
Wed Nov 9 17:04:56 2011 UTC (12 years, 6 months ago) by niro
File size: 7602 byte(s)
auto added: ver bump to 175-r1
1 | niro | 1980 | # $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 | >= sys-apps/util-linux-2.20 | ||
14 | >= virtual/initscripts" | ||
15 | |||
16 | SDEPEND=">= virtual/kernel-sources | ||
17 | >= dev-util/gperf-3" | ||
18 | |||
19 | PROVIDE="virtual/devmanager" | ||
20 | |||
21 | SRCFILE="${PNAME}-${PVER}.tar.bz2" | ||
22 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" | ||
23 | |||
24 | CONFIG_SRCFILE="config-${PNAME}-173-r2.tar.bz2" | ||
25 | CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-173-r2" | ||
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/udev $(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 | http://people.freedesktop.org/~kay/${PNAME}/${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 | --disable-extras \ | ||
68 | --with-systemdsystemunitdir=/lib/systemd/system \ | ||
69 | --disable-hwdb \ | ||
70 | --disable-gudev \ | ||
71 | --disable-keymap \ | ||
72 | || die | ||
73 | |||
74 | mmake || die | ||
75 | } | ||
76 | |||
77 | mcore_generic_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 | # sysvinit support | ||
86 | make DESTDIR=${BINDIR} install-sysvinit || die | ||
87 | # writerootlink | ||
88 | make DESTDIR=${BINDIR} install-writerootlink || die | ||
89 | |||
90 | # create symlinks for these utilities to /sbin | ||
91 | # where multipath-tools expect them to be | ||
92 | mlink ../lib/udev/scsi_id /sbin/ || die | ||
93 | |||
94 | # mark some dirs undeletable | ||
95 | mkeepdir /etc/udev/rules.d || die | ||
96 | mkeepdir /lib/udev/state || die | ||
97 | mkeepdir /lib/udev/devices || 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 | add_conf_prot_mask /etc/udev /etc/env.d /etc/rc.d/init.d /etc/modprobe.d | ||
126 | |||
127 | if [[ ! -z $(magequery -n hotplug) ]] | ||
128 | then | ||
129 | echo -e ${COLRED} | ||
130 | echo -e "Error: sys-apps/hotplug is installed!!" | ||
131 | echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore." | ||
132 | echo -e "Please uninstall sys-apps/hotplug first!" | ||
133 | echo -e ${COLDEFAULT} | ||
134 | die "sys-apps/hotplug found!" | ||
135 | fi | ||
136 | |||
137 | if [[ -d ${MROOT}/lib/udev-state ]] | ||
138 | then | ||
139 | mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/ | ||
140 | rm -r ${MROOT}/lib/udev-state | ||
141 | fi | ||
142 | |||
143 | if [[ -f ${MROOT}/etc/udev/udev.config ]] && | ||
144 | [[ ! -f ${MROOT}/etc/udev/udev.rules ]] | ||
145 | then | ||
146 | mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules | ||
147 | fi | ||
148 | |||
149 | # delete the old udev.hotplug symlink if it is present | ||
150 | if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]] | ||
151 | then | ||
152 | rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug | ||
153 | fi | ||
154 | |||
155 | # delete the old wait_for_sysfs.hotplug symlink if it is present | ||
156 | if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]] | ||
157 | then | ||
158 | rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug | ||
159 | fi | ||
160 | |||
161 | # delete the old 10-udev.hotplug symlink if it is present | ||
162 | if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]] | ||
163 | then | ||
164 | rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug | ||
165 | fi | ||
166 | |||
167 | # delete the deprectated udev-late rc-script | ||
168 | [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late | ||
169 | |||
170 | # delete obsolete hotplug.dev script | ||
171 | if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]] | ||
172 | then | ||
173 | rm -f ${MROOT}/etc/dev.d/net/hotplug.dev | ||
174 | fi | ||
175 | |||
176 | # delete deprecated pnp-aliases | ||
177 | if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]] | ||
178 | then | ||
179 | rm -f ${MROOT}/etc/modprobe.d/pnp-aliases | ||
180 | fi | ||
181 | |||
182 | # delete all udev.rules which are moved from /etc/udev to /lib/udev | ||
183 | local rule | ||
184 | for rule in 40-arch-s390.rules \ | ||
185 | 61-persistent-storage-edd.rules \ | ||
186 | 75-persistent-net-generator.rules \ | ||
187 | 64-md-raid.rules \ | ||
188 | 65-permissions.rules \ | ||
189 | 64-device-mapper.rules \ | ||
190 | 40-alsa.rules \ | ||
191 | 40-zaptel.rules \ | ||
192 | 60-persistent-input.rules \ | ||
193 | 40-arch-ia64.rules \ | ||
194 | 05-udev-early.rules \ | ||
195 | 40-arch-ppc.rules \ | ||
196 | 60-cdrom_id.rules \ | ||
197 | 40-pilot-links.rules \ | ||
198 | 95-udev-late.rules \ | ||
199 | 40-magellan.rules \ | ||
200 | 50-udev-default.rules \ | ||
201 | 80-drivers.rules \ | ||
202 | 30-kernel-compat.rules \ | ||
203 | 40-video.rules \ | ||
204 | 60-persistent-storage-tape.rules \ | ||
205 | 75-cd-aliases-generator.rules \ | ||
206 | 60-persistent-storage.rules | ||
207 | do | ||
208 | # delete obsolete hotplug.dev script | ||
209 | if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]] | ||
210 | then | ||
211 | rm -f ${MROOT}/etc/udev/rules.d/${rule} | ||
212 | fi | ||
213 | done | ||
214 | } | ||
215 | |||
216 | postinstall() | ||
217 | { | ||
218 | # create some nodes that we need if they not exist | ||
219 | [[ ! -e ${MROOT}/lib/udev/devices/null ]] && | ||
220 | mknod ${MROOT}/lib/udev/devices/null c 1 3 | ||
221 | chmod 666 ${MROOT}/lib/udev/devices/null | ||
222 | touch -t 198002220222 ${MROOT}/lib/udev/devices/null | ||
223 | |||
224 | [[ ! -e ${MROOT}/lib/udev/devices/zero ]] && | ||
225 | mknod ${MROOT}/lib/udev/devices/zero c 1 5 | ||
226 | chmod 666 ${MROOT}/lib/udev/devices/zero | ||
227 | touch -t 198002220222 ${MROOT}/lib/udev/devices/zero | ||
228 | |||
229 | [[ ! -e ${MROOT}/lib/udev/devices/console ]] && | ||
230 | mknod ${MROOT}/lib/udev/devices/console c 5 1 | ||
231 | chmod 600 ${MROOT}/lib/udev/devices/console | ||
232 | chown root:tty ${MROOT}/lib/udev/devices/console | ||
233 | touch -t 198002220222 ${MROOT}/lib/udev/devices/console | ||
234 | |||
235 | [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] && | ||
236 | mknod ${MROOT}/lib/udev/devices/urandom c 1 9 | ||
237 | chmod 666 ${MROOT}/lib/udev/devices/urandom | ||
238 | touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom | ||
239 | |||
240 | # after install/uprade, udev *must* be reloaded if already running | ||
241 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && | ||
242 | [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]] | ||
243 | then | ||
244 | echo "MROOT=/; restarting udev daemon ..." | ||
245 | killall -15 udevd &> /dev/null | ||
246 | sleep 1 | ||
247 | killall -9 udevd &> /dev/null | ||
248 | /sbin/udevd --daemon | ||
249 | fi | ||
250 | |||
251 | # set udev to the default devicemanager | ||
252 | sed -i 's:^\(RC_DEVICEMANAGER=\).*:\1udev:' /etc/conf.d/kernel | ||
253 | } | ||
254 | |||
255 | postremove() | ||
256 | { | ||
257 | if [[ -x /sbin/mdev ]] && [[ ! -x /sbin/udevd ]] | ||
258 | then | ||
259 | # restore mdev as default devicemanager | ||
260 | sed -i 's:^\(RC_DEVICEMANAGER=\).*:\1mdev:' /etc/conf.d/kernel | ||
261 | fi | ||
262 | } |