Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2971 - (show annotations) (download)
Wed Sep 7 15:55:24 2011 UTC (12 years, 9 months ago) by niro
File size: 7445 byte(s)
-use r2 configuration
1 # $Id$
2
3 PNAME="udev"
4 PVER="173"
5 PBUILD="r2"
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}-${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 ALX_ONLY_KEEP="etc lib/udev $(mlibdir) sbin usr/$(mlibdir)/*.so usr/$(mlibdir)/*.so.*"
32 sminclude mtools multilib alx-split
33
34 SRC_URI=(
35 http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE}
36 http://ftp.portlane.com/pub/linux/utils/kernel/hotplug/${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 || die
72
73 mmake || die
74 }
75
76 alx_generic_src_install()
77 {
78 mmake DESTDIR=${BINDIR} install || die
79 minstalldocs COPYING ChangeLog NEWS README TODO || die
80
81 # install our config
82 cd ${CONFIG_SRCDIR}
83 make DESTDIR=${BINDIR} install || die
84 # sysvinit support
85 make DESTDIR=${BINDIR} install-sysvinit || die
86 # writerootlink
87 make DESTDIR=${BINDIR} install-writerootlink || die
88
89 # create symlinks for these utilities to /sbin
90 # where multipath-tools expect them to be
91 mlink ../lib/udev/scsi_id /sbin/ || die
92
93 # mark some dirs undeletable
94 mkeepdir /etc/udev/rules.d || die
95 mkeepdir /lib/udev/state || die
96 mkeepdir /lib/udev/devices || die
97
98 # CONFIG_PROTECT_MASK for /etc/udev/rules.d
99 minstalldir /etc/env.d || die
100 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die
101
102 # create some nodes that we know we need
103 mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die
104 chmod 666 ${BINDIR}/lib/udev/devices/null || die
105 # hey, that's my birthday :)
106 touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die
107
108 mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die
109 chmod 666 ${BINDIR}/lib/udev/devices/zero || die
110 touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die
111
112 mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die
113 chmod 600 ${BINDIR}/lib/udev/devices/console || die
114 chown root:tty ${BINDIR}/lib/udev/devices/console || die
115 touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die
116
117 mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die
118 chmod 666 ${BINDIR}/lib/udev/devices/urandom || die
119 touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die
120 }
121
122 preinstall()
123 {
124 add_conf_prot_mask /etc/udev /etc/env.d /etc/rc.d/init.d /etc/modprobe.d
125
126 if [[ ! -z $(magequery -n hotplug) ]]
127 then
128 echo -e ${COLRED}
129 echo -e "Error: sys-apps/hotplug is installed!!"
130 echo -e "hotplug is now fully provided by udev itself and it is not recommend to use this anymore."
131 echo -e "Please uninstall sys-apps/hotplug first!"
132 echo -e ${COLDEFAULT}
133 die "sys-apps/hotplug found!"
134 fi
135
136 if [[ -d ${MROOT}/lib/udev-state ]]
137 then
138 mv -f ${MROOT}/lib/udev-state/* ${MROOT}/lib/udev/state/
139 rm -r ${MROOT}/lib/udev-state
140 fi
141
142 if [[ -f ${MROOT}/etc/udev/udev.config ]] &&
143 [[ ! -f ${MROOT}/etc/udev/udev.rules ]]
144 then
145 mv -f ${MROOT}/etc/udev/udev.config ${MROOT}/etc/udev/udev.rules
146 fi
147
148 # delete the old udev.hotplug symlink if it is present
149 if [[ -h ${MROOT}/etc/hotplug.d/default/udev.hotplug ]]
150 then
151 rm -f ${MROOT}/etc/hotplug.d/default/udev.hotplug
152 fi
153
154 # delete the old wait_for_sysfs.hotplug symlink if it is present
155 if [[ -h ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]]
156 then
157 rm -f ${MROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
158 fi
159
160 # delete the old 10-udev.hotplug symlink if it is present
161 if [[ -h ${MROOT}/etc/hotplug.d/default/10-udev.hotplug ]]
162 then
163 rm -f ${MROOT}/etc/hotplug.d/default/10-udev.hotplug
164 fi
165
166 # delete the deprectated udev-late rc-script
167 [[ -x ${MROOT}/sbin/rc-config ]] && ${MROOT}/sbin/rc-config del udev-late
168
169 # delete obsolete hotplug.dev script
170 if [[ -f ${MROOT}/etc/dev.d/net/hotplug.dev ]]
171 then
172 rm -f ${MROOT}/etc/dev.d/net/hotplug.dev
173 fi
174
175 # delete deprecated pnp-aliases
176 if [[ -f ${MROOT}/etc/modprobe.d/pnp-aliases ]]
177 then
178 rm -f ${MROOT}/etc/modprobe.d/pnp-aliases
179 fi
180
181 # delete all udev.rules which are moved from /etc/udev to /lib/udev
182 local rule
183 for rule in 40-arch-s390.rules \
184 61-persistent-storage-edd.rules \
185 75-persistent-net-generator.rules \
186 64-md-raid.rules \
187 65-permissions.rules \
188 64-device-mapper.rules \
189 40-alsa.rules \
190 40-zaptel.rules \
191 60-persistent-input.rules \
192 40-arch-ia64.rules \
193 05-udev-early.rules \
194 40-arch-ppc.rules \
195 60-cdrom_id.rules \
196 40-pilot-links.rules \
197 95-udev-late.rules \
198 40-magellan.rules \
199 50-udev-default.rules \
200 80-drivers.rules \
201 30-kernel-compat.rules \
202 40-video.rules \
203 60-persistent-storage-tape.rules \
204 75-cd-aliases-generator.rules \
205 60-persistent-storage.rules
206 do
207 # delete obsolete hotplug.dev script
208 if [[ -f ${MROOT}/etc/udev/rules.d/${rule} ]]
209 then
210 rm -f ${MROOT}/etc/udev/rules.d/${rule}
211 fi
212 done
213 }
214
215 postinstall()
216 {
217 # create some nodes that we need if they not exist
218 [[ ! -e ${MROOT}/lib/udev/devices/null ]] &&
219 mknod ${MROOT}/lib/udev/devices/null c 1 3
220 chmod 666 ${MROOT}/lib/udev/devices/null
221 touch -t 198002220222 ${MROOT}/lib/udev/devices/null
222
223 [[ ! -e ${MROOT}/lib/udev/devices/zero ]] &&
224 mknod ${MROOT}/lib/udev/devices/zero c 1 5
225 chmod 666 ${MROOT}/lib/udev/devices/zero
226 touch -t 198002220222 ${MROOT}/lib/udev/devices/zero
227
228 [[ ! -e ${MROOT}/lib/udev/devices/console ]] &&
229 mknod ${MROOT}/lib/udev/devices/console c 5 1
230 chmod 600 ${MROOT}/lib/udev/devices/console
231 chown root:tty ${MROOT}/lib/udev/devices/console
232 touch -t 198002220222 ${MROOT}/lib/udev/devices/console
233
234 [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] &&
235 mknod ${MROOT}/lib/udev/devices/urandom c 1 9
236 chmod 666 ${MROOT}/lib/udev/devices/urandom
237 touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom
238
239 # after install/uprade, udev *must* be reloaded if already running
240 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] &&
241 [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
242 then
243 echo "MROOT=/; restarting udev daemon ..."
244 killall -15 udevd &> /dev/null
245 sleep 1
246 killall -9 udevd &> /dev/null
247 /sbin/udevd --daemon
248 fi
249
250 # converting databases
251 echo "MROOT=/; converting udev database ..."
252 /sbin/udevadm info --convert-db
253
254 alx-split_postinstall
255 }