Magellan Linux

Contents of /smage/trunk/core/udev/udev-173-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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