Contents of /branches/R11-stable/core/initscripts/initscripts-0.8.6-r1.smage2
Parent Directory | Revision Log
Revision 20445 -
(show annotations)
(download)
Mon Jan 27 09:18:34 2014 UTC (10 years, 8 months ago) by niro
File size: 7296 byte(s)
Mon Jan 27 09:18:34 2014 UTC (10 years, 8 months ago) by niro
File size: 7296 byte(s)
-release branches/R11-stable
1 | # $Id$ |
2 | |
3 | PNAME="initscripts" |
4 | PVER="0.8.6" |
5 | PBUILD="r1" |
6 | |
7 | # enable busybox initscripts y|n |
8 | # disabled atm, busybox missing in tree |
9 | BUSYBOX_ENABLED="n" |
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-R11 |
26 | >= sys-apps/coreutils-5 |
27 | >= sys-apps/findutils-4 |
28 | >= sys-apps/grep-2 |
29 | >= app-shells/bash-4 |
30 | >= virtual/sed |
31 | >= sys-apps/gawk-3 |
32 | >= app-arch/bzip2-1 |
33 | >= sys-apps/tar-1 |
34 | >= net-misc/rsync-2 |
35 | >= net-misc/wget-1" |
36 | |
37 | SYSTEMD_DEPEND=">= sys-apps/systemd-197" |
38 | |
39 | SDEPEND="${COMMON_DEPEND} |
40 | ${SYSTEMD_DEPEND} |
41 | >= dev-util/pkgconfig-0.25" |
42 | |
43 | if [[ ${BUSYBOX_ENABLED} = y ]] |
44 | then |
45 | BUSYBOX_DEPEND=">= sys-apps/busybox-1.17" |
46 | SDEPEND="${SDEPEND} |
47 | ${BUSYBOX_DEPEND}" |
48 | fi |
49 | |
50 | if [[ ${SYSVINIT_ENABLED} = y ]] |
51 | then |
52 | SYSVINIT_DEPEND=">= sys-apps/sysvinit-2.88" |
53 | SDEPEND="${SDEPEND} |
54 | ${SYSVINIT_DEPEND}" |
55 | fi |
56 | |
57 | PROVIDE="virtual/initscripts" |
58 | |
59 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
60 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
61 | |
62 | sminclude mtools systemd |
63 | |
64 | SRC_URI=( mirror://${PNAME}/${SRCFILE} ) |
65 | |
66 | SPECIAL_VARS="BLOCKER SYSVINIT_ENABLED BUSYBOX_ENABLED" |
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 | |
122 | if [[ ${SYSVINIT_ENABLED} = y ]] |
123 | then |
124 | src_install_initscripts() |
125 | { |
126 | cd ${SRCDIR} |
127 | common_install sysvinit || die |
128 | } |
129 | fi |
130 | |
131 | src_install_systemd-initscripts() |
132 | { |
133 | cd ${SRCDIR} |
134 | common_install systemd || die |
135 | |
136 | # install these binaries for old sysvinit compat only |
137 | if [[ ${SYSVINIT_ENABLED} = n ]] |
138 | then |
139 | minstalldir /usr/sbin || die |
140 | minstallexec ${SRCDIR}/sysvinit/sbin/rc-config /usr/sbin || die |
141 | minstalldir /etc/rc.d/init.d || die |
142 | minstallfile ${SRCDIR}/sysvinit/rc/functions /etc/rc.d/init.d/ || die |
143 | fi |
144 | } |
145 | |
146 | if [[ ${BUSYBOX_ENABLED} = y ]] |
147 | then |
148 | src_install_busybox-initscripts() |
149 | { |
150 | cd ${SRCDIR} |
151 | common_install busybox || die |
152 | } |
153 | fi |
154 | |
155 | postinstall() |
156 | { |
157 | # emulate seq; its needed to run rc-config |
158 | # this fixes some annyoing warning when building |
159 | # livecd or bootstrapping a system. |
160 | # this hack will be removed when the toolchain is fixed |
161 | if [ ! -f /usr/bin/seq ] |
162 | then |
163 | echo "Using fake 'seq' command ..." |
164 | seq() { |
165 | start=$1 |
166 | end=$2 |
167 | for ((i=start; i < end+1; i++)) |
168 | do |
169 | echo $i |
170 | done |
171 | } |
172 | export -f seq |
173 | fi |
174 | |
175 | # move old /etc/conf.d/locale to /etc/locale.conf |
176 | if [ -f ${MROOT}/etc/conf.d/locale ] |
177 | then |
178 | echo "Moving ${MROOT}/etc/conf.d/locale -> ${MROOT}/etc/locale.conf" |
179 | cp ${MROOT}/etc/conf.d/locale ${MROOT}/etc/locale.conf |
180 | rm ${MROOT}/etc/conf.d/locale |
181 | fi |
182 | |
183 | # generate a valid /etc/vconsole.conf from old data |
184 | if [ -f ${MROOT}/etc/conf.d/consolefont ] && [ -f ${MROOT}/etc/conf.d/keymap ] |
185 | then |
186 | echo "Generating ${MROOT}/etc/vconsole.conf with /etc/conf.d data" |
187 | local consolefont=$(source ${MROOT}/etc/conf.d/consolefont; echo "${CONSOLEFONT}") |
188 | local keymap=$(source ${MROOT}/etc/conf.d/keymap; echo "${KEYMAP}") |
189 | cat > ${MROOT}/etc/vconsole.conf << EOF |
190 | KEYMAP=${keymap} |
191 | FONT=${consolefont} |
192 | FONT_MAP=8851-1_to_uni |
193 | EOF |
194 | echo "Deleting old ${MROOT}/etc/conf.d/consolefont" |
195 | rm ${MROOT}/etc/conf.d/consolefont |
196 | echo "Deleting old ${MROOT}/etc/conf.d/keymap" |
197 | rm ${MROOT}/etc/conf.d/keymap |
198 | fi |
199 | |
200 | # move old sysctl.conf to new location (systemd only) |
201 | if [ -x ${MROOT}/usr/bin/systemctl ] && [ -f ${MROOT}/etc/sysctl.conf ] |
202 | then |
203 | [ -d ${MROOT}/etc/sysctl.d ] || install -d ${MROOT}/etc/sysctl.d |
204 | # only copy the file if they are not the same |
205 | if ! diff -Naur ${MROOT}/etc/sysctl.conf ${MROOT}/etc/sysctl.d/99-sysctl.conf > /dev/null |
206 | then |
207 | cp ${MROOT}/etc/sysctl.conf ${MROOT}/etc/sysctl.d/99-sysctl.conf |
208 | fi |
209 | rm ${MROOT}/etc/sysctl.conf |
210 | fi |
211 | |
212 | # sysvinit and busybox only! |
213 | if [ -f ${MROOT}/etc/rc.d/init.d/functions ] && |
214 | [[ ${BUSYBOX_ENABLED} = y ]] || [[ ${SYSVINIT_ENABLED} = y ]] |
215 | then |
216 | # create service state dir mountpoint |
217 | # needed by >=initscripts-0.3.2-r1 |
218 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
219 | |
220 | # mark this dir as undeletable |
221 | touch ${MROOT}/var/lib/init.d/.keep |
222 | |
223 | if [[ -x ${MROOT}/usr/sbin/rc-config ]] |
224 | then |
225 | echo "Creating Runlevels ..." |
226 | local i |
227 | for i in checkfs cleanfs halt \ |
228 | loadkeys localnet modules mountfs \ |
229 | network reboot sendsignals \ |
230 | setclock swap sysctl consolefont |
231 | do |
232 | echo -e "\tAdded ${i} ..." |
233 | ${MROOT}/usr/sbin/rc-config del ${i} > /dev/null |
234 | ${MROOT}/usr/sbin/rc-config add ${i} > /dev/null |
235 | done |
236 | fi |
237 | fi |
238 | |
239 | # enable network.service (systemd only) |
240 | if [ -x ${MROOT}/usr/bin/systemctl ] |
241 | then |
242 | mstartunit network.service |
243 | fi |
244 | |
245 | # keep this only for transitional purposes |
246 | # do not ask the user about following files |
247 | # |
248 | # if they exist let config_protect process them |
249 | # but then remove the protected files, to keep only the original file |
250 | # |
251 | # file-root is ${MROOT}/etc |
252 | 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" |
253 | local i file path |
254 | for i in ${CONFIG_IGNORE} |
255 | do |
256 | file="$(basename ${i})" |
257 | path="$(dirname ${i})/" |
258 | [[ ${path} == ./ ]] && path="" |
259 | |
260 | rm -f ${MROOT}/etc/${path}._cfg????_${file} |
261 | done |
262 | |
263 | # initscripts >= 0.5.0: rc file moved to /etc/conf.d/rc |
264 | if [[ -f ${MROOT}/etc/conf.d/rc ]] && [[ -f ${MROOT}/etc/sysconfig/rc ]] |
265 | then |
266 | rm -f ${MROOT}/etc/sysconfig/rc |
267 | fi |
268 | |
269 | # aliases and i368 got renamed to *.conf |
270 | local i |
271 | for i in aliases i386 |
272 | do |
273 | if [[ -f ${MROOT}/etc/modules.d/${i} ]] |
274 | then |
275 | rm ${MROOT}/etc/modules.d/${i} |
276 | fi |
277 | done |
278 | } |
279 | |
280 | preinstall() |
281 | { |
282 | # ignore this while package building |
283 | if [[ ! -f /.installrc ]] |
284 | then |
285 | local package |
286 | for package in ${BLOCKER} |
287 | do |
288 | if [[ ! -z $(magequery -n ${package##*/}) ]] |
289 | then |
290 | echo -e ${COLRED} |
291 | echo -e "Error: ${package} is installed!!" |
292 | echo -e "This initscript flavor cannot co-exist ${package}." |
293 | echo -e "Please uninstall ${package} first!" |
294 | echo -e ${COLDEFAULT} |
295 | die "${package} found!" |
296 | fi |
297 | done |
298 | fi |
299 | } |
300 | |
301 | preremove() |
302 | { |
303 | # protect these files, that they do not get removed from the system |
304 | local CONFIG_IGNORE="fstab hostname hosts" |
305 | for i in ${CONFIG_IGNORE} |
306 | do |
307 | [[ -e ${MROOT}/etc/${i} ]] && touch ${MROOT}/etc/${i} |
308 | done |
309 | } |