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 2095 - (show annotations) (download)
Thu May 12 12:24:37 2011 UTC (13 years, 1 month ago) by niro
File size: 4689 byte(s)
-conf_prot setup
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 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
129 #
130 # do not ask the user about following files
131 #
132 # if they exist let config_protect process them
133 # but then remove the protected files, to keep only the original file
134 #
135 # don't do this if MAGE_BOOTSTRAP=true is set!
136 if [[ ${MAGE_BOOTSTRAP} = true ]]
137 then
138 echo "bootstrap phase - ignoring autocleanup"
139 else
140 # file-root is ${MROOT}/etc
141 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"
142 local i file path
143 for i in ${CONFIG_IGNORE}
144 do
145 file="$(basename ${i})"
146 path="$(dirname ${i})/"
147 [[ ${path} == ./ ]] && path=""
148
149 rm -f ${MROOT}/etc/${path}._cfg????_${file}
150 done
151 fi
152
153 # fix mtab
154 if [[ ! -L ${MROOT}/etc/mtab ]] || [[ $(readlink ${MROOT}/etc/mtab) != /proc/mounts ]]
155 then
156 ln -snf /proc/mounts ${MROOT}/etc/mtab
157 fi
158
159 # remove old alx initscripts
160 local target
161 for target in ${DEPRECATED_MAGE_TARGETS}
162 do
163 if [[ ! -z $(magequery -n initscripts-${target}) ]]
164 then
165 echo "removing deprecated mage-target 'initscripts-${target}'"
166 mage uninstall initscripts-${target} || die
167 fi
168 done
169 }