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