Contents of /branches/magellan-next/core/initscripts/initscripts-0.7.1.1-r1.smage2
Parent Directory | Revision Log
Revision 8850 -
(show annotations)
(download)
Wed Aug 3 08:54:02 2011 UTC (13 years, 1 month ago) by niro
File size: 7173 byte(s)
Wed Aug 3 08:54:02 2011 UTC (13 years, 1 month ago) by niro
File size: 7173 byte(s)
auto added: ver bump to 0.7.1.1-r1
1 | # $Id$ |
2 | |
3 | PNAME="initscripts" |
4 | PVER="0.7.1.1" |
5 | PBUILD="r1" |
6 | |
7 | # enable busybox initscripts y|n |
8 | # disabled atm, busybox missing in tree |
9 | BUSYBOX_ENABLED="n" |
10 | |
11 | SPLIT_PACKAGES="initscripts systemd-initscripts" |
12 | |
13 | [[ ${BUSYBOX_ENABLED} = y ]] && SPLIT_PACKAGES+=" busybox-initscripts" |
14 | |
15 | PCATEGORIE="sys-apps" |
16 | HOMEPAGE="http://magellan-linux.net" |
17 | |
18 | # the pkgs "coreutils, findutils, sed, gawk, bzip2, tar, rsync, wget" |
19 | # are needed to fix the /etc/profile issue |
20 | COMMON_DEPEND=">= sys-apps/base-files-0.5 |
21 | >= sys-apps/mage-release-0.11 |
22 | >= sys-apps/coreutils-5 |
23 | >= sys-apps/findutils-4 |
24 | >= sys-apps/grep-2 |
25 | >= sys-apps/sed-4 |
26 | >= sys-apps/gawk-3 |
27 | >= app-arch/bzip2-1 |
28 | >= sys-apps/tar-1 |
29 | >= net-misc/rsync-2 |
30 | >= net-misc/wget-1 |
31 | >= sys-apps/sysvinit-2.88 |
32 | >= sys-apps/which-2.20" |
33 | |
34 | SYSVINIT_DEPEND=">= sys-apps/sysvinit-2.88" |
35 | SYSTEMD_DEPEND=">= sys-apps/systemd-28" |
36 | |
37 | SDEPEND="${COMMON_DEPEND} |
38 | ${SYSVINIT_DEPEND} |
39 | ${SYSTEMD_DEPEND}" |
40 | |
41 | if [[ ${BUSYBOX_ENABLED} = y ]] |
42 | then |
43 | BUSYBOX_DEPEND=">= sys-apps/busybox-1.17" |
44 | SDEPEND="${SDEPEND} |
45 | ${BUSYBOX_DEPEND}" |
46 | fi |
47 | |
48 | PROVIDE="virtual/initscripts" |
49 | |
50 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
51 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
52 | |
53 | sminclude mtools |
54 | |
55 | SRC_URI=( mirror://${PNAME}/${SRCFILE} ) |
56 | |
57 | SPECIAL_VARS="BLOCKER" |
58 | |
59 | split_info_initscripts() |
60 | { |
61 | DESCRIPTION="Magellan Initscripts for sysVinit." |
62 | DEPEND="${COMMON_DEPEND} |
63 | ${SYSVINIT_DEPEND}" |
64 | |
65 | BLOCKER="sys-apps/systemd-initscripts sys-apps/busybox-initscripts" |
66 | } |
67 | |
68 | split_info_systemd-initscripts() |
69 | { |
70 | DESCRIPTION="Magellan Initscripts for systemd." |
71 | DEPEND="${COMMON_DEPEND} |
72 | ${SYSTEMD_DEPEND}" |
73 | |
74 | BLOCKER="sys-apps/initscripts sys-apps/busybox-initscripts" |
75 | } |
76 | |
77 | if [[ ${BUSYBOX_ENABLED} = y ]] |
78 | then |
79 | split_info_busybox-initscripts() |
80 | { |
81 | DESCRIPTION="Magellan Initscripts for busybox." |
82 | DEPEND="${COMMON_DEPEND} |
83 | ${BUSYBOX_DEPEND}" |
84 | |
85 | BLOCKER="sys-apps/initscripts sys-apps/systemd-initscripts" |
86 | } |
87 | fi |
88 | |
89 | src_prepare() |
90 | { |
91 | munpack ${SRCFILE} || die |
92 | } |
93 | |
94 | src_compile() |
95 | { |
96 | cd ${SRCDIR} |
97 | mmake || die |
98 | } |
99 | |
100 | common_install() |
101 | { |
102 | local method="$1" |
103 | local MCONFIG |
104 | local config_protect_ignore |
105 | |
106 | cd ${SRCDIR} |
107 | make DESTDIR=${BINDIR} install_${method} || die |
108 | |
109 | # always keep this files even if the user edited them |
110 | config_protect_ignore="/etc/fstab" |
111 | config_protect_ignore+=" /etc/hostname" |
112 | config_protect_ignore+=" /etc/hosts" |
113 | config_protect_ignore+=" /etc/inittab" |
114 | config_protect_ignore+=" /etc/conf.d/net.eth0" |
115 | config_protect_ignore+=" /etc/conf.d/net.routes" |
116 | minstalldir /etc/env.d || die |
117 | MCONFIG="/etc/env.d/01initscripts" |
118 | mclearconfig || die |
119 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
120 | } |
121 | |
122 | src_install_initscripts() |
123 | { |
124 | local flavor="sysvinit" |
125 | local config_protect_ignore |
126 | local MCONFIG |
127 | |
128 | cd ${SRCDIR} |
129 | common_install ${flavor} || die |
130 | |
131 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
132 | minstalldir /etc/env.d || die |
133 | MCONFIG="/etc/env.d/01${flavor}" |
134 | mclearconfig || die |
135 | maddconfig "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" || die |
136 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
137 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
138 | config_protect_ignore+=" /etc/modules.autoload" |
139 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
140 | } |
141 | |
142 | src_install_systemd-initscripts() |
143 | { |
144 | local flavor="systemd" |
145 | local config_protect_ignore |
146 | local MCONFIG |
147 | |
148 | cd ${SRCDIR} |
149 | common_install ${flavor} || die |
150 | |
151 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
152 | MCONFIG="/etc/env.d/01${flavor}" |
153 | minstalldir /etc/env.d || die |
154 | config_protect_ignore+=" /etc/systemd/system" |
155 | mclearconfig || die |
156 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
157 | } |
158 | |
159 | if [[ ${BUSYBOX_ENABLED} = y ]] |
160 | then |
161 | src_install_busybox-initscripts() |
162 | { |
163 | local flavor="busybox" |
164 | local config_protect_ignore |
165 | local MCONFIG |
166 | |
167 | cd ${SRCDIR} |
168 | common_install ${flavor} || die |
169 | |
170 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
171 | minstalldir /etc/env.d || die |
172 | MCONFIG="/etc/env.d/01${flavor}" |
173 | mclearconfig || die |
174 | maddconfig "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" || die |
175 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
176 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
177 | config_protect_ignore+=" /etc/modules.autoload" |
178 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
179 | # add conf.d/kernel to protect current udev|mdev configuration |
180 | config_protect_ignore+=" /etc/conf.d/kernel" |
181 | maddconfig "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" || die |
182 | } |
183 | fi |
184 | |
185 | postinstall() |
186 | { |
187 | # emulate seq; its needed to run rc-config |
188 | # this fixes some annyoing warning when building |
189 | # livecd or bootstrapping a system. |
190 | # this hack will be removed when the toolchain is fixed |
191 | if [ ! -f /usr/bin/seq ] |
192 | then |
193 | echo "Using fake 'seq' command ..." |
194 | seq() { |
195 | start=$1 |
196 | end=$2 |
197 | for ((i=start; i < end+1; i++)) |
198 | do |
199 | echo $i |
200 | done |
201 | } |
202 | export -f seq |
203 | fi |
204 | |
205 | # sysvinit and busybox only! |
206 | if [ -f ${MROOT}/etc/rc.d/init.d/functions ] |
207 | then |
208 | # create service state dir mountpoint |
209 | # needed by >=initscripts-0.3.2-r1 |
210 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
211 | |
212 | # mark this dir as undeletable |
213 | touch ${MROOT}/var/lib/init.d/.keep |
214 | |
215 | if [[ -x ${MROOT}/sbin/rc-config ]] |
216 | then |
217 | echo "Creating Runlevels ..." |
218 | local i |
219 | for i in checkfs cleanfs halt \ |
220 | loadkeys localnet modules mountfs \ |
221 | network reboot sendsignals \ |
222 | setclock swap sysctl consolefont |
223 | do |
224 | echo -e "\tAdded ${i} ..." |
225 | ${MROOT}/sbin/rc-config del ${i} > /dev/null |
226 | ${MROOT}/sbin/rc-config add ${i} > /dev/null |
227 | done |
228 | fi |
229 | fi |
230 | |
231 | # enable network.service (systemd only) |
232 | if [ -x ${MROOT}/bin/systemctl ] |
233 | then |
234 | mstartunit network.service |
235 | fi |
236 | |
237 | # keep this only for transitional purposes |
238 | # do not ask the user about following files |
239 | # |
240 | # if they exist let config_protect process them |
241 | # but then remove the protected files, to keep only the original file |
242 | # |
243 | # file-root is ${MROOT}/etc |
244 | 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" |
245 | local i file path |
246 | for i in ${CONFIG_IGNORE} |
247 | do |
248 | file="$(basename ${i})" |
249 | path="$(dirname ${i})/" |
250 | [[ ${path} == ./ ]] && path="" |
251 | |
252 | rm -f ${MROOT}/etc/${path}._cfg????_${file} |
253 | done |
254 | |
255 | # initscripts >= 0.5.0: rc file moved to /etc/conf.d/rc |
256 | if [[ -f ${MROOT}/etc/conf.d/rc ]] && [[ -f ${MROOT}/etc/sysconfig/rc ]] |
257 | then |
258 | rm -f ${MROOT}/etc/sysconfig/rc |
259 | fi |
260 | |
261 | # aliases and i368 got renamed to *.conf |
262 | local i |
263 | for i in aliases i386 |
264 | do |
265 | if [[ -f ${MROOT}/etc/modules.d/${i} ]] |
266 | then |
267 | rm ${MROOT}/etc/modules.d/${i} |
268 | fi |
269 | done |
270 | } |
271 | |
272 | preinstall() |
273 | { |
274 | # ignore this while package building |
275 | if [[ ! -f /.installrc ]] |
276 | then |
277 | local package |
278 | for package in ${BLOCKER} |
279 | do |
280 | if [[ ! -z $(magequery -n ${package##*/}) ]] |
281 | then |
282 | echo -e ${COLRED} |
283 | echo -e "Error: ${package} is installed!!" |
284 | echo -e "This initscript flavor cannot co-exist ${package}." |
285 | echo -e "Please uninstall ${package} first!" |
286 | echo -e ${COLDEFAULT} |
287 | die "${package} found!" |
288 | fi |
289 | done |
290 | fi |
291 | } |
292 | |
293 | preremove() |
294 | { |
295 | # protect these files, that they do not get removed from the system |
296 | local CONFIG_IGNORE="fstab hostname hosts" |
297 | for i in ${CONFIG_IGNORE} |
298 | do |
299 | [[ -e ${MROOT}/etc/${i} ]] && touch ${MROOT}/etc/${i} |
300 | done |
301 | } |