Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6902 - (show annotations) (download)
Mon Jul 27 07:46:48 2015 UTC (8 years, 10 months ago) by niro
File size: 6245 byte(s)
-update config protection
1 # $Id$
2
3 PNAME="busybox-initscripts"
4 PVER="0.7.0.3"
5 PBUILD="r7"
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 # CONFIG_PROTECT_MASK for /etc/rc.d/init.d
75 install -d ${BINDIR}/etc/env.d || die
76 echo "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" > ${BINDIR}/etc/env.d/01initscripts || die
77 # always keep this files even if the user did not edited them
78 local config_protect_ignore
79 config_protect_ignore="/etc/fstab"
80 config_protect_ignore+=" /etc/group"
81 config_protect_ignore+=" /etc/hostname"
82 config_protect_ignore+=" /etc/hosts"
83 config_protect_ignore+=" /etc/inittab"
84 config_protect_ignore+=" /etc/passwd"
85 config_protect_ignore+=" /etc/shadow"
86 config_protect_ignore+=" /etc/conf.d/net.eth0"
87 config_protect_ignore+=" /etc/conf.d/net.routes"
88 config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4"
89 config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6"
90 config_protect_ignore+=" /etc/modules.autoload"
91 # add conf.d/kernel to protect current udev|mdev configuration
92 config_protect_ignore+=" /etc/conf.d/kernel"
93 echo "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" >> ${BINDIR}/etc/env.d/01initscripts || die
94
95 # always use udev on alx
96 sed -i 's:^\(RC_DEVICEMANAGER=\).*:\1udev:' ${BINDIR}/etc/conf.d/kernel || die
97
98 # an extra package from now on
99 if [[ -f ${BINDIR}/etc/mageversion ]]
100 then
101 rm ${BINDIR}/etc/mageversion || die
102 fi
103 if [[ -f ${BINDIR}/etc/system-release ]]
104 then
105 rm ${BINDIR}/etc/system-release || die
106 fi
107 }
108
109 preinstall()
110 {
111 add_conf_prot_mask /etc/env.d /etc/modprobe.d /etc/rc.d/init.d /etc/profile /etc/inputrc \
112 /etc/shells /etc/issue /etc/DIR_COLORS /etc/inittab \
113 /etc/conf.d/net.sample /etc/conf.d/kernel /etc/conf.d/rc /etc/conf.d/network \
114 /etc/conf.d/locale
115
116 add_conf_prot_ignore /etc/fstab /etc/group /etc/hostname /etc/hosts /etc/modules.autoload \
117 /etc/passwd /etc/shadow /etc/conf.d/clock /etc/conf.d/editor /etc/conf.d/keymap \
118 /etc/conf.d/net.routes
119 }
120
121 postinstall()
122 {
123 # emulate seq; its needed to run rc-config
124 # this fixes some annyoing warning when building
125 # livecd or bootstrapping a system.
126 # this hack will be removed when the toolchain is fixed
127 if [ ! -f /usr/bin/seq ]
128 then
129 echo "Using fake 'seq' command ..."
130 seq() {
131 start=$1
132 end=$2
133 for ((i=start; i < end+1; i++))
134 do
135 echo $i
136 done
137 }
138 export -f seq
139 fi
140
141 # create service state dir mountpoint
142 # needed by >=initscripts-0.3.2-r1
143 [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d
144
145 # mark this dir as undeletable
146 touch ${MROOT}/var/lib/init.d/.keep
147
148 echo "Creating Runlevels ..."
149 local i
150 for i in cleanfs \
151 loadkeys \
152 localnet \
153 modules \
154 mountfs \
155 network \
156 setclock \
157 swap
158 do
159 echo -e "\tAdded ${i} ..."
160 ${MROOT}/sbin/rc-config del ${i} > /dev/null
161 ${MROOT}/sbin/rc-config add ${i} > /dev/null
162 done
163 # delete these
164 for i in checkfs
165 do
166 echo -e "\rDeleted ${i} ..."
167 ${MROOT}/sbin/rc-config del ${i} > /dev/null
168 done
169
170 #
171 # do not ask the user about following files
172 #
173 # if they exist let config_protect process them
174 # but then remove the protected files, to keep only the original file
175 #
176 # don't do this if MAGE_BOOTSTRAP=true is set!
177 if [[ ${MAGE_BOOTSTRAP} = true ]]
178 then
179 echo "bootstrap phase - ignoring autocleanup"
180 else
181 # file-root is ${MROOT}/etc
182 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"
183 local i file path
184 for i in ${CONFIG_IGNORE}
185 do
186 file="$(basename ${i})"
187 path="$(dirname ${i})/"
188 [[ ${path} == ./ ]] && path=""
189
190 rm -f ${MROOT}/etc/${path}._cfg????_${file}
191 done
192 fi
193
194 # fix mtab
195 if [[ ! -L ${MROOT}/etc/mtab ]] || [[ $(readlink ${MROOT}/etc/mtab) != /proc/mounts ]]
196 then
197 ln -snf /proc/mounts ${MROOT}/etc/mtab
198 fi
199
200 # remove /etc/modprobe.conf
201 if [[ -f ${MROOT}/etc/modprobe.conf ]] && [[ -d ${MROOT}/etc/modprobe.d ]]
202 then
203 rm ${MROOT}/etc/modprobe.conf
204 fi
205
206 # remove old alx initscripts
207 local target
208 for target in ${DEPRECATED_MAGE_TARGETS}
209 do
210 if [[ ! -z $(magequery -n initscripts-${target}) ]]
211 then
212 echo "removing deprecated mage-target 'initscripts-${target}'"
213 mage uninstall initscripts-${target} || die
214 fi
215 done
216 }