Contents of /branches/magellan-next/core/initscripts/initscripts-0.6.0-r1.smage2
Parent Directory | Revision Log
Revision 7897 -
(show annotations)
(download)
Fri Jun 3 19:01:08 2011 UTC (13 years ago) by niro
File size: 4652 byte(s)
Fri Jun 3 19:01:08 2011 UTC (13 years ago) by niro
File size: 4652 byte(s)
-provide initscripts
1 | # $Id$ |
2 | |
3 | PNAME="initscripts" |
4 | PVER="0.6.0" |
5 | PBUILD="r1" |
6 | |
7 | PCATEGORIE="sys-apps" |
8 | STATE="unstable" |
9 | |
10 | DESCRIPTION="Magellan Initscripts for sysVinit." |
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/coreutils-5 |
16 | >= sys-apps/findutils-4 |
17 | >= sys-apps/grep-2 |
18 | >= sys-apps/sed-4 |
19 | >= sys-apps/gawk-3 |
20 | >= app-arch/bzip2-1 |
21 | >= sys-apps/tar-1 |
22 | >= net-misc/rsync-2 |
23 | >= net-misc/wget-1 |
24 | >= sys-apps/sysvinit-2.88 |
25 | >= sys-apps/which-2.20" |
26 | |
27 | PROVIDE="virtual/initscripts" |
28 | |
29 | SRCFILE="${PNAME}-${PVER}.tar.bz2" |
30 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
31 | |
32 | sminclude cvs rsync |
33 | |
34 | # available options are source/rsync |
35 | METHOD=source |
36 | |
37 | # fixes mageversion; |
38 | # the makefile uses the date as version number |
39 | # but for release we want to use the release version |
40 | RELEASE_MAGEVERSION= |
41 | |
42 | case ${METHOD} in |
43 | cvs) SDEPEND=">= dev-util/cvs-1.11" ;; |
44 | rsync) SDEPEND=">= net-misc/rsync-2.6.9" ;; |
45 | source) SDEPEND="" ;; |
46 | esac |
47 | |
48 | [[ ${METHOD} = source ]] && SRC_URI=( mirror://${PNAME}/${SRCFILE} ) |
49 | |
50 | src_prepare() |
51 | { |
52 | [[ ${METHOD} = source ]] && { munpack ${SRCFILE} || die; } |
53 | |
54 | if [[ ${METHOD} = rsync ]] |
55 | then |
56 | RSYNC_URI="rsync://magellan-linux.de/${PNAME}-${PVER}-${PBUILD}" |
57 | rsync_fetch_source || die |
58 | fi |
59 | |
60 | if [[ ${METHOD} = cvs ]] |
61 | then |
62 | MY_CVS_MODULE="magellan-src/magellan-initscripts" |
63 | # $PVER must be eg 0_3_3 |
64 | MY_CVS_OPTS="-r init-$(echo ${PVER}| sed -e "s|\.|\_|g")-${PBUILD}" |
65 | export CVSROOT=:pserver:anonymous:@magellan-linux.de:/magellan-cvs |
66 | cvs_fetch_source || die |
67 | fi |
68 | } |
69 | |
70 | src_compile() |
71 | { |
72 | cd ${SRCDIR} |
73 | mmake || die |
74 | } |
75 | |
76 | src_install() |
77 | { |
78 | cd ${SRCDIR} |
79 | make DESTDIR=${BINDIR} install || die |
80 | |
81 | # CONFIG_PROTECT_MASK for /etc/rc.d/init.d |
82 | install -d ${BINDIR}/etc/env.d || die |
83 | echo "CONFIG_PROTECT_MASK=\"/etc/rc.d/init.d\"" > ${BINDIR}/etc/env.d/01initscripts || die |
84 | # always overwrite /etc/mageversion |
85 | echo 'CONFIG_PROTECT_MASK="/etc/mageversion"' >> ${BINDIR}/etc/env.d/01initscripts || die |
86 | # always keep this files even if the user edited them |
87 | local config_protect_ignore |
88 | config_protect_ignore="/etc/fstab" |
89 | config_protect_ignore+=" /etc/group" |
90 | config_protect_ignore+=" /etc/hostname" |
91 | config_protect_ignore+=" /etc/hosts" |
92 | config_protect_ignore+=" /etc/inittab" |
93 | config_protect_ignore+=" /etc/passwd" |
94 | config_protect_ignore+=" /etc/conf.d/net.eth0" |
95 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.4" |
96 | config_protect_ignore+=" /etc/modules.autoload.d/kernel-2.6" |
97 | config_protect_ignore+=" /etc/modules.autoload" |
98 | echo "CONFIG_PROTECT_IGNORE=\"${config_protect_ignore}\"" >> ${BINDIR}/etc/env.d/01initscripts || die |
99 | |
100 | # fix mageversion if any release version is given |
101 | if [[ ! -z ${RELEASE_MAGEVERSION} ]] |
102 | then |
103 | echo "${RELEASE_MAGEVERSION}" > ${BINDIR}/etc/mageversion || die |
104 | fi |
105 | } |
106 | |
107 | postinstall() |
108 | { |
109 | # emulate seq; its needed to run rc-config |
110 | # this fixes some annyoing warning when building |
111 | # livecd or bootstrapping a system. |
112 | # this hack will be removed when the toolchain is fixed |
113 | if [ ! -f /usr/bin/seq ] |
114 | then |
115 | echo "Using fake 'seq' command ..." |
116 | seq() { |
117 | start=$1 |
118 | end=$2 |
119 | for ((i=start; i < end+1; i++)) |
120 | do |
121 | echo $i |
122 | done |
123 | } |
124 | export -f seq |
125 | fi |
126 | |
127 | # create service state dir mountpoint |
128 | # needed by >=initscripts-0.3.2-r1 |
129 | [ ! -d ${MROOT}/var/lib/init.d ] && install -d ${MROOT}/var/lib/init.d |
130 | |
131 | # mark this dir as undeletable |
132 | touch ${MROOT}/var/lib/init.d/.keep |
133 | |
134 | echo "Creating Runlevels ..." |
135 | local i |
136 | for i in checkfs cleanfs halt \ |
137 | loadkeys localnet modules mountfs \ |
138 | network reboot sendsignals \ |
139 | setclock swap sysctl consolefont |
140 | do |
141 | echo -e "\tAdded ${i} ..." |
142 | ${MROOT}/sbin/rc-config del ${i} > /dev/null |
143 | ${MROOT}/sbin/rc-config add ${i} > /dev/null |
144 | done |
145 | |
146 | # keep this only for transitional purposes |
147 | # do not ask the user about following files |
148 | # |
149 | # if they exist let config_protect process them |
150 | # but then remove the protected files, to keep only the original file |
151 | # |
152 | # file-root is ${MROOT}/etc |
153 | 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 modules.autoload" |
154 | local i file path |
155 | for i in ${CONFIG_IGNORE} |
156 | do |
157 | file="$(basename ${i})" |
158 | path="$(dirname ${i})/" |
159 | [[ ${path} == ./ ]] && path="" |
160 | |
161 | rm -f ${MROOT}/etc/${path}._cfg????_${file} |
162 | done |
163 | |
164 | # initscripts >= 0.5.0: rc file moved to /etc/conf.d/rc |
165 | if [[ -f ${MROOT}/etc/conf.d/rc ]] && [[ -f ${MROOT}/etc/sysconfig/rc ]] |
166 | then |
167 | rm -f ${MROOT}/etc/sysconfig/rc |
168 | fi |
169 | |
170 | # aliases and i368 got renamed to *.conf |
171 | local i |
172 | for i in aliases i386 |
173 | do |
174 | if [[ -f ${MROOT}/etc/modules.d/${i} ]] |
175 | then |
176 | rm ${MROOT}/etc/modules.d/${i} |
177 | fi |
178 | done |
179 | } |