Contents of /smage/trunk/core/initscripts/initscripts-0.8.0-r1.smage2
Parent Directory
|
Revision Log
Revision 4587 -
(show annotations)
(download)
Mon Mar 18 10:19:20 2013 UTC (11 years, 3 months ago) by niro
File size: 10347 byte(s)
Mon Mar 18 10:19:20 2013 UTC (11 years, 3 months ago) by niro
File size: 10347 byte(s)
auto added: ver bump to 0.8.0-r1
1 | # $Id$ |
2 | |
3 | PNAME="initscripts" |
4 | PVER="0.8.0" |
5 | PBUILD="r1" |
6 | |
7 | # enable busybox initscripts y|n |
8 | # disabled atm, busybox missing in tree |
9 | BUSYBOX_ENABLED="y" |
10 | # enable sysvinit initscripts y|n |
11 | # disabled, we have replaced sysvinit with systemd |
12 | SYSVINIT_ENABLED="n" |
13 | |
14 | SPLIT_PACKAGES="systemd-initscripts" |
15 | |
16 | [[ ${BUSYBOX_ENABLED} = y ]] && SPLIT_PACKAGES+=" busybox-initscripts" |
17 | [[ ${SYSVINIT_ENABLED} = y ]] && SPLIT_PACKAGES+=" initscripts" |
18 | |
19 | PCAT="sys-apps" |
20 | HOMEPAGE="http://magellan-linux.net" |
21 | |
22 | # the pkgs "coreutils, findutils, sed, gawk, bzip2, tar, rsync, wget" |
23 | # are needed to fix the /etc/profile issue |
24 | COMMON_DEPEND=">= sys-apps/base-files-0.5 |
25 | >= sys-apps/mage-release-0 |
26 | >= sys-apps/coreutils-5 |
27 | >= sys-apps/findutils-4 |
28 | >= virtual/grep |
29 | >= virtual/sed |
30 | >= sys-apps/gawk-3 |
31 | >= virtual/bzip2 |
32 | >= virtual/tar |
33 | >= net-misc/rsync-2 |
34 | >= virtual/wget |
35 | >= virtual/which" |
36 | |
37 | SYSTEMD_DEPEND=">= sys-apps/systemd-28" |
38 | |
39 | SDEPEND="${COMMON_DEPEND} |
40 | ${SYSTEMD_DEPEND}" |
41 | |
42 | if [[ ${BUSYBOX_ENABLED} = y ]] |
43 | then |
44 | BUSYBOX_DEPEND=">= sys-apps/busybox-1.17" |
45 | SDEPEND="${SDEPEND} |
46 | ${BUSYBOX_DEPEND}" |
47 | fi |
48 | |
49 | if [[ ${SYSVINIT_ENABLED} = y ]] |
50 | then |
51 | SYSVINIT_DEPEND=">= sys-apps/sysvinit-2.88" |
52 | SDEPEND="${SDEPEND} |
53 | ${SYSVINIT_DEPEND}" |
54 | fi |
55 | |
56 | PROVIDE="virtual/initscripts" |
57 | |
58 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
59 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
60 | |
61 | sminclude mtools alx |
62 | |
63 | SRC_URI=( mirror://${PNAME}/${SRCFILE} ) |
64 | |
65 | SPECIAL_VARS="BLOCKER SYSVINIT_ENABLED BUSYBOX_ENABLED" |
66 | SPECIAL_FUNCTIONS="preinstall-common postinstall-common preremove-common" |
67 | |
68 | if [[ ${SYSVINIT_ENABLED} = y ]] |
69 | then |
70 | split_info_initscripts() |
71 | { |
72 | DESCRIPTION="Magellan Initscripts for sysVinit." |
73 | DEPEND="${COMMON_DEPEND} |
74 | ${SYSVINIT_DEPEND}" |
75 | |
76 | BLOCKER="sys-apps/systemd-initscripts sys-apps/busybox-initscripts" |
77 | } |
78 | fi |
79 | |
80 | split_info_systemd-initscripts() |
81 | { |
82 | DESCRIPTION="Magellan Initscripts for systemd." |
83 | DEPEND="${COMMON_DEPEND} |
84 | ${SYSTEMD_DEPEND}" |
85 | |
86 | BLOCKER="sys-apps/initscripts sys-apps/busybox-initscripts" |
87 | } |
88 | |
89 | if [[ ${BUSYBOX_ENABLED} = y ]] |
90 | then |
91 | split_info_busybox-initscripts() |
92 | { |
93 | DESCRIPTION="Magellan Initscripts for busybox." |
94 | DEPEND="${COMMON_DEPEND} |
95 | ${BUSYBOX_DEPEND}" |
96 | |
97 | BLOCKER="sys-apps/initscripts sys-apps/systemd-initscripts" |
98 | } |
99 | fi |
100 | |
101 | src_prepare() |
102 | { |
103 | munpack ${SRCFILE} || die |
104 | } |
105 | |
106 | src_compile() |
107 | { |
108 | cd ${SRCDIR} |
109 | mmake || die |
110 | } |
111 | |
112 | common_install() |
113 | { |
114 | local method="$1" |
115 | local MCONFIG |
116 | local config_protect_ignore |
117 | |
118 | cd ${SRCDIR} |
119 | make DESTDIR=${BINDIR} LIBDIR=/usr/lib SBINDIR=/usr/sbin install_${method} || die |
120 | |
121 | # always keep this files even if the user edited them |
122 | config_protect_ignore="/etc/fstab" |
123 | config_protect_ignore+=" /etc/hostname" |
124 | config_protect_ignore+=" /etc/hosts" |
125 | config_protect_ignore+=" /etc/inittab" |
126 | config_protect_ignore+=" /etc/conf.d/net.eth0" |
127 | config_protect_ignore+=" /etc/conf.d/net.routes" |
128 | minstalldir /etc/env.d || die |
129 | MCONFIG="/etc/env.d/01initscripts" |
130 | mclearconfig || die |
131 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
132 | } |
133 | |
134 | if [[ ${SYSVINIT_ENABLED} = y ]] |
135 | then |
136 | src_install_initscripts() |
137 | { |
138 | local flavor="sysvinit" |
139 | local config_protect_ignore |
140 | local MCONFIG |
141 | |
142 | cd ${SRCDIR} |
143 | common_install ${flavor} || die |
144 | |
145 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
146 | minstalldir /etc/env.d || die |
147 | MCONFIG="/etc/env.d/01${flavor}" |
148 | mclearconfig || die |
149 | maddconfig "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" || die |
150 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
151 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
152 | config_protect_ignore+=" /etc/modules.autoload" |
153 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
154 | } |
155 | fi |
156 | |
157 | src_install_systemd-initscripts() |
158 | { |
159 | local flavor="systemd" |
160 | local config_protect_ignore |
161 | local MCONFIG |
162 | |
163 | cd ${SRCDIR} |
164 | common_install ${flavor} || die |
165 | |
166 | # install these binaries for old sysvinit compat only |
167 | if [[ ${SYSVINIT_ENABLED} = n ]] |
168 | then |
169 | minstalldir /usr/sbin || die |
170 | minstallexec ${SRCDIR}/sysvinit/sbin/rc-config /usr/sbin || die |
171 | minstalldir /etc/rc.d/init.d || die |
172 | minstallfile ${SRCDIR}/sysvinit/rc/functions /etc/rc.d/init.d/ || die |
173 | fi |
174 | |
175 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
176 | MCONFIG="/etc/env.d/01${flavor}" |
177 | minstalldir /etc/env.d || die |
178 | config_protect_ignore+=" /etc/systemd/system" |
179 | mclearconfig || die |
180 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
181 | |
182 | # alx only: fix issue file for busybox getty |
183 | minstallfile busybox/etc/issue /etc/issue || die |
184 | } |
185 | |
186 | if [[ ${BUSYBOX_ENABLED} = y ]] |
187 | then |
188 | src_install_busybox-initscripts() |
189 | { |
190 | local flavor="busybox" |
191 | local config_protect_ignore |
192 | local MCONFIG |
193 | |
194 | cd ${SRCDIR} |
195 | common_install ${flavor} || die |
196 | |
197 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
198 | minstalldir /etc/env.d || die |
199 | MCONFIG="/etc/env.d/01${flavor}" |
200 | mclearconfig || die |
201 | maddconfig "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" || die |
202 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
203 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
204 | config_protect_ignore+=" /etc/modules.autoload" |
205 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
206 | # add conf.d/kernel to protect current udev|mdev configuration |
207 | config_protect_ignore+=" /etc/conf.d/kernel" |
208 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
209 | } |
210 | fi |
211 | |
212 | postinstall-common() |
213 | { |
214 | # emulate seq; its needed to run rc-config |
215 | # this fixes some annyoing warning when building |
216 | # livecd or bootstrapping a system. |
217 | # this hack will be removed when the toolchain is fixed |
218 | if [ ! -f /usr/bin/seq ] |
219 | then |
220 | echo "Using fake 'seq' command ..." |
221 | seq() { |
222 | start=$1 |
223 | end=$2 |
224 | for ((i=start; i < end+1; i++)) |
225 | do |
226 | echo $i |
227 | done |
228 | } |
229 | export -f seq |
230 | fi |
231 | |
232 | # keep this only for transitional purposes |
233 | # do not ask the user about following files |
234 | # |
235 | # if they exist let config_protect process them |
236 | # but then remove the protected files, to keep only the original file |
237 | # |
238 | # file-root is ${MROOT}/etc |
239 | local CONFIG_IGNORE="fstab hostname hosts inittab conf.d/net.eth0 modules.autoload.d/kernel-2.4 modules.autoload.d/kernel-2.6 modules.autoload" |
240 | local i file path |
241 | for i in ${CONFIG_IGNORE} |
242 | do |
243 | file="$(basename ${i})" |
244 | path="$(dirname ${i})/" |
245 | [[ ${path} == ./ ]] && path="" |
246 | |
247 | rm -f ${MROOT}/etc/${path}._cfg????_${file} |
248 | done |
249 | |
250 | # initscripts >= 0.5.0: rc file moved to /etc/conf.d/rc |
251 | if [[ -f ${MROOT}/etc/conf.d/rc ]] && [[ -f ${MROOT}/etc/sysconfig/rc ]] |
252 | then |
253 | rm -f ${MROOT}/etc/sysconfig/rc |
254 | fi |
255 | |
256 | # aliases and i368 got renamed to *.conf |
257 | local i |
258 | for i in aliases i386 |
259 | do |
260 | if [[ -f ${MROOT}/etc/modules.d/${i} ]] |
261 | then |
262 | rm ${MROOT}/etc/modules.d/${i} |
263 | fi |
264 | done |
265 | } |
266 | |
267 | postinstall-systemd-initscripts() |
268 | { |
269 | postinstall-common |
270 | |
271 | # enable network.service (systemd only) |
272 | mstartunit network.service |
273 | } |
274 | |
275 | postinstall-sysvinit-initscripts() |
276 | { |
277 | postinstall-common |
278 | |
279 | if [ -f ${MROOT}/etc/rc.d/init.d/functions ] |
280 | then |
281 | # create service state dir mountpoint |
282 | # needed by >=initscripts-0.3.2-r1 |
283 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
284 | |
285 | # mark this dir as undeletable |
286 | touch ${MROOT}/var/lib/init.d/.keep |
287 | |
288 | if [[ -x ${MROOT}/usr/sbin/rc-config ]] |
289 | then |
290 | echo "Creating Runlevels ..." |
291 | local i |
292 | for i in checkfs cleanfs halt \ |
293 | loadkeys localnet modules mountfs \ |
294 | network reboot sendsignals \ |
295 | setclock swap sysctl consolefont |
296 | do |
297 | echo -e "\tAdded ${i} ..." |
298 | ${MROOT}/usr/sbin/rc-config del ${i} > /dev/null |
299 | ${MROOT}/usr/sbin/rc-config add ${i} > /dev/null |
300 | done |
301 | fi |
302 | fi |
303 | } |
304 | |
305 | postinstall-busybox-initscripts() |
306 | { |
307 | postinstall-common |
308 | |
309 | if [ -f ${MROOT}/etc/rc.d/init.d/functions ] |
310 | then |
311 | # create service state dir mountpoint |
312 | # needed by >=initscripts-0.3.2-r1 |
313 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
314 | |
315 | # mark this dir as undeletable |
316 | touch ${MROOT}/var/lib/init.d/.keep |
317 | |
318 | if [[ -x ${MROOT}/usr/sbin/rc-config ]] |
319 | then |
320 | echo "Creating Runlevels ..." |
321 | local i |
322 | for i in checkfs cleanfs loadkeys localnet \ |
323 | modules mountfs network setclock swap |
324 | do |
325 | echo -e "\tAdded ${i} ..." |
326 | ${MROOT}/usr/sbin/rc-config del ${i} > /dev/null |
327 | ${MROOT}/usr/sbin/rc-config add ${i} > /dev/null |
328 | done |
329 | fi |
330 | fi |
331 | } |
332 | |
333 | preinstall-common() |
334 | { |
335 | # ignore this while package building |
336 | if [[ ! -f /.installrc ]] |
337 | then |
338 | local package |
339 | for package in ${BLOCKER} |
340 | do |
341 | if [[ ! -z $(magequery -n ${package##*/}) ]] |
342 | then |
343 | echo -e ${COLRED} |
344 | echo -e "Error: ${package} is installed!!" |
345 | echo -e "This initscript flavor cannot co-exist ${package}." |
346 | echo -e "Please uninstall ${package} first!" |
347 | echo -e ${COLDEFAULT} |
348 | die "${package} found!" |
349 | fi |
350 | done |
351 | fi |
352 | } |
353 | |
354 | preinstall-systemd-initscripts() |
355 | { |
356 | preinstall-common |
357 | |
358 | add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ |
359 | /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \ |
360 | /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network |
361 | |
362 | add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \ |
363 | /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \ |
364 | /etc/conf.d/net.routes |
365 | } |
366 | |
367 | preinstall-sysvinit-initscripts() |
368 | { |
369 | preinstall-common |
370 | |
371 | add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ |
372 | /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \ |
373 | /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network |
374 | |
375 | add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \ |
376 | /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \ |
377 | /etc/conf.d/net.routes |
378 | } |
379 | |
380 | preinstall-busybox-initscripts() |
381 | { |
382 | preinstall-common |
383 | |
384 | add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ |
385 | /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \ |
386 | /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network |
387 | |
388 | add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \ |
389 | /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \ |
390 | /etc/conf.d/net.routes |
391 | } |
392 | |
393 | preremove-common() |
394 | { |
395 | # protect these files, that they do not get removed from the system |
396 | local CONFIG_IGNORE="fstab hostname hosts" |
397 | for i in ${CONFIG_IGNORE} |
398 | do |
399 | [[ -e ${MROOT}/etc/${i} ]] && touch ${MROOT}/etc/${i} |
400 | done |
401 | } |
402 | |
403 | preremove-systemd-initscripts() |
404 | { |
405 | preremove-common |
406 | } |
407 | |
408 | preremove-sysvinit-initscripts() |
409 | { |
410 | preremove-common |
411 | } |
412 | |
413 | preremove-busybox-initscripts() |
414 | { |
415 | preremove-common |
416 | } |