Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2047 - (show annotations) (download)
Wed May 11 19:04:17 2011 UTC (13 years, 1 month ago) by niro
File size: 7167 byte(s)
-only keep lib/udev, exclude systemd files
1 # $Id$
2
3 PNAME="udev"
4 PVER="166"
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.19
15 >= virtual/initscripts"
16
17 SDEPEND=">= virtual/kernel-sources"
18
19 PROVIDE="virtual/devmanager"
20
21 SRCFILE="${PNAME}-${PVER}.tar.bz2"
22 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
23
24 CONFIG_SRCFILE="config-${PNAME}-${PVER}-${PBUILD}.tar.bz2"
25 CONFIG_SRCDIR="${BUILDDIR}/config-${PNAME}-${PVER}-${PBUILD}"
26
27 # global var: ${LINUX_SOURCES}
28 # location where they are
29 [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux"
30
31 REMOVE_DEPRECATED_MAGE_TARGETS=1
32 ALX_ONLY_KEEP="etc lib/udev $(mlibdir) sbin usr/$(mlibdir)/*.so usr/$(mlibdir)/*.so.*"
33 sminclude mtools multilib alx-split
34
35 SRC_URI=(
36 http://www.kernel.org/pub/linux/utils/kernel/hotplug/${SRCFILE}
37 mirror://${PNAME}/${SRCFILE}
38 mirror://${PNAME}/${CONFIG_SRCFILE}
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
49 src_compile()
50 {
51 # using /lib/udev as libexecdir also on multilib systems
52 # to have one common rules/script directory!
53 # same with the systemd units dir!
54 #
55 # we set --exec-prefix --bindir and --sbindir to fix ${exec_prefix} issues in the systemd units
56 # variables are not allowd in the beginning of ExecStart
57 # see: http://cgit.freedesktop.org/systemd/commit/?id=d2f316345cfadd07025b1a1770f63804e33c4b50
58 mconfigure \
59 --exec-prefix= \
60 --bindir=/bin \
61 --sbindir=/sbin \
62 --with-libdir-name='$(mlibdir)' \
63 --libexecdir=/lib/udev \
64 --enable-logging \
65 --without-selinux \
66 --disable-introspection \
67 --disable-extras \
68 --with-systemdsystemunitdir=/lib/systemd/system \
69 || die
70
71 mmake || die
72 }
73
74 alx_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-basic-files || 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
242 # converting databases
243 echo "MROOT=/; converting udev database ..."
244 /sbin/udevadm info --convert-db
245
246 alx-split_postinstall
247 }