Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 760 - (show annotations) (download)
Thu Oct 21 19:39:50 2010 UTC (13 years, 6 months ago) by niro
File size: 7073 byte(s)
auto added: ver bump to 163-r1
1 # $Id: udev-151-r2.smage2 5611 2010-07-14 13:23:26Z niro $
2
3 PNAME="udev"
4 PVER="163"
5 PBUILD="r1"
6
7 PCATEGORIE="sys-fs"
8 STATE="unstable"
9
10 DESCRIPTION="A Userspace Implementation for dynamic /dev nodes."
11 HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
12
13 DEPEND=">= virtual/glibc
14 >= sys-apps/util-linux-2.18
15 >= virtual/usbutils
16 >= virtual/pciutils
17 >= virtual/initscripts
18 >= dev-libs/glib2-2.24"
19
20 SDEPEND=">= virtual/kernel-sources
21 >= dev-util/gperf-3.0.4"
22
23 SRCFILE="${PNAME}-${PVER}.tar.bz2"
24 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
25
26 CONFIG_SRCFILE="config-${PNAME}-${PVER}-r2.tar.bz2"
27 CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-r2"
28
29 # global var: ${LINUX_SOURCES}
30 # location where they are
31 [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux"
32
33 MCORE_ONLY_KEEP="etc lib $(mlibdir) sbin usr/$(mlibdir)/*.so usr/$(mlibdir)/*.so.*"
34 sminclude mtools multilib mcore-split
35
36 SRC_URI=(
37 http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE}
38 mirror://${PNAME}/${SRCFILE}
39 mirror://${PNAME}/${CONFIG_SRCFILE}
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
50 src_compile()
51 {
52 # using /lib/udev as libexecdir also on multilib systems
53 # to have one common rules/script directory!
54 # same with the systemd units dir!
55 #
56 # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units
57 # variables are not allowd in the beginning of ExecStart
58 # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50
59 mconfigure \
60 --exec-prefix= \
61 --bindir=/bin \
62 --sbindir=/sbin \
63 --with-libdir-name='$(mlibdir)' \
64 --libexecdir=/lib/udev \
65 --enable-logging \
66 --without-selinux \
67 --disable-introspection \
68 --with-systemdsystemunitdir=/lib/systemd/system \
69 || die
70
71 mmake || die
72 }
73
74 mcore_generic_src_install()
75 {
76 mmake DESTDIR=${BINDIR} install || die
77 minstalldocs COPYING ChangeLog NEWS README TODO || die
78
79 # install our config
80 cd ${CONFIG_SRCDIR}
81 make DESTDIR=${BINDIR} install || die
82
83 # create symlinks for these utilities to /sbin
84 # where multipath-tools expect them to be
85 mlink ../lib/udev/scsi_id /sbin/ || die
86
87 # mark some dirs undeletable
88 mkeepdir /etc/udev/rules.d || die
89 mkeepdir /lib/udev/state || die
90 mkeepdir /lib/udev/devices || die
91
92 # CONFIG_PROTECT_MASK for /etc/udev/rules.d
93 minstalldir /etc/env.d || die
94 echo "CONFIG_PROTECT_MASK=\"/etc/udev/rules.d\"" > ${BINDIR}/etc/env.d/02udev || die
95
96 # create some nodes that we know we need
97 mknod ${BINDIR}/lib/udev/devices/null c 1 3 || die
98 chmod 666 ${BINDIR}/lib/udev/devices/null || die
99 # hey, that's my birthday :)
100 touch -t 198002220222 ${BINDIR}/lib/udev/devices/null || die
101
102 mknod ${BINDIR}/lib/udev/devices/zero c 1 5 || die
103 chmod 666 ${BINDIR}/lib/udev/devices/zero || die
104 touch -t 198002220222 ${BINDIR}/lib/udev/devices/zero || die
105
106 mknod ${BINDIR}/lib/udev/devices/console c 5 1 || die
107 chmod 600 ${BINDIR}/lib/udev/devices/console || die
108 chown root:tty ${BINDIR}/lib/udev/devices/console || die
109 touch -t 198002220222 ${BINDIR}/lib/udev/devices/console || die
110
111 mknod ${BINDIR}/lib/udev/devices/urandom c 1 9 || die
112 chmod 666 ${BINDIR}/lib/udev/devices/urandom || die
113 touch -t 198002220222 ${BINDIR}/lib/udev/devices/urandom || die
114 }
115
116 preinstall()
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 }