diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-10-15 08:26:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-10-15 08:26:52 +0000 |
commit | 72d5dc9b9952048793e49ff6ccdc1c73c56acfd3 (patch) | |
tree | 0f37c10aec586188358167164c6483a936d7d343 /sys-apps/openrc/openrc-9999.ebuild | |
parent | amd64/x86 stable, bug #287743 (diff) | |
download | gentoo-2-72d5dc9b9952048793e49ff6ccdc1c73c56acfd3.tar.gz gentoo-2-72d5dc9b9952048793e49ff6ccdc1c73c56acfd3.tar.bz2 gentoo-2-72d5dc9b9952048793e49ff6ccdc1c73c56acfd3.zip |
Rewrite the oldnet handling and make it the default for everyone.
(Portage version: 2.2_rc42/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps/openrc/openrc-9999.ebuild')
-rw-r--r-- | sys-apps/openrc/openrc-9999.ebuild | 95 |
1 files changed, 37 insertions, 58 deletions
diff --git a/sys-apps/openrc/openrc-9999.ebuild b/sys-apps/openrc/openrc-9999.ebuild index 1f054ecddc32..9270995594f1 100644 --- a/sys-apps/openrc/openrc-9999.ebuild +++ b/sys-apps/openrc/openrc-9999.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-9999.ebuild,v 1.54 2009/10/15 00:49:31 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-9999.ebuild,v 1.55 2009/10/15 08:26:52 vapier Exp $ EAPI="1" @@ -23,7 +23,7 @@ HOMEPAGE="http://roy.marples.name/openrc" LICENSE="BSD-2" SLOT="0" -IUSE="debug elibc_glibc ncurses pam unicode kernel_linux kernel_FreeBSD +oldnet" +IUSE="debug elibc_glibc ncurses pam unicode kernel_linux kernel_FreeBSD" RDEPEND="virtual/init kernel_FreeBSD? ( sys-process/fuser-bsd ) @@ -41,6 +41,7 @@ pkg_setup() { unset LIBDIR #266688 MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc" + MAKE_ARGS="${MAKE_ARGS} MKOLDNET=yes" local brand="Unknown" if use kernel_linux ; then @@ -50,9 +51,6 @@ pkg_setup() { MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD" brand="FreeBSD" fi - if use oldnet; then - MAKE_ARGS="${MAKE_ARGS} MKOLDNET=yes" - fi export BRANDING="Gentoo ${brand}" export DEBUG=$(usev debug) @@ -68,7 +66,9 @@ src_unpack() { fi cd "${S}" sed -i 's:0444:0644:' mk/sys.mk - epatch "${FILESDIR}"/9999/*.patch + [[ -d ${FILESDIR}/${PV} ]] \ + && epatch "${FILESDIR}"/${PV}/*.patch \ + || epatch "${FILESDIR}"/9999/*.patch } src_compile() { @@ -108,7 +108,12 @@ src_install() { # Backup our default runlevels dodir /usr/share/"${PN}" - mv "${D}/etc/runlevels" "${D}/usr/share/${PN}" + mv "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die + + # Stick with "old" net as the default for now + doconfd conf.d/net || die + rm -f "${D}"/usr/share/${PN}/network + ln -s /etc/init.d/net.lo "${D}"/usr/share/${PN}/net.lo # Setup unicode defaults for silly unicode users set_conf /etc/rc.conf unicode unicode @@ -118,14 +123,7 @@ src_install() { # Support for logfile rotation insinto /etc/logrotate.d - newins "${FILESDIR}/openrc.logrotate" openrc - - # makefile does no longer install conf.d/net in use oldnet case, so store it - # where we can find it at merge time - if use oldnet; then - insinto /usr/share/doc/${PN} - newins conf.d/net net.default - fi + newins "${FILESDIR}"/openrc.logrotate openrc } add_boot_init() { @@ -158,15 +156,12 @@ add_boot_init_mit_config() { pkg_preinst() { local f LIBDIR=$(get_libdir) - if use oldnet; then - # default net script is just comments, so no point in biting people - # in the ass by accident - # Can this code be moved to pkg_postinst - # or does it have side effects like protecting conf.d/net if old version - # had it in CONTENTS and it get removed if not copying it here?? - cp "${D}"/usr/share/doc/${PN}/net.default "${T}"/net - [[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${T}"/ - fi + # default net script is just comments, so no point in biting people + # in the ass by accident. we save in preinst so that the package + # manager doesnt go throwing etc-update crap at us -- postinst is + # too late to prevent that. this behavior also lets us keep the + # file in the CONTENTS for binary packages. + [[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/ # upgrade timezone file ... do it before moving clock if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then @@ -201,20 +196,18 @@ pkg_preinst() { elog "and delete /etc/conf.d/rc" fi - if use oldnet; then - # force net init.d scripts into symlinks - for f in "${ROOT}"/etc/init.d/net.* ; do - [[ -e ${f} ]] || continue # catch net.* not matching anything - [[ ${f} == */net.lo ]] && continue # real file now - [[ ${f} == *.openrc.bak ]] && continue - if [[ ! -L ${f} ]] ; then - elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink." - elog "You should delete '${f##*/}.openrc.bak' if you don't need it." - mv "${f}" "${f}.openrc.bak" - ln -snf net.lo "${f}" - fi - done - fi + # force net init.d scripts into symlinks + for f in "${ROOT}"/etc/init.d/net.* ; do + [[ -e ${f} ]] || continue # catch net.* not matching anything + [[ ${f} == */net.lo ]] && continue # real file now + [[ ${f} == *.openrc.bak ]] && continue + if [[ ! -L ${f} ]] ; then + elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink." + elog "You should delete '${f##*/}.openrc.bak' if you don't need it." + mv "${f}" "${f}.openrc.bak" + ln -snf net.lo "${f}" + fi + done # termencoding was added in 0.2.1 and needed in boot has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding @@ -238,26 +231,16 @@ pkg_preinst() { esac fi - if ! use oldnet; then - local f= links=$(find "${ROOT}"/etc/runlevels/ -name "net.*") - if [[ "${links}" != "" ]] ; then - ewarn "You have disabled installation of old-style network scripts" - ewarn "but they are still enabled in some runlevels:" - for f in $links; do - ewarn "\t$f" - done - ewarn "You should migrate the settings" - ewarn "from /etc/conf.d/net to /etc/conf.d/network" - ewarn "and clean runlevels from /etc/init.d/net.* and" - ewarn "instead add /etc/init.d/network" - fi - fi - # skip remaining migration if we already have openrc installed - has_version sys-apps/openrc && return 0 + has_version sys-apps/openrc || migrate_from_baselayout_1 +} +migrate_from_baselayout_1() { # baselayout boot init scripts have been split out for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do + # baselayout-1 is always "old" net, so ignore "new" net + [[ ${f} == "network" ]] && continue + add_boot_init ${f} done @@ -334,10 +317,6 @@ pkg_postinst() { # Remove old baselayout links rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin} - if use oldnet; then - [[ -e ${T}/net && ! -e ${ROOT}/etc/conf.d/net ]] && mv "${T}"/net "${ROOT}"/etc/conf.d/net - fi - # Make our runlevels if they don't exist if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then einfo "Copying across default runlevels" |