Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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