Contents of /smage/branches/alx-0_6_0/core/busybox-initscripts/busybox-initscripts-0.7.0.3-r5.smage2
Parent Directory | Revision Log
Revision 4923 -
(show annotations)
(download)
Wed May 29 10:42:31 2013 UTC (11 years ago) by niro
File size: 5982 byte(s)
Wed May 29 10:42:31 2013 UTC (11 years ago) by niro
File size: 5982 byte(s)
-remove orig files, created by patchwork so they don't end up in the package
1 | # $Id$ |
2 | |
3 | PNAME="busybox-initscripts" |
4 | PVER="0.7.0.3" |
5 | PBUILD="r5" |
6 | |
7 | PCATEGORIE="sys-apps" |
8 | |
9 | DESCRIPTION="Port of the Magellan Initscripts for busybox." |
10 | HOMEPAGE="http://magellan-linux.net/" |
11 | |
12 | # the pkgs "coreutils, findutils, sed, gawk, bzip2, tar, rsync, wget" |
13 | # are needed to fix the /etc/profile issue |
14 | DEPEND=">= sys-apps/busybox-1.17.4 |
15 | >= sys-apps/coreutils-8.10 |
16 | >= sys-apps/findutils-4.4 |
17 | >= virtual/grep |
18 | >= virtual/sed |
19 | >= sys-apps/gawk-3 |
20 | >= virtual/bzip2 |
21 | >= virtual/tar |
22 | >= net-misc/rsync-3 |
23 | >= virtual/wget |
24 | >= virtual/which |
25 | >= sys-apps/mage-release-0" |
26 | |
27 | SRCFILE="initscripts-${PVER}.tar.bz2" |
28 | SRCDIR="${BUILDDIR}/initscripts-${PVER}" |
29 | |
30 | sminclude alx |
31 | |
32 | SRC_URI=( |
33 | mirror://initscripts/${SRCFILE} |
34 | mirror://initscripts/initscripts-${PVER}-update-copyright.patch |
35 | mirror://initscripts/initscripts-${PVER}-mount-sys-only-if-required.patch |
36 | mirror://initscripts/initscripts-${PVER}-rc_echo-missing-escapes.patch |
37 | mirror://initscripts/initscripts-${PVER}-export-runlevel.patch |
38 | mirror://initscripts/initscripts-${PVER}-exit-splash-at-shutdown-and-reboot.patch |
39 | ) |
40 | |
41 | src_prepare() |
42 | { |
43 | munpack ${SRCFILE} || die |
44 | cd ${SRCDIR} |
45 | |
46 | # update copyright to 2012 |
47 | mpatch initscripts-${PVER}-update-copyright.patch || die |
48 | |
49 | # only mount /sys if not already mounted (like from initrd) |
50 | mpatch initscripts-${PVER}-mount-sys-only-if-required.patch || die |
51 | |
52 | # fix missing escaping in the rc_echo() cmd |
53 | mpatch initscripts-${PVER}-rc_echo-missing-escapes.patch || die |
54 | |
55 | # export runlevel variabl that every rc-script knows about the current runlevel |
56 | mpatch initscripts-${PVER}-export-runlevel.patch || die |
57 | |
58 | # run splash_exit on runlevel shutdown and reboot |
59 | mpatch initscripts-${PVER}-exit-splash-at-shutdown-and-reboot.patch || die |
60 | |
61 | # remove all orig files created by the patchwork |
62 | find ${SRCDIR} -name \*.orig | xargs --no-run-if-empty rm || die |
63 | } |
64 | |
65 | src_install() |
66 | { |
67 | cd ${SRCDIR} |
68 | make DESTDIR=${BINDIR} install_busybox || die |
69 | |
70 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
71 | install -d ${BINDIR}/etc/env.d || die |
72 | echo "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" > ${BINDIR}/etc/env.d/01initscripts || die |
73 | # always keep this files even if the user did not edited them |
74 | local config_protect_ignore |
75 | config_protect_ignore="/etc/fstab" |
76 | config_protect_ignore+=" /etc/group" |
77 | config_protect_ignore+=" /etc/hostname" |
78 | config_protect_ignore+=" /etc/hosts" |
79 | config_protect_ignore+=" /etc/inittab" |
80 | config_protect_ignore+=" /etc/passwd" |
81 | config_protect_ignore+=" /etc/shadow" |
82 | config_protect_ignore+=" /etc/conf.d/net.eth0" |
83 | config_protect_ignore+=" /etc/conf.d/net.routes" |
84 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
85 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
86 | config_protect_ignore+=" /etc/modules.autoload" |
87 | # add conf.d/kernel to protect current udev|mdev configuration |
88 | config_protect_ignore+=" /etc/conf.d/kernel" |
89 | echo "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" >> ${BINDIR}/etc/env.d/01initscripts || die |
90 | |
91 | # always use udev on alx |
92 | sed -i 's:^\(RC_DEVICEMANAGER=\).*:\1udev:' ${BINDIR}/etc/conf.d/kernel || die |
93 | |
94 | # an extra package from now on |
95 | if [[ -f ${BINDIR}/etc/mageversion ]] |
96 | then |
97 | rm ${BINDIR}/etc/mageversion || die |
98 | fi |
99 | if [[ -f ${BINDIR}/etc/system-release ]] |
100 | then |
101 | rm ${BINDIR}/etc/system-release || die |
102 | fi |
103 | } |
104 | |
105 | preinstall() |
106 | { |
107 | add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \ |
108 | /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \ |
109 | /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network |
110 | |
111 | add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \ |
112 | /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \ |
113 | /etc/conf.d/net.routes |
114 | } |
115 | |
116 | postinstall() |
117 | { |
118 | # emulate seq; its needed to run rc-config |
119 | # this fixes some annyoing warning when building |
120 | # livecd or bootstrapping a system. |
121 | # this hack will be removed when the toolchain is fixed |
122 | if [ ! -f /usr/bin/seq ] |
123 | then |
124 | echo "Using fake 'seq' command ..." |
125 | seq() { |
126 | start=$1 |
127 | end=$2 |
128 | for ((i=start; i < end+1; i++)) |
129 | do |
130 | echo $i |
131 | done |
132 | } |
133 | export -f seq |
134 | fi |
135 | |
136 | # create service state dir mountpoint |
137 | # needed by >=initscripts-0.3.2-r1 |
138 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
139 | |
140 | # mark this dir as undeletable |
141 | touch ${MROOT}/var/lib/init.d/.keep |
142 | |
143 | echo "Creating Runlevels ..." |
144 | local i |
145 | for i in cleanfs \ |
146 | loadkeys \ |
147 | localnet \ |
148 | modules \ |
149 | mountfs \ |
150 | network \ |
151 | setclock \ |
152 | swap |
153 | do |
154 | echo -e "\tAdded ${i} ..." |
155 | ${MROOT}/sbin/rc-config del ${i} > /dev/null |
156 | ${MROOT}/sbin/rc-config add ${i} > /dev/null |
157 | done |
158 | # delete these |
159 | for i in checkfs |
160 | do |
161 | echo -e "\rDeleted ${i} ..." |
162 | ${MROOT}/sbin/rc-config del ${i} > /dev/null |
163 | done |
164 | |
165 | # |
166 | # do not ask the user about following files |
167 | # |
168 | # if they exist let config_protect process them |
169 | # but then remove the protected files, to keep only the original file |
170 | # |
171 | # don't do this if MAGE_BOOTSTRAP=true is set! |
172 | if [[ ${MAGE_BOOTSTRAP} = true ]] |
173 | then |
174 | echo "bootstrap phase - ignoring autocleanup" |
175 | else |
176 | # file-root is ${MROOT}/etc |
177 | local CONFIG_IGNORE="fstab group hostname hosts inittab passwd conf.d/net.eth0 modules.autoload.d/kernel-2.4 modules.autoload.d/kernel-2.6" |
178 | local i file path |
179 | for i in ${CONFIG_IGNORE} |
180 | do |
181 | file="$(basename ${i})" |
182 | path="$(dirname ${i})/" |
183 | [[ ${path} == ./ ]] && path="" |
184 | |
185 | rm -f ${MROOT}/etc/${path}._cfg????_${file} |
186 | done |
187 | fi |
188 | |
189 | # fix mtab |
190 | if [[ ! -L ${MROOT}/etc/mtab ]] || [[ $(readlink ${MROOT}/etc/mtab) != /proc/mounts ]] |
191 | then |
192 | ln -snf /proc/mounts ${MROOT}/etc/mtab |
193 | fi |
194 | |
195 | # remove /etc/modprobe.conf |
196 | if [[ -f ${MROOT}/etc/modprobe.conf ]] && [[ -d ${MROOT}/etc/modprobe.d ]] |
197 | then |
198 | rm ${MROOT}/etc/modprobe.conf |
199 | fi |
200 | |
201 | # remove old alx initscripts |
202 | local target |
203 | for target in ${DEPRECATED_MAGE_TARGETS} |
204 | do |
205 | if [[ ! -z $(magequery -n initscripts-${target}) ]] |
206 | then |
207 | echo "removing deprecated mage-target 'initscripts-${target}'" |
208 | mage uninstall initscripts-${target} || die |
209 | fi |
210 | done |
211 | } |