Magellan Linux

Contents of /smage/tags/alx-0_6_0/core/busybox-initscripts/busybox-initscripts-0.7.0.3-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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