Magellan Linux

Contents of /smage/branches/alx-0_6_0/core/busybox-initscripts/busybox-initscripts-0.7.0.3-r9.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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