Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5571 - (show annotations) (download)
Tue Apr 22 10:45:10 2014 UTC (10 years, 1 month ago) by niro
File size: 7803 byte(s)
-store persistent device rules like network devices when rootfs was still ro
1 # $Id$
2
3 PNAME="udev"
4 PVER="166"
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 >= 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}-r2.tar.bz2"
24 CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-r2"
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 mirror://${PNAME}/${PNAME}-${PVER}-r2-alx-rename-ipw2x00-to-wlan0.patch
39 mirror://${PNAME}/${PNAME}-${PVER}-r2-store-persistent-rules.patch
40 )
41
42 UP2DATE="updatecmd http://www.kernel.org/pub/linux/utils/kernel/hotplug | grep ${PNAME}- | lasttarball"
43
44 src_prepare()
45 {
46 munpack ${SRCFILE} || die
47 oldmunpack ${CONFIG_SRCFILE} || die
48
49 # rename ipw2x00 added devices to wlan0 to be compatible to our web-frontend
50 cd ${CONFIG_SRCDIR}
51 oldmpatch ${PNAME}-${PVER}-r2-alx-rename-ipw2x00-to-wlan0.patch || die
52
53 # store persitent udev rules like network devices that got created while booting when rootfs was still ro
54 oldmpatch ${PNAME}-${PVER}-r2-store-persistent-rules.patch || die
55 }
56
57 src_compile()
58 {
59 # using /lib/udev as libexecdir also on multilib systems
60 # to have one common rules/script directory!
61 # same with the systemd units dir!
62 #
63 # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units
64 # variables are not allowd in the beginning of ExecStart
65 # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50
66 mconfigure \
67 --exec-prefix= \
68 --bindir=/bin \
69 --sbindir=/sbin \
70 --with-libdir-name='$(mlibdir)' \
71 --libexecdir=/lib/udev \
72 --enable-logging \
73 --without-selinux \
74 --disable-introspection \
75 --disable-extras \
76 --with-systemdsystemunitdir=/lib/systemd/system \
77 || die
78
79 mmake || die
80 }
81
82 alx_generic_src_install()
83 {
84 mmake DESTDIR=${BINDIR} install || die
85 minstalldocs COPYING ChangeLog NEWS README TODO || die
86
87 # install our config
88 cd ${CONFIG_SRCDIR}
89 make DESTDIR=${BINDIR} install-basic-files || die
90
91 # create symlinks for these utilities to /sbin
92 # where multipath-tools expect them to be
93 mlink ../lib/udev/scsi_id /sbin/ || die
94
95 # mark some dirs undeletable
96 mkeepdir /etc/udev/rules.d || die
97 mkeepdir /lib/udev/state || die
98 mkeepdir /lib/udev/devices || die
99
100 # CONFIG_PROTECT_MASK for /etc/udev/rules.d
101 minstalldir /etc/env.d || die
102 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die
103
104 # create some nodes that we know we need
105 mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die
106 chmod 666 ${BINDIR}/lib/udev/devices/null || die
107 touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die
108
109 mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die
110 chmod 666 ${BINDIR}/lib/udev/devices/zero || die
111 touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die
112
113 mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die
114 chmod 600 ${BINDIR}/lib/udev/devices/console || die
115 chown root:tty ${BINDIR}/lib/udev/devices/console || die
116 touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die
117
118 mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die
119 chmod 666 ${BINDIR}/lib/udev/devices/urandom || die
120 touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die
121 }
122
123 preinstall()
124 {
125 add_conf_prot_mask /etc/udev /etc/env.d /etc/rc.d/init.d /etc/modprobe.d
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 # start udev-postmount service
219 mstartservice udev-postmount
220
221 # create some nodes that we need if they not exist
222 [[ ! -e ${MROOT}/lib/udev/devices/null ]] &&
223 mknod ${MROOT}/lib/udev/devices/null c 1 3
224 chmod 666 ${MROOT}/lib/udev/devices/null
225 touch -t 198002220222 ${MROOT}/lib/udev/devices/null
226
227 [[ ! -e ${MROOT}/lib/udev/devices/zero ]] &&
228 mknod ${MROOT}/lib/udev/devices/zero c 1 5
229 chmod 666 ${MROOT}/lib/udev/devices/zero
230 touch -t 198002220222 ${MROOT}/lib/udev/devices/zero
231
232 [[ ! -e ${MROOT}/lib/udev/devices/console ]] &&
233 mknod ${MROOT}/lib/udev/devices/console c 5 1
234 chmod 600 ${MROOT}/lib/udev/devices/console
235 chown root:tty ${MROOT}/lib/udev/devices/console
236 touch -t 198002220222 ${MROOT}/lib/udev/devices/console
237
238 [[ ! -e ${MROOT}/lib/udev/devices/urandom ]] &&
239 mknod ${MROOT}/lib/udev/devices/urandom c 1 9
240 chmod 666 ${MROOT}/lib/udev/devices/urandom
241 touch -t 198002220222 ${MROOT}/lib/udev/devices/urandom
242
243 # after install/uprade, udev *must* be reloaded if already running
244 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] &&
245 [[ -n $(pidof udevd) ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
246 then
247 echo "MROOT=/; restarting udev daemon ..."
248 killall -15 udevd &> /dev/null
249 sleep 1
250 killall -9 udevd &> /dev/null
251 /sbin/udevd --daemon
252 fi
253
254 # converting databases
255 echo "MROOT=/; converting udev database ..."
256 /sbin/udevadm info --convert-db
257
258 alx-split_postinstall
259 }
260
261 postremove()
262 {
263 [[ -f /sbin/udevd ]] || mstopservice udev-postmount
264 }