Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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