Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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