Magellan Linux

Contents of /branches/magellan-next/core/udev/udev-171-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7935 - (show annotations) (download)
Sat Jun 4 16:49:21 2011 UTC (12 years, 10 months ago) by niro
File size: 8179 byte(s)
-typo
1 # $Id$
2
3 PNAME="udev"
4 PVER="171"
5 PBUILD="r4"
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-0.86
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 mirror://${PNAME}/${PNAME}-${PVER}-static-audio-nodes-permissions-2.patch
41 )
42
43 UP2DATE="updatecmd http://www.kernel.org/pub/linux/utils/kernel/hotplug | grep ${PNAME}- | lasttarball"
44
45 src_prepare()
46 {
47 munpack ${SRCFILE} || die
48 oldmunpack ${CONFIG_SRCFILE} || die
49 mpatch ${PNAME}-${PVER}-static-audio-nodes-permissions-2.patch || die
50 }
51
52 src_compile()
53 {
54 # using /lib/udev as libexecdir also on multilib systems
55 # to have one common rules/script directory!
56 # same with the systemd units dir!
57 #
58 # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units
59 # variables are not allowd in the beginning of ExecStart
60 # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50
61 mconfigure \
62 --exec-prefix= \
63 --bindir=/bin \
64 --sbindir=/sbin \
65 --with-libdir-name='$(mlibdir)' \
66 --libexecdir=/lib/udev \
67 --enable-logging \
68 --without-selinux \
69 --disable-introspection \
70 --enable-edd \
71 --enable-floppy \
72 --enable-action_modeswitch \
73 --with-systemdsystemunitdir=/lib/systemd/system \
74 || die
75
76 mmake || die
77 }
78
79 src_install()
80 {
81 mmake DESTDIR=${BINDIR} install || die
82 minstalldocs COPYING ChangeLog NEWS README TODO || die
83
84 # install our config
85 cd ${CONFIG_SRCDIR}
86 make DESTDIR=${BINDIR} install || die
87
88 # create symlinks for these utilities to /sbin
89 # where multipath-tools expect them to be
90 mlink ../lib/udev/scsi_id /sbin/ || die
91
92 # mark some dirs undeletable
93 mkeepdir /etc/udev/rules.d || die
94 mkeepdir /lib/udev/state || die
95 mkeepdir /lib/udev/devices || die
96 mkeepdir /lib/udev/devices/net || die
97 mkeepdir /lib/udev/devices/pts || die
98 mkeepdir /lib/udev/devices/shm || die
99 mkeepdir /lib/udev/devices/hugepages || die
100
101 # CONFIG_PROTECT_MASK for /etc/udev/rules.d
102 minstalldir /etc/env.d || die
103 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die
104
105 # create some nodes that we know we need
106 mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die
107 chmod 666 ${BINDIR}/lib/udev/devices/null || die
108 # hey, that's my birthday :)
109 touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die
110
111 mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die
112 chmod 666 ${BINDIR}/lib/udev/devices/zero || die
113 touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die
114
115 mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die
116 chmod 600 ${BINDIR}/lib/udev/devices/console || die
117 chown root:tty ${BINDIR}/lib/udev/devices/console || die
118 touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die
119
120 mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die
121 chmod 666 ${BINDIR}/lib/udev/devices/urandom || die
122 touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die
123 }
124
125 preinstall()
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 [[ ! -d ${MROOT}/run ]] && install -d ${MROOT}/run
241
242 # systemd
243 if [[ -x /bin/systemctl ]]
244 then
245 # reload config
246 systemctl daemon-reload
247
248 # try to kill
249 if ! systemctl stop udev.service udev-control.socket udev-kernel.socket >/dev/null 2>&1
250 then
251 # kill daemon if we are not in a chroot
252 if [[ /proc/1/exe ]] && [[ -d /proc/1/root ]]
253 then
254 if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]]
255 then
256 udevadm control --exit 2>&1
257 fi
258 fi
259 fi
260 # start the daemon
261 if ! systemctl start udev.service >/dev/null 2>&1
262 then
263 # start daemon if we are not in a chroot
264 if [[ -f /proc/1/exe ]] && [[ -d /proc/1/root ]]
265 then
266 if [[ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ]]
267 then
268 /sbin/udevd --daemon
269 fi
270 fi
271 fi
272
273 # sysV
274 else
275 # after install/uprade, udev *must* be reloaded if already running
276 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] &&
277 [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
278 then
279 echo "MROOT=/; restarting udev daemon ..."
280 killall -15 udevd &> /dev/null
281 sleep 1
282 killall -9 udevd &> /dev/null
283 /sbin/udevd --daemon
284 fi
285 fi
286 }