Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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