Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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