Magellan Linux

Contents of /trunk/deprecated/udev/udev-182-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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