Magellan Linux

Contents of /smage/branches/alx-0_6_0/core/udev/udev-166-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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