summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@gentoo.org>2008-04-15 05:59:47 +0000
committerDoug Goldstein <cardoe@gentoo.org>2008-04-15 05:59:47 +0000
commit8f3a292de179fe5b1a7c645965e96bd2949502b1 (patch)
treee8032593eaa893a455ca4023a61b5b4f6de5ae64 /sys-apps/openrc
parentStable on ppc64; bug #217700 (diff)
downloadhistorical-8f3a292de179fe5b1a7c645965e96bd2949502b1.tar.gz
historical-8f3a292de179fe5b1a7c645965e96bd2949502b1.tar.bz2
historical-8f3a292de179fe5b1a7c645965e96bd2949502b1.zip
fix bug #216944 and other assorted issues
Package-Manager: portage-2.1.5_rc3
Diffstat (limited to 'sys-apps/openrc')
-rw-r--r--sys-apps/openrc/ChangeLog11
-rw-r--r--sys-apps/openrc/Manifest13
-rw-r--r--sys-apps/openrc/files/openrc-0.2.1-bad--help-output.patch20
-rw-r--r--sys-apps/openrc/files/openrc-0.2.1-no-deref-null.patch21
-rw-r--r--sys-apps/openrc/files/openrc-0.2.1-openvz-support.patch53
-rw-r--r--sys-apps/openrc/files/openrc-0.2.1-respect-fastboot.patch43
-rw-r--r--sys-apps/openrc/openrc-0.2.1-r2.ebuild272
7 files changed, 428 insertions, 5 deletions
diff --git a/sys-apps/openrc/ChangeLog b/sys-apps/openrc/ChangeLog
index 715f0d5d46d9..7d50975ebaf8 100644
--- a/sys-apps/openrc/ChangeLog
+++ b/sys-apps/openrc/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-apps/openrc
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/ChangeLog,v 1.28 2008/04/14 20:51:05 cardoe Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/ChangeLog,v 1.29 2008/04/15 05:59:46 cardoe Exp $
+
+*openrc-0.2.1-r2 (15 Apr 2008)
+
+ 15 Apr 2008; Doug Goldstein <cardoe@gentoo.org>
+ +files/openrc-0.2.1-bad--help-output.patch,
+ +files/openrc-0.2.1-no-deref-null.patch,
+ +files/openrc-0.2.1-openvz-support.patch,
+ +files/openrc-0.2.1-respect-fastboot.patch, +openrc-0.2.1-r2.ebuild:
+ fix bug #216944 and other assorted issues
14 Apr 2008; Doug Goldstein <cardoe@gentoo.org> openrc-0.2.1-r1.ebuild,
openrc-9999.ebuild:
diff --git a/sys-apps/openrc/Manifest b/sys-apps/openrc/Manifest
index 332bbdbf050a..2d61724855b9 100644
--- a/sys-apps/openrc/Manifest
+++ b/sys-apps/openrc/Manifest
@@ -4,16 +4,21 @@ Hash: SHA1
AUX 9999/0001-msg-style.patch 1709 RMD160 c8f22d90c66cd99da701d0840094694d96269def SHA1 2983c97f1b3c770d9b2afce4540d6d8a7db8abe7 SHA256 5a5d7cd9c0289eb9e7332b01aa15331e8497579efc78ea4d833400d00cb46f7b
AUX 9999/0002-useful-functions.patch 1797 RMD160 ac61d166b15c46187e3ed738f52e69441e6cba8b SHA1 f621a75b0965ce2dde74307046df21a050f3ffc6 SHA256 c475e38f5eabe8b1482a2bbc155d944c9ccc8d9bd8f3cdc85068362a898c130a
AUX 9999/0003-KV.patch 2569 RMD160 7ccbca71beba996aedcec5aa1def57a96c008893 SHA1 d3489d7a34f9984b4267819677b5e4549c12fc00 SHA256 dab3a00036718ea99058f362d84a4bac5e9bbd4eff934f1ad1d4da85c8551539
+AUX openrc-0.2.1-bad--help-output.patch 655 RMD160 e0e8f31cdf1259fa49b2c88b8e7c5869826fc7ef SHA1 ee3db3cc2e1e3e782edf782c0809c24c8259034d SHA256 8512c221f3208bda87b2d73302a97f21d4fbef9d119cedb353a40bc14cdae025
AUX openrc-0.2.1-empty-list-crash.patch 3233 RMD160 aec6971845422c1675024a82c3cd354c9b852ece SHA1 5a5e268d0ee92ef4ca7ea98419d94eff8c81bf61 SHA256 745c949de76a3019b980a55fea126d0168783e6c94b455160fbf45d760e884f2
+AUX openrc-0.2.1-no-deref-null.patch 791 RMD160 5e481df49daa55449e18065d9a80674eebfd8a0b SHA1 1c4dfe8db5efde3502a28674d1cd27f555ebae82 SHA256 207e5803bdc09156b2a22a8ea846d39655b35624402de707c3b1a0af93e2fd7b
+AUX openrc-0.2.1-openvz-support.patch 1811 RMD160 00e34172d2de8bc40bf8bb3d182c05ed2b4123e5 SHA1 64870f3b44ff39420d773c43517a759e73c08d67 SHA256 12affb0fdb0369c4af72ed24ae9a589b2c5799b335bec7df88a94d25040bc572
+AUX openrc-0.2.1-respect-fastboot.patch 1052 RMD160 2be0b1d912a8e7c9555ef25bcfa2559d2d5fd0d3 SHA1 2b206580e050fccfe59cb572a7177f437489a69c SHA256 1f24f2a804113d9b23f3277e77d2364ea21fd2ab85f01b258afb03b2ca3adddf
DIST openrc-0.2.1.tar.bz2 141896 RMD160 67dfc4362181bd4d80c962209881aad3163cbee7 SHA1 f20729300d463a682cdb297c2c859c6e36f7e535 SHA256 226b75499e0220148ceedce76fc649bceb4a7fd52e5eb344d0ff149a4876e752
EBUILD openrc-0.2.1-r1.ebuild 8619 RMD160 a1ade39c3bdcb9b0d4ab6da682904996e198b2a5 SHA1 2cf82868cf2a1d95f9dcea7ac29c355759c7f6f5 SHA256 37c5b741fb4381e1b7cb7b2afa03de66b1ceefbcaf32464807889377382e5285
+EBUILD openrc-0.2.1-r2.ebuild 8842 RMD160 949e081dc137f8389454a72d305454ecdbb0f745 SHA1 8e1fa8dbc283f72c6e6096b040d9f700a0481442 SHA256 95fec575f9561d92d82b791892f35eba1c178b8006f1f130b385895d558668fd
EBUILD openrc-9999.ebuild 8336 RMD160 a3066fb89d0caf9fe8e2961c85425d5f4c7b2a65 SHA1 6777b897e35ca042318540916f062cd58164d8db SHA256 d56d7dd0f1788b30d9808f9ae321b639a5c7738cbb18e7f4d9244e0de277fedd
-MISC ChangeLog 4803 RMD160 b4bff9309d772631f82153a6b827944b0b16bdbb SHA1 3ec03732ce1ef3068a8f8922c66a21ce0b268d7e SHA256 74260a2491d7e3e0051a53a5361d49f7abc3681a67519fb104124f553864f501
+MISC ChangeLog 5134 RMD160 5de8abf2267cbd4016d07581fe07fffa3dfe2eed SHA1 6adbc7cfd3d4fba7528e5d817f973007c9dc58e1 SHA256 54f62614be615a85935289eca9e49c53208f63ba07e1d4af68ead2d74e63a22c
MISC metadata.xml 164 RMD160 f43cbec30b7074319087c9acffdb9354b17b0db3 SHA1 9c213f5803676c56439df3716be07d6692588856 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
-iEYEARECAAYFAkgDxGoACgkQoeSe8B0zEfwL5wCeOm2X8uD1pDvvRUpP9ogkQmqC
-ZU0Amwa5r6E5sQasUO/XseH0PUDc8OWv
-=lsI3
+iEYEARECAAYFAkgERFwACgkQoeSe8B0zEfwJtwCcDYwAfRk2MPnGUALKJ3jykHxU
+NP0An3BAmjVEvv8XMrT6x6agBfEvtikK
+=JjpK
-----END PGP SIGNATURE-----
diff --git a/sys-apps/openrc/files/openrc-0.2.1-bad--help-output.patch b/sys-apps/openrc/files/openrc-0.2.1-bad--help-output.patch
new file mode 100644
index 000000000000..c982bcc00ff8
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.2.1-bad--help-output.patch
@@ -0,0 +1,20 @@
+From: Roy Marples <roy@marples.name>
+Date: Mon, 7 Apr 2008 11:48:32 +0000 (+0100)
+Subject: Fix rc-service --help output.
+X-Git-Url: http://git.overlays.gentoo.org/gitweb/?p=proj%2Fopenrc.git;a=commitdiff_plain;h=71faee1761a57203386a7f0540cc19f5de10faa7
+
+Fix rc-service --help output.
+---
+
+diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c
+index 5c6fc3d..bcbf3db 100644
+--- a/src/rc/rc-service.c
++++ b/src/rc/rc-service.c
+@@ -51,6 +51,7 @@ static const struct option longopts[] = {
+ longopts_COMMON
+ };
+ static const char * const longopts_help[] = {
++ "tests if the service exists or not",
+ "list all available services",
+ longopts_help_COMMON
+ };
diff --git a/sys-apps/openrc/files/openrc-0.2.1-no-deref-null.patch b/sys-apps/openrc/files/openrc-0.2.1-no-deref-null.patch
new file mode 100644
index 000000000000..00963f0b41db
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.2.1-no-deref-null.patch
@@ -0,0 +1,21 @@
+From: DragonK <dragonk@gmail.com>
+Date: Sun, 6 Apr 2008 13:21:42 +0000 (+0100)
+Subject: p could be null here.
+X-Git-Url: http://git.overlays.gentoo.org/gitweb/?p=proj%2Fopenrc.git;a=commitdiff_plain;h=f183081181319271bad39cb00ff2970dc4a4ae42
+
+p could be null here.
+---
+
+diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c
+index 70f3a04..d434be4 100644
+--- a/src/rc/rc-applets.c
++++ b/src/rc/rc-applets.c
+@@ -110,7 +110,7 @@ static int do_e(int argc, char **argv)
+ } else if (strcmp(applet, "esyslog") == 0 ||
+ strcmp(applet, "elog") == 0) {
+ p = strchr(argv[0], '.');
+- if ((level = syslog_decode(p + 1, prioritynames)) == -1)
++ if (!p || (level = syslog_decode(p + 1, prioritynames)) == -1)
+ eerrorx("%s: invalid log level `%s'", applet, argv[0]);
+
+ if (argc < 3)
diff --git a/sys-apps/openrc/files/openrc-0.2.1-openvz-support.patch b/sys-apps/openrc/files/openrc-0.2.1-openvz-support.patch
new file mode 100644
index 000000000000..6d017e2f3a66
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.2.1-openvz-support.patch
@@ -0,0 +1,53 @@
+From: Roy Marples <roy@marples.name>
+Date: Sun, 6 Apr 2008 20:06:07 +0000 (+0100)
+Subject: Some systems are only detectable after /proc is mounted, so re-test if unknown.
+X-Git-Url: http://git.overlays.gentoo.org/gitweb/?p=proj%2Fopenrc.git;a=commitdiff_plain;h=6a670fe8314be48994cbe1603312015a549f0e94
+
+Some systems are only detectable after /proc is mounted, so re-test if unknown.
+---
+
+diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
+index 25a3ecb..5aa5031 100644
+--- a/sh/init.sh.Linux.in
++++ b/sh/init.sh.Linux.in
+@@ -96,6 +96,9 @@ if ${mountproc}; then
+ fi
+ unset mountproc
+
++# Re-load RC_SYS if empty now we have /proc mounted
++[ -z "${RC_SYS}" ] && export RC_SYS="$(rc --sys)"
++
+ # Read off the kernel commandline to see if there's any special settings
+ # especially check to see if we need to set the CDBOOT environment variable
+ # Note: /proc MUST be mounted
+diff --git a/src/rc/rc.c b/src/rc/rc.c
+index b305b2d..5ae7e1f 100644
+--- a/src/rc/rc.c
++++ b/src/rc/rc.c
+@@ -935,11 +935,13 @@ static void handle_bad_signal(int sig)
+ static const struct option longopts[] = {
+ { "override", 1, NULL, 'o' },
+ { "service", 1, NULL, 's' },
++ { "sys", 0, NULL, 'S' },
+ longopts_COMMON
+ };
+ static const char * const longopts_help[] = {
+ "override the next runlevel to change into\nwhen leaving single user or boot runlevels",
+ "runs the service specified with the rest\nof the arguments",
++ "output the RC system type, if any",
+ longopts_help_COMMON
+ };
+ #include "_usage.c"
+@@ -1028,6 +1030,12 @@ int main(int argc, char **argv)
+ execv(*argv, argv);
+ eerrorx("%s: %s", applet, strerror(errno));
+ /* NOTREACHED */
++ case 'S':
++ bootlevel = rc_sys();
++ if (bootlevel)
++ printf("%s\n", bootlevel);
++ exit(EXIT_SUCCESS);
++ /* NOTREACHED */
+ case_RC_COMMON_GETOPT
+ }
+ }
diff --git a/sys-apps/openrc/files/openrc-0.2.1-respect-fastboot.patch b/sys-apps/openrc/files/openrc-0.2.1-respect-fastboot.patch
new file mode 100644
index 000000000000..f657fd7a658b
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.2.1-respect-fastboot.patch
@@ -0,0 +1,43 @@
+From: Roy Marples <roy@marples.name>
+Date: Wed, 9 Apr 2008 00:21:49 +0000 (+0100)
+Subject: Respect shutdown's fastboot.
+X-Git-Url: http://git.overlays.gentoo.org/gitweb/?p=proj%2Fopenrc.git;a=commitdiff_plain;h=a57e9df2a084350cf18a414b5d92e9fcc8aea6ae
+
+Respect shutdown's fastboot.
+---
+
+diff --git a/init.d/fsck.in b/init.d/fsck.in
+index 5bf9ba8..f469ce8 100644
+--- a/init.d/fsck.in
++++ b/init.d/fsck.in
+@@ -29,6 +29,11 @@ start()
+ {
+ local reboot_opts= fsck_opts= p=
+
++ if [ -e /fastboot ]; then
++ ewarn "Skipping fsck due to /fastboot"
++ return 0
++ fi
++
+ ebegin "Checking local filesystems"
+ for p in ${fsck_passno}; do
+ local IFS="${_IFS}"
+diff --git a/init.d/root.in b/init.d/root.in
+index c87b7f1..aba6415 100644
+--- a/init.d/root.in
++++ b/init.d/root.in
+@@ -13,7 +13,7 @@ depend()
+ start()
+ {
+ if echo 2>/dev/null >/.test.$$; then
+- rm -f /.test.$$
++ rm -f /.test.$$ /fastboot
+ return 0
+ fi
+
+@@ -23,4 +23,5 @@ start()
+ *) mount -u -o rw /;;
+ esac
+ eend $? "Root filesystem could not be mounted read/write"
++ rm -f /fastboot
+ }
diff --git a/sys-apps/openrc/openrc-0.2.1-r2.ebuild b/sys-apps/openrc/openrc-0.2.1-r2.ebuild
new file mode 100644
index 000000000000..597daf1e6c83
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.2.1-r2.ebuild
@@ -0,0 +1,272 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.2.1-r2.ebuild,v 1.1 2008/04/15 05:59:46 cardoe Exp $
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/openrc.git"
+ EGIT_BRANCH="master"
+ inherit git
+else
+ SRC_URI="http://roy.marples.name/${PN}/${P}.tar.bz2
+ mirror://gentoo/${P}.tar.bz2
+ http://dev.gentoo.org/~cardoe/files/${P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+fi
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://roy.marples.name/openrc"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE="debug ncurses pam unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_linux? ( >=sys-apps/module-init-tools-3.2.2-r2 )
+ kernel_FreeBSD? ( sys-process/fuser-bsd )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( virtual/pam )
+ >=sys-apps/baselayout-2.0.0
+ !<sys-fs/udev-118-r2"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+pkg_setup() {
+ LIBDIR="lib"
+ [ "${SYMLINK_LIB}" = "yes" ] && LIBDIR=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ MAKE_ARGS="${MAKE_ARGS} LIBNAME=${LIBDIR}"
+
+ local brand="Unknown"
+ if use kernel_linux ; then
+ MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+ brand="Linux"
+ elif use kernel_FreeBSD ; then
+ MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+ brand="FreeBSD"
+ fi
+ export BRANDING="Gentoo ${brand}"
+
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git_src_unpack
+ else
+ unpack ${A}
+ fi
+ cd "${S}"
+ epatch "${FILESDIR}"/9999/*.patch
+
+ epatch "${FILESDIR}"/${PN}-0.2.1-empty-list-crash.patch
+ epatch "${FILESDIR}"/${PN}-0.2.1-no-deref-null.patch
+ epatch "${FILESDIR}"/${PN}-0.2.1-bad--help-output.patch
+ epatch "${FILESDIR}"/${PN}-0.2.1-openvz-support.patch
+ epatch "${FILESDIR}"/${PN}-0.2.1-respect-fastboot.patch
+}
+
+src_compile() {
+ # catch people running `ebuild` w/out setup
+ if [[ -z ${MAKE_ARGS} ]] ; then
+ die "Your MAKE_ARGS is empty ... are you running 'ebuild' but forgot to execute 'setup' ?"
+ fi
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-$(git --git-dir=${EGIT_STORE_DIR}/${EGIT_PROJECT} rev-parse --verify ${EGIT_BRANCH} | cut -c1-8)"
+ sed -i "/^VERSION[[:space:]]*=/s:=.*:=${ver}:" Makefile
+ fi
+
+ tc-export CC AR RANLIB
+ echo emake ${MAKE_ARGS}
+ emake ${MAKE_ARGS} || die "emake ${MAKE_ARGS} failed"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install || die "make install failed"
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ keepdir /"${LIBDIR}"/rc/init.d
+ keepdir /"${LIBDIR}"/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ mv "${D}/etc/runlevels" "${D}/usr/share/${PN}"
+
+ # Setup unicode defaults for silly unicode users
+ use unicode && sed -i -e '/^unicode=/s:NO:YES:' "${D}"/etc/rc.conf
+
+ # Cater to the norm
+ (use x86 || use amd64) && sed -i -e '/^windowkeys=/s:NO:YES:' "${D}"/etc/conf.d/keymaps
+}
+
+add_boot_init() {
+ local initd=$1
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+ || return
+ [[ -e ${ROOT}/etc/runlevels/boot/${initd} ]] && return
+ elog "Auto-adding '${initd}' service to your boot runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/boot/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${ROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local f
+
+ # default net script is just comments, so no point in biting people
+ # in the ass by accident
+ [[ -e ${ROOT}/etc/conf.d/net ]] && rm -f "${D}"/etc/conf.d/net
+
+ # /etc/conf.d/clock moved to /etc/conf.d/hwclock
+ local clock
+ use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+ if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+ mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+ fi
+ if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+ rm -f "${ROOT}"/etc/runlevels/boot/clock
+ ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+ fi
+ if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+ rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+ ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+ fi
+
+ # /etc/conf.d/rc is no longer used for configuration
+ if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+ elog "/etc/conf.d/rc is no longer used for configuration."
+ elog "Please migrate your settings to /etc/rc.conf as applicable"
+ elog "and delete /etc/conf.d/rc"
+ fi
+
+ # upgrade timezone file
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # force net init.d scripts into symlinks
+ for f in $(ls "${ROOT}"/etc/init.d/net.*) ; do
+ 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
+
+ # skip remaining migration if we already have openrc installed
+ has_version sys-apps/openrc && return 0
+
+ # baselayout boot init scripts have been split out
+ for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+ add_boot_init ${f}
+ done
+
+ # Try to auto-add some addons when possible
+ add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+ add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+ add_boot_init_mit_config /etc/mdadm.conf mdraid
+ add_boot_init_mit_config /etc/evms.conf evms
+ [[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+ [[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+ elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+ elog "init.d scripts. If you use such a thing, make sure you have the"
+ elog "required init.d scripts added to your boot runlevel."
+
+ # Upgrade out state for baselayout-1 users
+ if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+ (
+ [[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+ svcdir=${svcdir:-/var/lib/init.d}
+ if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+ ewarn "No state found, and no state exists"
+ elog "You should reboot this host"
+ else
+ mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+ einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+ mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+ rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+ "${ROOT}${LIBDIR}"/rc/init.d/console
+ umount "${ROOT}${svcdir}" 2>/dev/null
+ rm -rf "${ROOT}${svcdir}"
+ fi
+ )
+ fi
+
+ # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+ if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+ elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+ rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+ rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+ if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+ local f v
+ for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+ v=${f##*/}
+ v=${v#kernel-}
+ v=${v//[^[:alnum:]]/_}
+ gawk -v v="${v}" -v f="${f##*/}" '
+ BEGIN { print "\n### START: Auto-converted from " f "\n" }
+ {
+ if ($0 ~ /^[^#]/) {
+ print "modules_" v "=\"${modules_" v "} " $1 "\""
+ gsub(/[^[:alnum:]]/, "_", $1)
+ printf "module_" $1 "_args_" v "=\""
+ for (i = 2; i <= NF; ++i) {
+ if (i > 2)
+ printf " "
+ printf $i
+ }
+ print "\"\n"
+ } else
+ print
+ }
+ END { print "\n### END: Auto-converted from " f "\n" }
+ ' "${f}" >> "${D}"/etc/conf.d/modules
+ done
+ rm -f "${f}"
+ rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+ fi
+ fi
+}
+
+pkg_postinst() {
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e ${ROOT}/etc/runlevels ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ fi
+
+ if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+ ewarn "/etc/modules.autoload.d is no longer used. Please convert"
+ ewarn "your files to /etc/conf.d/modules and delete the directory."
+ fi
+
+ elog "You should now update all files in /etc, using etc-update"
+ elog "or equivalent before restarting any services or this host."
+ elog
+ elog "Please read the migration guide available at:"
+ elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}