Magellan Linux

Contents of /branches/magellan-next/core/udev/udev-170-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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