Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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