Gentoo Archives: gentoo-commits

From: "William Hubbs (williamh)" <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/openrc: ChangeLog openrc-0.8.2-r1.ebuild
Date: Thu, 28 Apr 2011 19:51:02
Message-Id: 20110428195051.7D2C420054@flycatcher.gentoo.org
1 williamh 11/04/28 19:50:51
2
3 Modified: ChangeLog
4 Added: openrc-0.8.2-r1.ebuild
5 Log:
6 revision bump for local.d migration fix
7
8 (Portage version: 2.2.0_alpha30/cvs/Linux i686)
9
10 Revision Changes Path
11 1.145 sys-apps/openrc/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/openrc/ChangeLog?rev=1.145&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/openrc/ChangeLog?rev=1.145&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/openrc/ChangeLog?r1=1.144&r2=1.145
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-apps/openrc/ChangeLog,v
20 retrieving revision 1.144
21 retrieving revision 1.145
22 diff -u -r1.144 -r1.145
23 --- ChangeLog 17 Apr 2011 21:02:51 -0000 1.144
24 +++ ChangeLog 28 Apr 2011 19:50:51 -0000 1.145
25 @@ -1,6 +1,11 @@
26 # ChangeLog for sys-apps/openrc
27 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/ChangeLog,v 1.144 2011/04/17 21:02:51 williamh Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/ChangeLog,v 1.145 2011/04/28 19:50:51 williamh Exp $
30 +
31 +*openrc-0.8.2-r1 (28 Apr 2011)
32 +
33 + 28 Apr 2011; William Hubbs <williamh@g.o> +openrc-0.8.2-r1.ebuild:
34 + Revision bump for local.d migration fix
35
36 17 Apr 2011; William Hubbs <williamh@g.o> openrc-9999.ebuild:
37 fix the migration of /etc/conf.d/local.* for bug #363949.
38
39
40
41 1.1 sys-apps/openrc/openrc-0.8.2-r1.ebuild
42
43 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild?rev=1.1&view=markup
44 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild?rev=1.1&content-type=text/plain
45
46 Index: openrc-0.8.2-r1.ebuild
47 ===================================================================
48 # Copyright 1999-2011 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50 # $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild,v 1.1 2011/04/28 19:50:51 williamh Exp $
51
52 EAPI="1"
53
54 inherit eutils flag-o-matic multilib toolchain-funcs
55
56 if [[ ${PV} == "9999" ]] ; then
57 EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/openrc.git"
58 inherit git
59 KEYWORDS=""
60 else
61 SRC_URI="mirror://gentoo/${P}.tar.bz2"
62 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
63 fi
64
65 DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
66 HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
67
68 LICENSE="BSD-2"
69 SLOT="0"
70 IUSE="debug elibc_glibc ncurses pam selinux unicode kernel_linux kernel_FreeBSD"
71
72 RDEPEND="virtual/init
73 kernel_FreeBSD? ( sys-process/fuser-bsd )
74 elibc_glibc? ( >=sys-libs/glibc-2.5 )
75 ncurses? ( sys-libs/ncurses )
76 pam? ( virtual/pam )
77 >=sys-apps/baselayout-2.0.0
78 kernel_linux? ( !<sys-apps/module-init-tools-3.2.2-r2 )
79 !<sys-fs/udev-133
80 !<sys-apps/sysvinit-2.86-r11"
81 DEPEND="${RDEPEND}
82 virtual/os-headers"
83
84 make_args() {
85 unset LIBDIR #266688
86
87 MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
88 MAKE_ARGS="${MAKE_ARGS} MKOLDNET=yes"
89
90 local brand="Unknown"
91 if use kernel_linux ; then
92 MAKE_ARGS="${MAKE_ARGS} OS=Linux"
93 brand="Linux"
94 elif use kernel_FreeBSD ; then
95 MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
96 brand="FreeBSD"
97 fi
98 if use selinux; then
99 MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
100 fi
101 export BRANDING="Gentoo ${brand}"
102 }
103
104 pkg_setup() {
105 export DEBUG=$(usev debug)
106 export MKPAM=$(usev pam)
107 export MKTERMCAP=$(usev ncurses)
108 }
109
110 src_unpack() {
111 if [[ ${PV} == "9999" ]] ; then
112 git_src_unpack
113 else
114 unpack ${A}
115 fi
116 cd "${S}"
117 sed -i 's:0444:0644:' mk/sys.mk
118 sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile #241342
119
120 # Allow user patches to be applied without modifying the ebuild
121 epatch_user
122 }
123
124 src_compile() {
125 make_args
126
127 if [[ ${PV} == "9999" ]] ; then
128 local ver="git-$(echo ${EGIT_VERSION} | cut -c1-8)"
129 sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk
130 fi
131
132 tc-export CC AR RANLIB
133 emake ${MAKE_ARGS} || die "emake ${MAKE_ARGS} failed"
134 }
135
136 # set_config <file> <option name> <yes value> <no value> test
137 # a value of "#" will just comment out the option
138 set_config() {
139 local file="${D}/$1" var=$2 val com
140 eval "${@:5}" && val=$3 || val=$4
141 [[ ${val} == "#" ]] && com="#" && val='\2'
142 sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
143 }
144 set_config_yes_no() {
145 set_config "$1" "$2" YES NO "${@:3}"
146 }
147
148 src_install() {
149 make_args
150 emake ${MAKE_ARGS} DESTDIR="${D}" install || die
151
152 # install the readme for the new network scripts
153 dodoc README.newnet
154
155 # move the shared libs back to /usr so ldscript can install
156 # more of a minimal set of files
157 # disabled for now due to #270646
158 #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
159 #gen_usr_ldscript -a einfo rc
160 gen_usr_ldscript libeinfo.so
161 gen_usr_ldscript librc.so
162
163 keepdir /$(get_libdir)/rc/{init.d,tmp}
164
165 # Backup our default runlevels
166 dodir /usr/share/"${PN}"
167 cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
168 rm -rf "${D}"/etc/runlevels
169
170 # Stick with "old" net as the default for now
171 doconfd conf.d/net || die
172 pushd "${D}"/usr/share/${PN}/runlevels/boot > /dev/null
173 rm -f network staticroute
174 ln -s /etc/init.d/net.lo net.lo
175 popd > /dev/null
176
177 # Setup unicode defaults for silly unicode users
178 set_config_yes_no /etc/rc.conf unicode use unicode
179
180 # Cater to the norm
181 set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
182
183 # On HPPA, do not run consolefont by default (bug #222889)
184 if use hppa; then
185 rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
186 fi
187
188 # Support for logfile rotation
189 insinto /etc/logrotate.d
190 newins "${FILESDIR}"/openrc.logrotate openrc
191 }
192
193 add_boot_init() {
194 local initd=$1
195 local runlevel=${2:-boot}
196 # if the initscript is not going to be installed and is not
197 # currently installed, return
198 [[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
199 || return
200 [[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
201
202 # if runlevels dont exist just yet, then create it but still flag
203 # to pkg_postinst that it needs real setup #277323
204 if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
205 mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
206 touch "${ROOT}"/etc/runlevels/.add_boot_init.created
207 fi
208
209 elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
210 ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
211 }
212 add_boot_init_mit_config() {
213 local config=$1 initd=$2
214 if [[ -e ${ROOT}${config} ]] ; then
215 if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
216 add_boot_init ${initd}
217 fi
218 fi
219 }
220
221 pkg_preinst() {
222 local f LIBDIR=$(get_libdir)
223
224 # default net script is just comments, so no point in biting people
225 # in the ass by accident. we save in preinst so that the package
226 # manager doesnt go throwing etc-update crap at us -- postinst is
227 # too late to prevent that. this behavior also lets us keep the
228 # file in the CONTENTS for binary packages.
229 [[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
230
231 # avoid default thrashing in conf.d files when possible #295406
232 if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
233 (
234 unset hostname HOSTNAME
235 source "${ROOT}"/etc/conf.d/hostname
236 : ${hostname:=${HOSTNAME}}
237 [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
238 )
239 fi
240
241 # upgrade timezone file ... do it before moving clock
242 if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
243 (
244 unset TIMEZONE
245 source "${ROOT}"/etc/conf.d/clock
246 [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
247 )
248 fi
249
250 # /etc/conf.d/clock moved to /etc/conf.d/hwclock
251 local clock
252 use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
253 if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
254 mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
255 fi
256 if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
257 rm -f "${ROOT}"/etc/init.d/clock
258 fi
259 if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
260 rm -f "${ROOT}"/etc/runlevels/boot/clock
261 ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
262 fi
263 if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
264 rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
265 ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
266 fi
267
268 # /etc/conf.d/rc is no longer used for configuration
269 if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
270 elog "/etc/conf.d/rc is no longer used for configuration."
271 elog "Please migrate your settings to /etc/rc.conf as applicable"
272 elog "and delete /etc/conf.d/rc"
273 fi
274
275 # force net init.d scripts into symlinks
276 for f in "${ROOT}"/etc/init.d/net.* ; do
277 [[ -e ${f} ]] || continue # catch net.* not matching anything
278 [[ ${f} == */net.lo ]] && continue # real file now
279 [[ ${f} == *.openrc.bak ]] && continue
280 if [[ ! -L ${f} ]] ; then
281 elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
282 elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
283 mv "${f}" "${f}.openrc.bak"
284 ln -snf net.lo "${f}"
285 fi
286 done
287
288 # termencoding was added in 0.2.1 and needed in boot
289 has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
290
291 # set default interactive shell to sulogin if it exists
292 set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
293
294 has_version sys-apps/openrc || migrate_from_baselayout_1
295 has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
296 }
297
298 # >=openrc-0.4.0 no longer loads the udev addon
299 migrate_udev_init_script() {
300 # make sure udev is in sysinit if it was enabled before
301 local enable_udev=false
302 local rc_devices=$(
303 [[ -f /etc/rc.conf ]] && source /etc/rc.conf
304 [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
305 echo "${rc_devices:-${RC_DEVICES:-auto}}"
306 )
307 case ${rc_devices} in
308 udev|auto)
309 enable_udev=true
310 ;;
311 esac
312
313 if $enable_udev; then
314 add_boot_init udev sysinit
315 add_boot_init udev-postmount default
316 fi
317 }
318
319 migrate_from_baselayout_1() {
320 # baselayout boot init scripts have been split out
321 for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
322 # baselayout-1 is always "old" net, so ignore "new" net
323 [[ ${f} == "network" ]] && continue
324
325 add_boot_init ${f}
326 done
327
328 # Try to auto-add some addons when possible
329 add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
330 add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
331 add_boot_init_mit_config /etc/mdadm.conf mdraid
332 add_boot_init_mit_config /etc/evms.conf evms
333 [[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
334 [[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
335 elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
336 elog "init.d scripts. If you use such a thing, make sure you have the"
337 elog "required init.d scripts added to your boot runlevel."
338
339 # Upgrade out state for baselayout-1 users
340 if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
341 (
342 [[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
343 svcdir=${svcdir:-/var/lib/init.d}
344 if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
345 ewarn "No state found, and no state exists"
346 elog "You should reboot this host"
347 else
348 mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
349 einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
350 mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
351 rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
352 "${ROOT}${LIBDIR}"/rc/init.d/console
353 umount "${ROOT}${svcdir}" 2>/dev/null
354 rm -rf "${ROOT}${svcdir}"
355 fi
356 )
357 fi
358
359 # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
360 if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
361 elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
362 rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
363 rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
364 if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
365 local f v
366 for f in "${ROOT}"/etc/modules.autoload.d/* ; do
367 v=${f##*/}
368 v=${v#kernel-}
369 v=${v//[^[:alnum:]]/_}
370 gawk -v v="${v}" -v f="${f##*/}" '
371 BEGIN { print "\n### START: Auto-converted from " f "\n" }
372 {
373 if ($0 ~ /^[^#]/) {
374 print "modules_" v "=\"${modules_" v "} " $1 "\""
375 gsub(/[^[:alnum:]]/, "_", $1)
376 printf "module_" $1 "_args_" v "=\""
377 for (i = 2; i <= NF; ++i) {
378 if (i > 2)
379 printf " "
380 printf $i
381 }
382 print "\"\n"
383 } else
384 print
385 }
386 END { print "\n### END: Auto-converted from " f "\n" }
387 ' "${f}" >> "${D}"/etc/conf.d/modules
388 done
389 rm -f "${f}"
390 rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
391 fi
392 fi
393 }
394
395 pkg_postinst() {
396 local LIBDIR=$(get_libdir)
397
398 # Remove old baselayout links
399 rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
400 rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
401
402 # Make our runlevels if they don't exist
403 if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
404 einfo "Copying across default runlevels"
405 cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
406 rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
407 else
408 if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
409 mkdir -p "${ROOT}"/etc/runlevels/sysinit
410 cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
411 "${ROOT}"/etc/runlevels/sysinit
412 fi
413 if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
414 mkdir -p "${ROOT}"/etc/runlevels/shutdown
415 cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
416 "${ROOT}"/etc/runlevels/shutdown
417 fi
418 fi
419
420 # /etc/conf.d/net.example is no longer valid
421 local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
422 local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
423 if [[ -e "${NET_EXAMPLE}" ]] ; then
424 if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
425 rm -f "${NET_EXAMPLE}"
426 elog "${NET_EXAMPLE} has been removed."
427 else
428 sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
429 elog "${NET_EXAMPLE} should be removed."
430 fi
431 elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
432 fi
433
434 # /etc/conf.d/wireless.example is no longer valid
435 local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
436 local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
437 if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
438 if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
439 rm -f "${WIRELESS_EXAMPLE}"
440 elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
441 else
442 sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
443 elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
444 fi
445 elog "If you are using the old style network scripts,"
446 elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
447 elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
448 fi
449
450 if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
451 ewarn "/etc/modules.autoload.d is no longer used. Please convert"
452 ewarn "your files to /etc/conf.d/modules and delete the directory."
453 fi
454
455 if use hppa; then
456 elog "Setting the console font does not work on all HPPA consoles."
457 elog "You can still enable it by running:"
458 elog "# rc-update add consolefont boot"
459 fi
460
461 # Handle the conf.d/local.{start,stop} -> local.d transition
462 if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
463 elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
464 elog "files to ${ROOT}etc/local.d"
465 mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
466 mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
467 chmod +x "${ROOT}"etc/local.d/*{start,stop}
468 fi
469
470 # update the dependency tree after touching all files #224171
471 [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
472
473 elog "You should now update all files in /etc, using etc-update"
474 elog "or equivalent before restarting any services or this host."
475 elog
476 elog "Please read the migration guide available at:"
477 elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
478 }