Magellan Linux

Annotation of /smage/branches/alx-0_6_0/core/busybox-initscripts/busybox-initscripts-0.7.0.3-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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