summaryrefslogtreecommitdiff
path: root/sys-apps
diff options
context:
space:
mode:
authorBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:24:26 +0200
committerBlackNoxis <steven.darklight@gmail.com>2014-02-15 23:24:26 +0200
commit7224c1253228e5c29c78cb3f0f26ce34770f2356 (patch)
tree1684924656132935256e034f35f92abee6623265 /sys-apps
Added ebuilds for kogaion desktop
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/baselayout/Manifest11
-rw-r--r--sys-apps/baselayout/baselayout-2.0.3-r1.ebuild243
-rw-r--r--sys-apps/baselayout/baselayout-2.1.ebuild245
-rw-r--r--sys-apps/baselayout/baselayout-2.2.ebuild265
-rw-r--r--sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch18
-rw-r--r--sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch16
-rw-r--r--sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch12
-rw-r--r--sys-apps/baselayout/files/baselayout-rogentos-os-release.patch16
-rw-r--r--sys-apps/baselayout/metadata.xml5
-rw-r--r--sys-apps/gpu-detector/Manifest5
-rwxr-xr-xsys-apps/gpu-detector/files/gpu-configuration776
-rw-r--r--sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild39
-rw-r--r--sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild38
-rw-r--r--sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild37
-rw-r--r--sys-apps/gpu-detector/gpu-detector-3.ebuild24
-rw-r--r--sys-apps/lsb-release/Manifest4
-rw-r--r--sys-apps/lsb-release/files/lsb-release-rogentos-version.patch12
-rw-r--r--sys-apps/lsb-release/lsb-release-1.4.ebuild38
-rw-r--r--sys-apps/lsb-release/metadata.xml19
-rw-r--r--sys-apps/openrc/Manifest7
-rw-r--r--sys-apps/openrc/Reasons5
-rw-r--r--sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch34
-rw-r--r--sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch41
-rw-r--r--sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch16
-rw-r--r--sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch12
-rw-r--r--sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch14
-rw-r--r--sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch57
-rw-r--r--sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch33
-rw-r--r--sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch25
-rw-r--r--sys-apps/openrc/files/openrc-9999-pause.patch29
-rw-r--r--sys-apps/openrc/files/openrc-enable-interactive-2.patch11
-rw-r--r--sys-apps/openrc/files/openrc-enable-interactive.patch11
-rw-r--r--sys-apps/openrc/files/openrc-netmount-fix.patch11
-rw-r--r--sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch30
-rw-r--r--sys-apps/openrc/files/openrc-sabayon-config-2.patch31
-rw-r--r--sys-apps/openrc/files/openrc-sabayon-config.patch35
-rw-r--r--sys-apps/openrc/files/openrc.logrotate7
-rw-r--r--sys-apps/openrc/files/start-stop-daemon.pam2
-rw-r--r--sys-apps/openrc/metadata.xml5
-rw-r--r--sys-apps/openrc/openrc-0.10.5.ebuild471
-rw-r--r--sys-apps/openrc/openrc-0.11.8.ebuild512
-rw-r--r--sys-apps/openrc/openrc-0.12.4.ebuild356
-rw-r--r--sys-apps/openrc/openrc-0.12_pre1-r1.ebuild518
-rw-r--r--sys-apps/openrc/openrc-0.12_pre1-r2.ebuild520
-rw-r--r--sys-apps/openrc/openrc-0.12_pre1.ebuild515
-rw-r--r--sys-apps/openrc/openrc-0.8.2-r1.ebuild458
-rw-r--r--sys-apps/openrc/openrc-0.8.3-r1.ebuild459
-rw-r--r--sys-apps/openrc/openrc-0.9.8.1.ebuild457
-rw-r--r--sys-apps/openrc/openrc-0.9.9.3.ebuild461
49 files changed, 6966 insertions, 0 deletions
diff --git a/sys-apps/baselayout/Manifest b/sys-apps/baselayout/Manifest
new file mode 100644
index 00000000..3ec3151d
--- /dev/null
+++ b/sys-apps/baselayout/Manifest
@@ -0,0 +1,11 @@
+AUX baselayout-1.12.14-iproute.patch 633 SHA256 d30480e75024953ac64a51cf7a3d54f4f975470219da2cec9ad0832b5ff6eff9 SHA512 4c8f177971d6e65b8a0d55c5b8a045f4277637e97b41a07b3a332adca2720c929c4b44ad29a59d2ad4ec521924711c8f82742ec68bc3f0b54791b38a21b2bce4 WHIRLPOOL 695d8720650571a1f49678d38be713f94d9d318f5522609bce09872d587da7b13e89d702e0a4e77072fe9f6a677bc6d8c5e818584876afe57c286c5454fe0781
+AUX baselayout-2.0.1-proc_touch.patch 528 SHA256 5c8108347da5881ba982a4c8831b846393d6c6928d6497f021633e45d6f3ab39 SHA512 c60bb20a2bf93741170d15d62b33d46284b92b2442977fe41db68e874c7f02a466a00c3f65f4e06db57598487dcc5827536afb52375a8d821ef148babb25b247 WHIRLPOOL 04d2980060c7ea1f4a101411b0bcd065009c9fe36261f214bfc52009c36092ad50819fe0b433c04b212699a6b94c7bf57ada9fd743abf35631e11ccae3c301b2
+AUX baselayout-2.0.3-slash-run-dir.patch 273 SHA256 7c797e35a721250a8961c10efeb1495fbdd759358d9b6084504ce4b47d8e4d2b SHA512 f1e01da181faafdbe660b9afc442d2d1f6650064fb15f94340ec43750e45fa3ff1179730cd1b81e591f03a82e8c45d2402bc23ac2310ef0ebb6bc762270d8a0b WHIRLPOOL ef17a9d7a90fd6be7108d316a57265cd38f2f52fd134ec37ba7328119ca1d17ac842ab9065bca4c9b21d4a552768e754c1badd69c8a568221924e0055b3eff24
+AUX baselayout-rogentos-os-release.patch 486 SHA256 5fae994ba07fd294b92c554bc901935f512b6bec99697520d7a961af48d90208 SHA512 ab6ce0ff4c942aa3d60dbab9c2013633a3162ab0707f38d7ad72c4c8d7349cf6d804eca40276ab162f745d206d04ae0eb45bda0a0f29d35aa2f86bc675427081 WHIRLPOOL 6fc230172fb907223d3f2ee297b1c3e4c36dfd7d6a17a947207ad10559475c4c9565cd1afa118c2c775b14f727157892027d78a55441ad2e33ea97bf89fee2a0
+DIST baselayout-2.0.3.tar.bz2 39969 SHA256 879308781d845f467eb2b45b9ff006aa799e943f45ddba518f43acae1ec84bdd
+DIST baselayout-2.1.tar.bz2 40398 SHA256 2ac6f2156513a2820a0eeeecc2cf7e7c0b5e0c750b324f1e21912d5f3cda4956
+DIST baselayout-2.2.tar.bz2 40744 SHA256 11d4a223b06da545c3e59e07c9195570f334b5b1be05d995df0ebc8ea2203e98 SHA512 a5199c42e835d9f2683cc94f3c4c47ecdc392316c24e0932845736e2e90479b0c5c8ad72ead8e0537f097405b7d7548d00b87b7ff8c9e3651486e3c5c0970b36 WHIRLPOOL 60cc4f7f76c5a45c15303e526decffb3bad2b50ac659b1dd072d2ed4b0eb0b31929a1a733ddb03a31ee5882b889a4efb87206f63ffaa2b11e26d36afd0933a95
+EBUILD baselayout-2.0.3-r1.ebuild 8324 SHA256 67512c59427896fa6801f7c410b6948af0fc5368994e78f8dfc3d7515cd41c44 SHA512 d1cef6c0226daf4ffea851b0a5d3e03215cc99d7f5bbe023f61f21dc2fe5ca88d236f75e9ba21c03f94c70ba3f821b1551bea4ee4b5e71dc31d21fddd078c9f6 WHIRLPOOL 4e490c6ba6945a73dc50c5d6f04861cb648f82b5b9bbbd702f4eafed511e44b7322856ed20bf4f3adf83910144d2cd6322bfcd1dc9715daaab8a4695523f62ee
+EBUILD baselayout-2.1.ebuild 8703 SHA256 f3e2bda1c1a7c805f7b0093107abcc3357362627e9110ee1eb9b6804b8e90b31 SHA512 44c3de65a97cd0f9d3cfec4944d88033d7a12d30e79c6d9e7836b3816001acd7703a36dacf75bb6e58a579951b1af80dccca322853d614c1d50274429fb3c4e5 WHIRLPOOL 69f10d3cc403e3d49d9555b855de575d8474aa6b0c1a0c7cd63dd7f5ac7bc84460dfbb3382b315549e8c0e1df79522c2161df9af0429815da129d2ad78e7f58d
+EBUILD baselayout-2.2.ebuild 9132 SHA256 2317988157c8a373747300c0598952dce05eab60d4f85c80e14e268129a4f625 SHA512 9a825db62673c2af8036c650edf893b53af3ba4eab9c409acb24b57dfb0941c1348eaec30d59e3855c7b4b6e81a07d4623a4d866c3ff192c24b99cc7fb2391b0 WHIRLPOOL 902c2b43e2146125838f657023148e9a642c20686f523995d4f879e659cf4e1ae84feeecc6b2b61e22c83eb498ee68ab71ab18b1873b5de2d58bb6cd2e475ebe
+MISC metadata.xml 164 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 SHA512 8eb0d5153d388f6ea069c64b93882244816a0a09aecc0d73cb872121ce0eb24c5ccafa96aad0b620b2300f319e1af101fa7fa6c5d0d561719d49bb07da0a2eca WHIRLPOOL 11a1441bddb7a6c69653c663902b7da5767ae6ad515ac2aabfc42fe37927a1ccc21472deeee454009ff720201a41c3e4a912df42661a0a87150fb46126da2d52
diff --git a/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild b/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild
new file mode 100644
index 00000000..71f0cd6d
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild
@@ -0,0 +1,243 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.0.3.ebuild,v 1.4 2011/07/02 18:26:47 williamh Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="build kernel_linux"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_preinst() {
+ # Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+ # the baselayout-1.x ebuild copies all the real configs from the user's
+ # /etc/conf.d into ${D}, it makes them all appear to be the default
+ # versions. In order to protect them from being unmerged after this
+ # upgrade, modify their timestamps.
+ touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+ # This is written in src_install (so it's in CONTENTS), but punt all
+ # pending updates to avoid user having to do etc-update (and make the
+ # pkg_postinst logic simpler).
+ rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+ # We need to install directories and maybe some dev nodes when building
+ # stages, but they cannot be in CONTENTS.
+ # Also, we cannot reference $S as binpkg will break so we do this.
+ if use build ; then
+ local libdirs="$(get_all_libdirs)" dir=
+ # Create our multilib dirs - the Makefile has no knowledge of this
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+ for dir in ${libdirs}; do
+ mkdir -p "${ROOT}${dir}"
+ touch "${ROOT}${dir}"/.keep
+ mkdir -p "${ROOT}usr/${dir}"
+ touch "${ROOT}usr/${dir}"/.keep
+ mkdir -p "${ROOT}usr/local/${dir}"
+ touch "${ROOT}usr/local/${dir}"/.keep
+ done
+
+ # Create symlinks for /lib, /usr/lib, and /usr/local/lib and
+ # merge contents of duplicate directories if necessary.
+ # Only do this when $ROOT != / since it should only be necessary
+ # when merging to an empty $ROOT, and it's not very safe to perform
+ # this operation when $ROOT = /.
+ if [ "${SYMLINK_LIB}" = yes ] && [ "$ROOT" != / ] ; then
+ local prefix libabi=$(get_abi_LIBDIR $DEFAULT_ABI)
+ for prefix in "$ROOT"{,usr/,usr/local/} ; do
+
+ [ ! -d "${prefix}lib" ] && rm -f "${prefix}lib" && \
+ mkdir -p "${prefix}lib"
+
+ [ ! -d "$prefix$libabi" ] && ln -sf "${prefix}lib"
+
+ [ -h "$prefix$libabi" ] && [ -d "${prefix}lib" ] && \
+ [ "$prefix$libabi" -ef "${prefix}lib" ] && continue
+
+ local destdir=$prefix$libabi/ srcdir=${prefix}lib/
+
+ [ -d "$destdir" ] || die "unable to create '$destdir'"
+ [ -d "$srcdir" ] || die "unable to create $srcdir"
+
+ mv -f "$srcdir".keep "$destdir".keep 2>/dev/null
+ if ! rmdir "$srcdir" 2>/dev/null ; then
+ ewarn "merging contents of '$srcdir' into '$destdir':"
+
+ # Move directories if the dest doesn't exist.
+ find "$srcdir" -type d -print0 | \
+ while read -d $'\0' src ; do
+
+ # If a parent directory of $src has already
+ # been merged then it will no longer exist.
+ [ -d "$src" ] || continue
+
+ dest=$destdir${src#${srcdir}}
+ if [ ! -d "$dest" ] ; then
+ if [ -e "$dest" ] ; then
+ ewarn " not overwriting file '$dest'" \
+ "with directory '$src'"
+ continue
+ fi
+ mv -f "$src" "$dest" && \
+ ewarn " /${src#${ROOT}} merged" || \
+ ewarn " /${src#${ROOT}} not merged"
+ fi
+ done
+
+ # Move non-directories.
+ find "$srcdir" ! -type d -print0 | \
+ while read -d $'\0' src ; do
+ dest=$destdir${src#${srcdir}}
+ if [ -e "$dest" ] ; then
+ if [ -d "$dest" ] ; then
+ ewarn " not overwriting directory '$dest'" \
+ "with file '$src'"
+ else
+ if [ -f "$src" -a ! -s "$src" ] && \
+ [ -f "$dest" -a ! -s "$dest" ] ; then
+ # Ignore empty files such as '.keep'.
+ true
+ else
+ ewarn " not overwriting file '$dest'" \
+ "with file '$src'"
+ fi
+ fi
+ continue
+ fi
+
+ mv -f "$src" "$dest" && \
+ ewarn " /${src#${ROOT}} merged" || \
+ ewarn " /${src#${ROOT}} not merged"
+ done
+ fi
+
+ rm -rf "${prefix}lib" || \
+ die "unable to remove '${prefix}lib'"
+
+ ln -s "$libabi" "${prefix}lib" || \
+ die "unable to create '${prefix}lib' symlink"
+ done
+ fi
+
+ emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die "failed to layout filesystem"
+ fi
+ rm -f "${D}"/usr/share/${PN}/Makefile
+
+ # Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}/${P}-slash-run-dir.patch"
+}
+
+src_install() {
+ local libdir="lib"
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ # Setup /run directory, this is missing from original baselayout
+ dodir /run
+
+ emake \
+ OS=$(use kernel_FreeBSD && echo BSD || echo Linux) \
+ LIB=${libdir} \
+ DESTDIR="${D}" \
+ install || die
+ dodoc ChangeLog.svn
+
+ # need the makefile in pkg_preinst
+ insinto /usr/share/${PN}
+ doins Makefile || die
+
+ # Should this belong in another ebuild? Like say binutils?
+ # List all the multilib libdirs in /etc/env/04multilib (only if they're
+ # actually different from the normal
+ if has_multilib_profile || [ $(get_libdir) != "lib" -o -n "${CONF_MULTILIBDIR}" ]; then
+ local libdirs="$(get_all_libdirs)" libdirs_env= dir=
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+ for dir in ${libdirs}; do
+ libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+ done
+
+ # Special-case uglyness... For people updating from lib32 -> lib amd64
+ # profiles, keep lib32 in the search path while it's around
+ if has_multilib_profile && [ -d "${ROOT}"lib32 -o -d "${ROOT}"lib32 ] && ! hasq lib32 ${libdirs}; then
+ libdirs_env="${libdirs_env}:/lib32:/usr/lib32:/usr/local/lib32"
+ fi
+ echo "LDPATH=\"${libdirs_env}\"" > "${T}"/04multilib
+ doenvd "${T}"/04multilib
+ fi
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+ # Sabayon customization, install /etc/hosts separately (to .example)
+ mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+}
+
+pkg_postinst() {
+ local x
+
+ # We installed some files to /usr/share/baselayout instead of /etc to stop
+ # (1) overwriting the user's settings
+ # (2) screwing things up when attempting to merge files
+ # (3) accidentally packaging up personal files with quickpkg
+ # If they don't exist then we install them
+ for x in master.passwd passwd shadow group fstab ; do
+ [ -e "${ROOT}etc/${x}" ] && continue
+ [ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+ cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+ done
+
+ # Force shadow permissions to not be world-readable #260993
+ for x in shadow ; do
+ [ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+ done
+
+ # Take care of the etc-update for the user
+ if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+ mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+ fi
+
+ # whine about users that lack passwords #193541
+ if [[ -e ${ROOT}/etc/shadow ]] ; then
+ local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+ if [[ -n ${bad_users} ]] ; then
+ echo
+ ewarn "The following users lack passwords!"
+ ewarn ${bad_users}
+ fi
+ fi
+
+ # whine about users with invalid shells #215698
+ if [[ -e ${ROOT}/etc/passwd ]] ; then
+ local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+ if [[ -n ${bad_shells} ]] ; then
+ echo
+ ewarn "The following users have non-existent shells!"
+ ewarn "${bad_shells}"
+ fi
+ fi
+
+ # Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+ cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+ elif [ ! -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+ fi
+ chown root:root "${etc_hosts}" # don't die
+}
diff --git a/sys-apps/baselayout/baselayout-2.1.ebuild b/sys-apps/baselayout/baselayout-2.1.ebuild
new file mode 100644
index 00000000..5f9115c5
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.1.ebuild
@@ -0,0 +1,245 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.1.ebuild,v 1.6 2011/12/09 03:48:47 vapier Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="build"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_setup() {
+ multilib_layout
+}
+
+# Create our multilib dirs - the Makefile has no knowledge of this
+multilib_warn() {
+ local syms=$1 dirs=$2 def_libdir=$3
+
+ [ -z "${syms}${dirs}" ] && return
+
+ ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB}, so that means"
+ if [ -z "${syms}" ] ; then
+ ewarn "you need to have these paths as symlinks to ${def_libdir}:"
+ ewarn "$1"
+ fi
+}
+multilib_layout() {
+ local libdir libdirs=$(get_all_libdirs) def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+
+ [ -z "${def_libdir}" ] && die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
+
+ # figure out which paths should be symlinks and which should be directories
+ local dirs syms exp d
+ for libdir in ${libdirs} ; do
+ exp=( {,usr/,usr/local/}${libdir} )
+ for d in "${exp[@]/#/${ROOT}}" ; do
+ # most things should be dirs
+ if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
+ [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
+ else
+ [ -h "${d}" ] && syms+=" ${d}"
+ fi
+ done
+ done
+ if [ -n "${syms}${dirs}" ] ; then
+ ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
+ ewarn "have these paths configured as follows:"
+ [ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
+ [ -n "${syms}" ] && ewarn "directories:${syms}"
+ ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
+ ewarn "If things fail, you will need to manually create/move the directories."
+ echo
+ fi
+
+ # setup symlinks and dirs where we expect them to be; do not migrate
+ # data ... just fall over in that case.
+ local prefix
+ for prefix in "${ROOT}"{,usr/,usr/local/} ; do
+ if [ "${SYMLINK_LIB}" = yes ] ; then
+ # we need to make sure "lib" points to the native libdir
+ if [ -h "${prefix}lib" ] ; then
+ # it's already a symlink! assume it's pointing to right place ...
+ continue
+ elif [ -d "${prefix}lib" ] ; then
+ # "lib" is a dir, so need to convert to a symlink
+ ewarn "Converting ${prefix}lib from a dir to a symlink"
+ rm -f "${prefix}lib"/.keep
+ if rmdir "${prefix}lib" 2>/dev/null ; then
+ ln -s ${def_libdir} "${prefix}lib" || die
+ else
+ die "non-empty dir found where we needed a symlink: ${prefix}lib"
+ fi
+ else
+ # nothing exists, so just set it up sanely
+ ewarn "Initializing ${prefix}lib as a symlink"
+ mkdir -p "${prefix}" || die
+ rm -f "${prefix}lib" || die
+ ln -s ${def_libdir} "${prefix}lib" || die
+ fi
+ else
+ # we need to make sure "lib" is a dir
+ if [ -h "${prefix}lib" ] ; then
+ # "lib" is a symlink, so need to convert to a dir
+ ewarn "Converting ${prefix}lib from a symlink to a dir"
+ rm -f "${prefix}lib" || die
+ if [ -d "${prefix}lib32" ] ; then
+ ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
+ mv "${prefix}lib32" "${prefix}lib" || die
+ else
+ mkdir -p "${prefix}lib" || die
+ fi
+ elif [ -d "${prefix}lib" ] ; then
+ # make sure the old "lib" ABI location does not exist; we
+ # only symlinked the lib dir on systems where we moved it
+ # to "lib32" ...
+ case ${CHOST} in
+ i?86*|x86_64*|powerpc*|sparc*|s390*)
+ if [ -d "${prefix}lib32" ] ; then
+ rm -f "${prefix}lib32"/.keep
+ if ! rmdir "${prefix}lib32" 2>/dev/null ; then
+ ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
+ die "non-empty dir found where there should be none: ${prefix}lib32"
+ fi
+ fi
+ ;;
+ esac
+ else
+ # nothing exists, so just set it up sanely
+ ewarn "Initializing ${prefix}lib as a dir"
+ mkdir -p "${prefix}" || die
+ rm -f "${prefix}lib" || die
+ ln -s ${def_libdir} "${prefix}lib" || die
+ fi
+ fi
+ done
+}
+
+pkg_preinst() {
+ # Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+ # the baselayout-1.x ebuild copies all the real configs from the user's
+ # /etc/conf.d into ${D}, it makes them all appear to be the default
+ # versions. In order to protect them from being unmerged after this
+ # upgrade, modify their timestamps.
+ touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+ # This is written in src_install (so it's in CONTENTS), but punt all
+ # pending updates to avoid user having to do etc-update (and make the
+ # pkg_postinst logic simpler).
+ rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+ # We need to install directories and maybe some dev nodes when building
+ # stages, but they cannot be in CONTENTS.
+ # Also, we cannot reference $S as binpkg will break so we do this.
+ multilib_layout
+ if use build ; then
+ emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die
+ fi
+ rm -f "${D}"/usr/share/${PN}/Makefile
+
+ # Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+ fi
+}
+
+src_install() {
+ # Setup /run directory, this is missing from original baselayout
+ dodir /run
+
+ emake \
+ OS=$(usex kernel_FreeBSD BSD Linux) \
+ DESTDIR="${D}" \
+ install || die
+ dodoc ChangeLog.svn
+
+ # need the makefile in pkg_preinst
+ insinto /usr/share/${PN}
+ doins Makefile || die
+
+ # handle multilib paths. do it here because we want this behavior
+ # regardless of the C library that you're using. we do explicitly
+ # list paths which the native ldconfig searches, but this isn't
+ # problematic as it doesn't change the resulting ld.so.cache or
+ # take longer to generate. similarly, listing both the native
+ # path and the symlinked path doesn't change the resulting cache.
+ local libdir ldpaths
+ for libdir in $(get_all_libdirs) ; do
+ ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}"
+ done
+ echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+ # Sabayon customization, install /etc/hosts separately (to .example)
+ mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+}
+
+pkg_postinst() {
+ local x
+
+ # We installed some files to /usr/share/baselayout instead of /etc to stop
+ # (1) overwriting the user's settings
+ # (2) screwing things up when attempting to merge files
+ # (3) accidentally packaging up personal files with quickpkg
+ # If they don't exist then we install them
+ for x in master.passwd passwd shadow group fstab ; do
+ [ -e "${ROOT}etc/${x}" ] && continue
+ [ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+ cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+ done
+
+ # Force shadow permissions to not be world-readable #260993
+ for x in shadow ; do
+ [ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+ done
+
+ # Take care of the etc-update for the user
+ if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+ mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+ fi
+
+ # whine about users that lack passwords #193541
+ if [[ -e ${ROOT}/etc/shadow ]] ; then
+ local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+ if [[ -n ${bad_users} ]] ; then
+ echo
+ ewarn "The following users lack passwords!"
+ ewarn ${bad_users}
+ fi
+ fi
+
+ # baselayout leaves behind a lot of .keep files, so let's clean them up
+ find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+ find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+
+ # whine about users with invalid shells #215698
+ if [[ -e ${ROOT}/etc/passwd ]] ; then
+ local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+ if [[ -n ${bad_shells} ]] ; then
+ echo
+ ewarn "The following users have non-existent shells!"
+ ewarn "${bad_shells}"
+ fi
+ fi
+
+ # Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+ cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+ elif [ ! -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+ fi
+ chown root:root "${etc_hosts}" # don't die
+}
diff --git a/sys-apps/baselayout/baselayout-2.2.ebuild b/sys-apps/baselayout/baselayout-2.2.ebuild
new file mode 100644
index 00000000..1f70a72c
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.2.ebuild
@@ -0,0 +1,265 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.2.ebuild,v 1.2 2012/08/23 21:47:35 vapier Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="build kernel_linux"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_setup() {
+ multilib_layout
+}
+
+# Create our multilib dirs - the Makefile has no knowledge of this
+multilib_warn() {
+ local syms=$1 dirs=$2 def_libdir=$3
+
+ [ -z "${syms}${dirs}" ] && return
+
+ ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB}, so that means"
+ if [ -z "${syms}" ] ; then
+ ewarn "you need to have these paths as symlinks to ${def_libdir}:"
+ ewarn "$1"
+ fi
+}
+multilib_layout() {
+ local libdir libdirs=$(get_all_libdirs) def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+
+ [ -z "${def_libdir}" ] && die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
+
+ # figure out which paths should be symlinks and which should be directories
+ local dirs syms exp d
+ for libdir in ${libdirs} ; do
+ exp=( {,usr/,usr/local/}${libdir} )
+ for d in "${exp[@]/#/${ROOT}}" ; do
+ # most things should be dirs
+ if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
+ [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
+ else
+ [ -h "${d}" ] && syms+=" ${d}"
+ fi
+ done
+ done
+ if [ -n "${syms}${dirs}" ] ; then
+ ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
+ ewarn "have these paths configured as follows:"
+ [ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
+ [ -n "${syms}" ] && ewarn "directories:${syms}"
+ ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
+ ewarn "If things fail, you will need to manually create/move the directories."
+ echo
+ fi
+
+ # setup symlinks and dirs where we expect them to be; do not migrate
+ # data ... just fall over in that case.
+ local prefix
+ for prefix in "${ROOT}"{,usr/,usr/local/} ; do
+ if [ "${SYMLINK_LIB}" = yes ] ; then
+ # we need to make sure "lib" points to the native libdir
+ if [ -h "${prefix}lib" ] ; then
+ # it's already a symlink! assume it's pointing to right place ...
+ continue
+ elif [ -d "${prefix}lib" ] ; then
+ # "lib" is a dir, so need to convert to a symlink
+ ewarn "Converting ${prefix}lib from a dir to a symlink"
+ rm -f "${prefix}lib"/.keep
+ if rmdir "${prefix}lib" 2>/dev/null ; then
+ ln -s ${def_libdir} "${prefix}lib" || die
+ else
+ die "non-empty dir found where we needed a symlink: ${prefix}lib"
+ fi
+ else
+ # nothing exists, so just set it up sanely
+ ewarn "Initializing ${prefix}lib as a symlink"
+ mkdir -p "${prefix}" || die
+ rm -f "${prefix}lib" || die
+ ln -s ${def_libdir} "${prefix}lib" || die
+ mkdir -p "${prefix}${def_libdir}" #423571
+ fi
+ else
+ # we need to make sure "lib" is a dir
+ if [ -h "${prefix}lib" ] ; then
+ # "lib" is a symlink, so need to convert to a dir
+ ewarn "Converting ${prefix}lib from a symlink to a dir"
+ rm -f "${prefix}lib" || die
+ if [ -d "${prefix}lib32" ] ; then
+ ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
+ mv "${prefix}lib32" "${prefix}lib" || die
+ else
+ mkdir -p "${prefix}lib" || die
+ fi
+ elif [ -d "${prefix}lib" ] ; then
+ # make sure the old "lib" ABI location does not exist; we
+ # only symlinked the lib dir on systems where we moved it
+ # to "lib32" ...
+ case ${CHOST} in
+ i?86*|x86_64*|powerpc*|sparc*|s390*)
+ if [ -d "${prefix}lib32" ] ; then
+ rm -f "${prefix}lib32"/.keep
+ if ! rmdir "${prefix}lib32" 2>/dev/null ; then
+ ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
+ die "non-empty dir found where there should be none: ${prefix}lib32"
+ fi
+ fi
+ ;;
+ esac
+ else
+ # nothing exists, so just set it up sanely
+ ewarn "Initializing ${prefix}lib as a dir"
+ mkdir -p "${prefix}" || die
+ rm -f "${prefix}lib" || die
+ ln -s ${def_libdir} "${prefix}lib" || die
+ fi
+ fi
+ done
+}
+
+pkg_preinst() {
+ # Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+ # the baselayout-1.x ebuild copies all the real configs from the user's
+ # /etc/conf.d into ${D}, it makes them all appear to be the default
+ # versions. In order to protect them from being unmerged after this
+ # upgrade, modify their timestamps.
+ touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+ # This is written in src_install (so it's in CONTENTS), but punt all
+ # pending updates to avoid user having to do etc-update (and make the
+ # pkg_postinst logic simpler).
+ rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+ # We need to install directories and maybe some dev nodes when building
+ # stages, but they cannot be in CONTENTS.
+ # Also, we cannot reference $S as binpkg will break so we do this.
+ multilib_layout
+ if use build ; then
+ emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die
+ fi
+ rm -f "${D}"/usr/share/${PN}/Makefile
+
+ # Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ # We are Sabayon!
+ epatch "${FILESDIR}/${PN}-rogentos-os-release.patch"
+}
+
+src_install() {
+ # Setup /run directory, this is missing from original baselayout
+ dodir /run
+
+ emake \
+ OS=$(usex kernel_FreeBSD BSD Linux) \
+ DESTDIR="${D}" \
+ install || die
+ dodoc ChangeLog.svn
+
+ # need the makefile in pkg_preinst
+ insinto /usr/share/${PN}
+ doins Makefile || die
+
+ # handle multilib paths. do it here because we want this behavior
+ # regardless of the C library that you're using. we do explicitly
+ # list paths which the native ldconfig searches, but this isn't
+ # problematic as it doesn't change the resulting ld.so.cache or
+ # take longer to generate. similarly, listing both the native
+ # path and the symlinked path doesn't change the resulting cache.
+ local libdir ldpaths
+ for libdir in $(get_all_libdirs) ; do
+ ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}"
+ done
+ echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+ # Sabayon customization, install /etc/hosts separately (to .example)
+ mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+
+}
+
+pkg_postinst() {
+ local x
+
+ # We installed some files to /usr/share/baselayout instead of /etc to stop
+ # (1) overwriting the user's settings
+ # (2) screwing things up when attempting to merge files
+ # (3) accidentally packaging up personal files with quickpkg
+ # If they don't exist then we install them
+ for x in master.passwd passwd shadow group fstab ; do
+ [ -e "${ROOT}etc/${x}" ] && continue
+ [ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+ cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+ done
+
+ # Force shadow permissions to not be world-readable #260993
+ for x in shadow ; do
+ [ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+ done
+
+ # Take care of the etc-update for the user
+ if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+ mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+ fi
+
+ # whine about users that lack passwords #193541
+ if [[ -e ${ROOT}/etc/shadow ]] ; then
+ local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+ if [[ -n ${bad_users} ]] ; then
+ echo
+ ewarn "The following users lack passwords!"
+ ewarn ${bad_users}
+ fi
+ fi
+
+ # baselayout leaves behind a lot of .keep files, so let's clean them up
+ find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+ find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+
+ # whine about users with invalid shells #215698
+ if [[ -e ${ROOT}/etc/passwd ]] ; then
+ local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+ if [[ -n ${bad_shells} ]] ; then
+ echo
+ ewarn "The following users have non-existent shells!"
+ ewarn "${bad_shells}"
+ fi
+ fi
+
+ # Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+ local etc_hosts="${ROOT}/etc/hosts"
+ if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+ cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+ elif [ ! -e "${etc_hosts}" ]; then
+ cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+ fi
+ chown root:root "${etc_hosts}" # don't die
+
+ # http://bugs.gentoo.org/361349
+ if use kernel_linux; then
+ mkdir -p "${ROOT}"/run
+
+ if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then
+ echo
+ ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+ fi
+ fi
+}
diff --git a/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch b/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch
new file mode 100644
index 00000000..8d148862
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch
@@ -0,0 +1,18 @@
+r3179 | vapier | 2010-10-03 17:20:25 -0400 (Sun, 03 Oct 2010) | 1 line
+
+fix infinite recursion with ip invocation #339013 by Krzysztof Olędzki
+
+Index: net-scripts/net/iproute2.sh
+===================================================================
+--- lib/rcscripts/net/iproute2.sh (revision 3178)
++++ lib/rcscripts/net/iproute2.sh (revision 3179)
+@@ -5,7 +5,8 @@
+ # Fix any potential localisation problems
+ # Note that LC_ALL trumps LC_anything_else according to locale(7)
+ ip() {
+- LC_ALL=C ip "$@"
++ # use the full path so we don't recurse into ip()
++ LC_ALL=C $(type -P ip) "$@"
+ }
+ iproute2_tunnel() {
+ LC_ALL=C ip tunnel "$@"
diff --git a/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch b/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch
new file mode 100644
index 00000000..7b7df780
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/232823
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/baselayout/trunk/Makefile?r1=3171&r2=3172
+
+--- Makefile
++++ Makefile
+@@ -49,8 +49,9 @@
+ layout:
+ # Create base filesytem layout
+ for x in $(KEEP_DIRS) ; do \
++ test -e $(DESTDIR)$$x/.keep && continue ; \
+ $(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
+- touch $(DESTDIR)$$x/.keep || exit $$? ; \
++ touch $(DESTDIR)$$x/.keep || echo "ignoring touch failure; mounted fs?" ; \
+ done
+ # Special dirs
+ install -m 0700 -d $(DESTDIR)/root || exit $$?
diff --git a/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch b/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch
new file mode 100644
index 00000000..f6b77567
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch
@@ -0,0 +1,12 @@
+Index: trunk/Makefile
+===================================================================
+--- trunk/Makefile (revision 3193)
++++ trunk/Makefile (working copy)
+@@ -27,6 +27,7 @@
+
+ KEEP_DIRS-Linux += \
+ /dev \
++ /run \
+ /sys \
+ /usr/src
+ KEEP_DIRS = $(KEEP_DIRS-$(OS)) \
diff --git a/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch b/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch
new file mode 100644
index 00000000..1456df72
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch
@@ -0,0 +1,16 @@
+--- baselayout-2.2.orig/etc.Linux/os-release
++++ baselayout-2.2/etc.Linux/os-release
+@@ -1,7 +1,7 @@
+-NAME=Gentoo
+-ID=gentoo
+-PRETTY_NAME="Gentoo/Linux"
++NAME=Rogentos
++ID=rogentos
++PRETTY_NAME="Rogentos/Linux"
+ ANSI_COLOR="1;32"
+-HOME_URL="http://www.gentoo.org/"
+-SUPPORT_URL="http://www.gentoo.org/main/en/support.xml"
+-BUG_REPORT_URL="https://bugs.gentoo.org/"
++HOME_URL="http://www.rogentos.ro/"
++SUPPORT_URL="http://forum.rogentos.ro/"
++BUG_REPORT_URL="https://bugs.rogentos.ro/"
diff --git a/sys-apps/baselayout/metadata.xml b/sys-apps/baselayout/metadata.xml
new file mode 100644
index 00000000..96a2d586
--- /dev/null
+++ b/sys-apps/baselayout/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-apps/gpu-detector/Manifest b/sys-apps/gpu-detector/Manifest
new file mode 100644
index 00000000..2d2431d3
--- /dev/null
+++ b/sys-apps/gpu-detector/Manifest
@@ -0,0 +1,5 @@
+AUX gpu-configuration 25811 SHA256 e093e198960da035c92947f80cdc79599da5d923a9720ab1541233492b97337a SHA512 e772f1256ed105f870f72a6bd1476a19fa30a6b65fa8d17de8499a45a57098e05c49a55ce28a2ee74ea903c47e1fd956205dc25efc7af3353d4bf72feaf73a9f WHIRLPOOL 6bf9599741a552e490a914b971fe33d6018131292630a47d33f9b1f2e1b373a1f38bb4fd69debe10af1245f62246f8bc4729e3c43de17099160c503a205020ee
+EBUILD gpu-detector-2.5.0-r3.ebuild 947 SHA256 61115b4d61a23231c7dd50543cec101115d3a32875170f499414696571ff4eaf SHA512 5b4d5e9fb8209e8a5c09e96e4d9166eabf5fb6820d1aafa24400116c2290aeda291cbb55e671d5d46a9cba5299f5ba16c5141fd2fe6340e477cf4f26422f7b01 WHIRLPOOL afb697fea7eb1dacbfaf7ffa974db85d26b4074ad39e3b2aef7f15340cea17aad060367664d1d2d2f6475e1d05fdc548fc04b9ed5d5af7167f3b5ab0f9147d35
+EBUILD gpu-detector-2.6-r2.ebuild 925 SHA256 7f0d2cb0da15ee13dac589f87617ed1d9070f91a86a556861d6d93fb45a51f2a SHA512 882ae46731e8ef762977351655fd5c1578655825c39682cf64edd05c9639ecf0209aeda5e361568dbc000c5b71b8d5e2a51d27a3f03348434d25524d8b91016c WHIRLPOOL dccd6ff2a32507b50c2a3b39456df570b15abbfb66458305545b3e381067f16c46b680dfd3ee693ccf6d31c9d4277f6de750cccce1722bdf896a9a51c78ade00
+EBUILD gpu-detector-2.6-r6.ebuild 895 SHA256 4ad481e7efa87de8246716159ef20f8a6a436fa8acf9abeb3e5905db0c5fd5b9 SHA512 0d0fd53e5a5d817f20f21a0249357fe45e6c6b60d8ff7fcb3f55377950bd1145eb6e8158f8ffe75bbe058019ebf112755ed05c65aaf5a4ff4fdd3e9b88a9ca38 WHIRLPOOL d178d2740ca0b51906505c9dce18b6901dd9e82be366c51ef0f6812afd0e820cbabe9aa2aa5ef5e55083c4e3430e2b29114dc1f69ea3c52ff26b66702c0be10e
+EBUILD gpu-detector-3.ebuild 482 SHA256 eaf15b3c8ad33381fc6bc730c44d3ff3d2b0c0bced5a7f7f84ce8411c1f6b6ab SHA512 86e26196f3d1f80707ea46764b481deb9eddad924c784d8c4a5ac81f97e3a65254ce1d17a32cabe4372f00030b106144e16c932f6fc76d74c7e8cf1704d122cd WHIRLPOOL 9f7de6f97156e13541ff6422aa455de5cad782a522b0d7761d609d145e14a031d9b5dc75a05e7f0db9c79440234838ffb38c2e6d6cb6ff4ffe6af16ff93b0490
diff --git a/sys-apps/gpu-detector/files/gpu-configuration b/sys-apps/gpu-detector/files/gpu-configuration
new file mode 100755
index 00000000..2f816efe
--- /dev/null
+++ b/sys-apps/gpu-detector/files/gpu-configuration
@@ -0,0 +1,776 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import subprocess
+try:
+ from subprocess import getoutput
+except ImportError:
+ from commands import getoutput
+import shutil
+import sys
+
+# Variables
+xorgfile = "/etc/X11/xorg.conf"
+lspci = '/usr/sbin/lspci'
+nvidia_settings = "/usr/share/applications/nvidia-settings.desktop"
+
+device_id_prefix = "RogentosVga"
+nvidia_option_prefix = "--nvidia-opt--"
+screen_layout_sections = []
+device_sections = []
+xorg_conf_structure = """
+Section "Module"
+ SubSection "extmod"
+ Option "omit xfree86-dga"
+ EndSubSection
+ Load "i2c"
+ Load "ddc"
+ Load "vbe"
+ Load "dri"
+ Load "glx"
+ Load "synaptics"
+EndSection
+
+Section "ServerFlags"
+ Option "AllowMouseOpenFail" "true"
+EndSection
+
+Section "Monitor"
+ Identifier "Generic Monitor"
+ VertRefresh 43 - 60
+ HorizSync 28 - 80
+EndSection
+
+__device_section__
+
+__screen_section__
+
+Section "DRI"
+ Mode 0666
+EndSection
+
+Section "ServerLayout"
+ Identifier "Main Layout"
+ __screen_layout_section__
+EndSection
+
+Section "Extensions"
+ #Option "Composite" "Enable"
+EndSection
+"""
+
+screen_sections = []
+screen_section = """
+Section "Screen"
+
+ Identifier "Screen __screen_id__"
+ Device "%s__screen_id__"
+ Monitor "Generic Monitor"
+ %sOption "AddARGBGLXVisuals" "true"
+ %sOption "RegistryDwords" "EnableBrightnessControl=1"
+
+ DefaultDepth 24
+
+ SubSection "Display"
+ Depth 8
+ ViewPort 0 0
+ #Modes "1024x768" "800x600" "640x480"
+ EndSubsection
+
+ SubSection "Display"
+ Depth 16
+ ViewPort 0 0
+ #Modes "1024x768" "800x600" "640x480"
+ EndSubsection
+
+ SubSection "Display"
+ Depth 24
+ ViewPort 0 0
+ #Modes "1024x768" "800x600" "640x480"
+ EndSubsection
+
+EndSection
+""" % (device_id_prefix, nvidia_option_prefix,
+ nvidia_option_prefix,)
+
+# cmdlines
+options = sys.argv[1:]
+dryrun = False
+noproprietary = False
+nvidia_forcefail = False
+nvidia_disablelegacy = False
+legacy = False
+livecd = False
+steps = []
+forced_xdriver = ''
+current_arch = os.uname()[4]
+nomodeset = False
+noefi = False
+
+fglrx_supported = sorted(getoutput(
+ "modinfo fglrx | grep alias | grep pci | "
+ "cut -d':' -f 3 | cut -d'*' -f 1 | "
+ "sed 's/.*1002d//' | sed 's/^0000//' | sed 's/sv$//'"
+ ).lower().split())
+
+nvidia_71xx_supported = ['0020', '0028', '0029', '002c', '002d', '00a0',
+ '0100', '0101', '0103', '0150', '0151', '0152', '0153']
+nvidia_96xx_supported = ['0110', '0111', '0112', '0113', '0170', '0171',
+ '0172', '0173', '0174', '0175', '0176', '0177', '0178', '0179', '017a',
+ '017c', '017d', '0181', '0182', '0183', '0185', '0188', '018a', '018b',
+ '018c', '01a0', '01f0', '0200', '0201', '0202', '0203', '0250', '0251',
+ '0253', '0258', '0259', '025b', '0280', '0281', '0282', '0286', '0288',
+ '0289', '028c']
+nvidia_173xx_supported = ['00fa', '00fb', '00fc', '00fd', '00fe', '0301',
+ '0302', '0308', '0309', '0311', '0312', '0314', '031a', '031b', '031c',
+ '0320', '0321', '0322', '0323', '0324', '0325', '0326', '0327', '0328',
+ '032a', '032b', '032c', '032d', '0330', '0331', '0332', '0333', '0334',
+ '0338', '033f', '0341', '0342', '0343', '0344', '0347', '0348', '034c',
+ '034e']
+# Taken from here:
+# http://www.nvidia.com/object/IO_32667.html
+nvidia_304xx_supported = ['0040', '0041', '0042', '0043', '0044', '0045',
+ '0046', '0047', '0048', '004e', '0090', '0091', '0092', '0093', '0095',
+ '0098', '0099', '009d', '00c0', '00c1', '00c2', '00c3', '00c8', '00c9',
+ '00cc', '00cd', '00ce', '00f1', '00f2', '00f3', '00f4', '00f5', '00f6',
+ '00f8', '00f9', '0140', '0141', '0142', '0143', '0144', '0145', '0146',
+ '0147', '0148', '0149', '014a', '014c', '014d', '014e', '014f', '0160',
+ '0161', '0162', '0163', '0164', '0165', '0166', '0167', '0168', '0169',
+ '016a', '01d0', '01d1', '01d2', '01d3', '01d6', '01d7', '01d8', '01da',
+ '01db', '01dc', '01dd', '01de', '01df', '0211', '0212', '0215', '0218',
+ '0221', '0222', '0240', '0241', '0242', '0244', '0245', '0247', '0290',
+ '0291', '0292', '0293', '0294', '0295', '0297', '0298', '0299', '029a',
+ '029b', '029c', '029d', '029e', '029f', '02e0', '02e1', '02e2', '02e3',
+ '02e4', '038b', '0390', '0391', '0392', '0393', '0394', '0395', '0397',
+ '0398', '0399', '039c', '039e', '03d0', '03d1', '03d2', '03d5', '03d6',
+ '0531', '0533', '053a', '053b', '053e', '07e0', '07e1', '07e2', '07e3',
+ '07e5']
+savage_supported = ['8a20', '8a21', '8a22', '9102', '8c10', '8c11', '8c12',
+ '8c13', '8c22', '8c24', '8c26', '8c2a', '8c2b', '8c2c', '8c2d', '8c2e',
+ '8c2f', '8a25', '8a26', '8d01', '8d02', '8d03', '8d04']
+unichrome_supported = ['3108', '3118', '3157', '3343', '3344', '7205']
+
+lspci_output = ''
+for option in options:
+ if option == "--dry-run":
+ dryrun = True
+ elif option.startswith('--with-lspci=') and len(option.split("=")) >= 2:
+ option = option.split("=")[1:]
+ option = "=".join(option)
+ if option.startswith('"'):
+ option = option[1:]
+ if option.startswith("'"):
+ option = option[1:]
+ if option.endswith("'"):
+ option = option[:len(option)-1]
+ if option.endswith('"'):
+ option = option[:len(option)-1]
+ lspci_output = option
+ elif option.startswith('--forced-xdriver=') and len(option.split("=")) == 2:
+ forced_xdriver = option.split("=")[1]
+
+if not lspci_output:
+ lspci_output = getoutput(lspci+' -mm -n')
+
+# parse cmdline
+with open("/proc/cmdline","r") as f:
+ cmdline = f.readline().split()
+for cmd in cmdline:
+ if cmd == "noproprietary":
+ noproprietary = True
+ elif cmd == "nomodeset":
+ nomodeset = True
+ elif cmd == "nvidia=forcefail":
+ nvidia_forcefail = True
+ elif cmd == "nvidia=disablelegacy":
+ nvidia_disablelegacy = True
+ elif cmd == "legacy":
+ legacy = True
+ elif cmd == "cdroot":
+ livecd = True
+ elif cmd == "noefi":
+ noefi = True
+ elif cmd.startswith("xdriver=") and (len(cmd.split("=")) == 2):
+ if not forced_xdriver:
+ forced_xdriver = cmd.split("=")[1] # --forced-xdriver= owns
+
+def openrc_running():
+ return os.path.isfile("/run/openrc/softlevel")
+
+def systemd_running():
+ return os.path.isdir("/run/systemd/system")
+
+def remove_proprietary_opengl(bumblebee):
+ if not dryrun:
+ if not bumblebee:
+ os.system("""
+ mount -t tmpfs none /usr/lib/opengl/ati &> /dev/null
+ mount -t tmpfs none /usr/lib/opengl/nvidia &> /dev/null
+ sed -i '/LIBGL_DRIVERS_PATH/ s/.*//' /etc/profile.env
+ """)
+ fix_possible_opengl_misconfiguration('xorg-x11')
+ else:
+ print("Bumblebee enabled, not deactivating proprietary drivers")
+ else:
+ print("I was about to remove proprietary OpenGL libraries")
+
+def get_kernel_version():
+ try:
+ return int(os.uname()[2].replace(".", "")[:3])
+ except (ValueError, TypeError) as err:
+ print("get_kernel_version: ouch: %s" % (err,))
+ return None
+
+def setup_radeon_kms():
+ # Starting from kernel 3.6, we have CONFIG_DRM_RADEON_KMS=y
+ kver = get_kernel_version()
+ if kver is None:
+ kver = 360 # assume new kernel
+ if not dryrun and kver < 360:
+ os.system("""
+ modprobe -r radeon &> /dev/null
+ modprobe radeon modeset=1 && touch /tmp/.radeon.kms
+ """)
+ else:
+ print("I was about to modprobe radeon modeset=1")
+
+def remove_tar_members_from_sys(tarpath):
+ import tarfile
+ tar = tarfile.open(tarpath)
+ for el in sorted(tar.getnames(), reverse = True):
+ el = "/%s" % (el,)
+ if os.path.isfile(el):
+ try:
+ os.remove(el)
+ except OSError:
+ pass
+ if os.path.isdir(el):
+ try:
+ os.rmdir(el)
+ except OSError:
+ pass
+ tar.close()
+
+def generate_fglrx_steps(videocard, cardnumber, total_cards, bus_id):
+ print("AMD!")
+ print("total supported AMD cards: %s" % (len(fglrx_supported),))
+ print("supported list:", fglrx_supported)
+ supported = card_id in fglrx_supported
+ if supported:
+ print("fglrx driver supports this card")
+ # check if nomodeset is enabled for >=3.6.0 kernel
+ kver = get_kernel_version()
+ if kver is None:
+ kver = 360 # assume new kernel
+ if not nomodeset and kver >= 360:
+ print("however, nomodeset is not set, though KMS is active,"
+ " defaulting to OSS driver")
+ supported = False
+
+ if supported:
+ if noproprietary:
+ steps.append((drop_kernel_mod, "fglrx",))
+ steps.append((setup_radeon_kms,))
+ else:
+ steps.append((fix_possible_opengl_misconfiguration,
+ "ati"))
+ steps.append((copy_ati_settings_on_desktop,))
+ steps.append((opengl_activate, "ati"))
+ steps.append((set_xorg_device, "fglrx",
+ cardnumber, total_cards, bus_id,))
+ else:
+ # video card not supported by fglrx
+ print("using OSS 'ati' drivers")
+ generate_generic_steps()
+ # This works for Mach64, Rage128
+ # Radeon and in future RadeonHD driver
+ steps.append((drop_kernel_mod, "fglrx",))
+ steps.append((setup_radeon_kms,))
+
+def check_if_driver_is_available(xdriver):
+ drv_path = "/usr/lib/xorg/modules/drivers/" + xdriver + "_drv.so"
+ if os.path.isfile(drv_path):
+ print("check_if_driver_is_available for " + xdriver + ": available")
+ return True
+ print("check_if_driver_is_available for " + xdriver + ": not available")
+ return False
+
+def check_if_proprietary_driver_system_is_healthy(kernelmod):
+ rc = subprocess.call(["modprobe", kernelmod])
+ if rc == 0:
+ if kernelmod == "nvidia":
+ if os.path.exists("/usr/lib/opengl/nvidia/lib"):
+ print("check_if_proprietary_driver_system_is_healthy:"
+ " nvidia healthy")
+ return True
+ print("check_if_proprietary_driver_system_is_healthy:"
+ " nvidia NOT healthy")
+ return False
+ elif kernelmod == "fglrx":
+ kver = get_kernel_version()
+ if kver is None:
+ kver = 360 # assume new kernel
+ if not nomodeset and kver >= 360:
+ print("check_if_proprietary_driver_system_is_healthy:"
+ " fglrx (ati) NOT healthy, 'nomodeset' boot argument"
+ " is mising")
+ return False
+ if os.path.exists("/usr/lib/opengl/ati/lib"):
+ print("check_if_proprietary_driver_system_is_healthy:"
+ " fglrx (ati) healthy")
+ return True
+ print("check_if_proprietary_driver_system_is_healthy:"
+ " fglrx (ati) NOT healthy")
+ return False
+ return False
+
+def deploy_nvidia_xxxxxx_drivers(ver):
+ if dryrun:
+ print("I was about to run deploy_nvidia_xxxxxx_drivers"
+ ", ver: %s" % (ver,))
+ return False
+
+ drivers_dir = "/install-data/drivers"
+ # are they available ? we're on livecd...
+ if not os.path.isdir(drivers_dir):
+ print("drivers_dir not available")
+ return False
+
+ packages = os.listdir(drivers_dir)
+ _packages = []
+ for pkg in packages:
+ if not pkg.endswith(".tbz2"):
+ continue
+ if pkg.startswith("x11-drivers:nvidia-drivers-" + ver):
+ _packages.append(pkg)
+ elif pkg.startswith("x11-drivers:nvidia-userspace" + ver):
+ _packages.append(pkg)
+
+ packages = [os.path.join(drivers_dir, x) for x in _packages]
+ package_names = ["x11-drivers/nvidia-drivers",
+ "x11-drivers/nvidia-userspace"]
+ if not packages:
+ return False
+
+ from entropy.client.interfaces import Client
+ _entropy = Client()
+
+ # prepare system
+ for package_name in package_names:
+ inst_repo = _entropy.installed_repository()
+ package_id, result = inst_repo.atomMatch(package_name)
+ if package_id == -1:
+ continue
+ content = inst_repo.retrieveContentIter(package_id)
+ for myfile, ftype in content:
+ try:
+ os.remove(myfile)
+ except (OSError, IOError):
+ pass
+
+ if hasattr(_entropy,"destroy"):
+ _entropy.destroy()
+
+ for package_file in packages:
+ # remove old garbage - copy over - create module
+ subprocess.call(
+ ["tar", "xjf", package_file, "-C", "/"])
+ # try to check driver status now
+ rc = check_if_proprietary_driver_system_is_healthy("nvidia")
+ if not rc:
+ remove_tar_members_from_sys(package_file)
+ return rc
+
+efivars_loaded = False
+def is_efi():
+ """
+ Return whether the system boots from EFI
+ """
+ global efivars_loaded
+
+ if noefi:
+ return False
+
+ if not efivars_loaded:
+ subprocess.call(["modprobe", "efivars"])
+ efivars_loaded = True
+
+ return os.path.exists("/sys/firmware/efi")
+
+def get_vesa_driver():
+ """
+ Return either "vesa" or "fbdev" as the fallback
+ vesa-like X driver.
+ """
+ if is_efi():
+ # vesa does not work
+ return "fbdev"
+ return "vesa"
+
+def set_xorg_device(xdriver, cardnum, total_cards, bus_id):
+ if (xdriver not in ("nvidia", "fglrx",)) and \
+ (not check_if_driver_is_available(xdriver)):
+ xdriver = get_vesa_driver() # fallback to vesa
+ bus_id_mark = "#"
+ if total_cards > 1:
+ bus_id_mark = ""
+
+ device_sections.append("""
+Section "Device"
+
+ Identifier "%s%s"
+ Driver "%s"
+ %sBusID "%s"
+ #Option "RenderAccel" "on"
+ #Option "XAANoOffscreenPixmaps"
+ #Option "BusType" "PCI"
+ #Option "ColorTiling" "on"
+ #Option "EnablePageFlip" "on"
+ # UseEvents is causing segmentation faults with
+ # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers
+ #Option "UseEvents" "True"
+ Option "LogoPath" "/usr/share/backgrounds/rogentoslinux-nvidia.png"
+
+EndSection
+ """ % (device_id_prefix, cardnum, xdriver, bus_id_mark, bus_id,))
+
+ my_screen_section = screen_section.replace("__screen_id__", str(cardnum))
+ # setup Option AddARGBVisuals
+ # especially needed for legacy nvidia drivers, but works
+ # on all of them
+ if xdriver == "nvidia":
+ my_screen_section = my_screen_section.replace(nvidia_option_prefix, "")
+ else:
+ my_screen_section = my_screen_section.replace(nvidia_option_prefix, "#")
+ screen_sections.append(my_screen_section)
+ screen_layout_sections.append('Screen %s "Screen %s"' % (
+ cardnum, cardnum,))
+
+def opengl_activate(profile, force=False):
+ if not dryrun:
+ if not force:
+ current = opengl_show()
+ if current == profile:
+ print("OpenGL profile is already set to: " + profile)
+ return
+ subprocess.call(["eselect", "opengl", "set", profile])
+ else:
+ print("I was about to set opengl subsystem to: " + profile)
+
+def opengl_show():
+ return getoutput("eselect opengl show").split("\n")[0].strip()
+
+def fix_possible_opengl_misconfiguration(profile):
+ # get current subsystem
+ current = opengl_show()
+ if not dryrun:
+ if (profile in ("ati","nvidia","xorg-x11")) and (profile != current):
+ if profile == "ati" or profile == "nvidia":
+ subprocess.call(["umount", "/usr/lib/opengl/" + profile])
+ subprocess.call(["umount", "/usr/lib/opengl/" + profile])
+ opengl_activate(profile)
+ else:
+ print("I was about to fix OpenGL subsystem to: " + \
+ profile + " while the current implementation is: " + \
+ current)
+
+def copy_nvidia_settings_on_desktop():
+ homes = []
+ if os.path.isfile(nvidia_settings):
+ _homes = os.listdir("/home")
+ homes += [x for x in os.listdir("/home") \
+ if os.path.isdir("/home/" + x + "/Desktop")]
+
+ for home in homes:
+ try:
+
+ full_home = os.path.join("/home", home)
+ st = os.stat(full_home)
+ dest_path = "/home/" + home + "/Desktop/" + \
+ os.path.basename(nvidia_settings)
+ shutil.copy2(nvidia_settings, dest_path)
+ os.chmod(dest_path, 0o755)
+ os.chown(dest_path, st.st_uid, st.st_gid)
+
+ if os.path.isdir("/etc/skel/Desktop"):
+ dest_path = os.path.join(
+ "/etc/skel/Desktop",
+ os.path.basename(nvidia_settings))
+ shutil.copy2(nvidia_settings, dest_path)
+ os.chmod(dest_path, 0o755)
+
+ except Exception:
+ pass
+
+def copy_ati_settings_on_desktop():
+ desktop_files = getoutput(
+ 'equo query files ati-drivers --quiet | grep ".desktop"').split("\n")
+ desktop_files = [x for x in desktop_files if os.path.isfile(x)]
+ print("copy_ati_settings_on_desktop: found files: "+str(desktop_files))
+
+ for ati_settings in desktop_files:
+ homes = os.listdir("/home")
+ homes = [x for x in homes if os.path.isdir("/home/" + x + "/Desktop")]
+ for home in homes:
+ try:
+ full_home = os.path.join("/home", home)
+ st = os.stat(full_home)
+ dest_path = "/home/" + home + "/Desktop/" + \
+ os.path.basename(ati_settings)
+ shutil.copy2(ati_settings, dest_path)
+ os.chmod(dest_path, 0o755)
+ os.chown(dest_path, st.st_uid, st.st_gid)
+
+ if os.path.isdir("/etc/skel/Desktop"):
+ dest_path = os.path.join(
+ "/etc/skel/Desktop",
+ os.path.basename(ati_settings))
+ shutil.copy2(ati_settings, dest_path)
+ os.chmod(dest_path, 0o755)
+ except Exception:
+ pass
+
+def setup_nvidia_drivers(card_id):
+ drv_string = ''
+ done_legacy = False
+
+ drivers_map = (
+ ("304", nvidia_304xx_supported,),
+ ("173", nvidia_173xx_supported,),
+ ("96", nvidia_173xx_supported,),
+ ("71", nvidia_173xx_supported,),
+ )
+ for ver, lst in drivers_map:
+ if card_id not in lst:
+ continue
+ print("NVIDIA %s driver selected" % (ver,))
+ drv_string = ver
+ if livecd:
+ rc = deploy_nvidia_xxxxxx_drivers(ver)
+ if rc:
+ print("NVIDIA %s deployed correctly" % (ver,))
+ done_legacy = True
+ break
+
+ if not done_legacy:
+ drv_string = '[latest]'
+ print("latest and greatest NVIDIA driver selected or unsupported")
+
+ healthy = check_if_proprietary_driver_system_is_healthy("nvidia")
+ if healthy:
+ print("NVIDIA proprietary driver %s is loaded" % (drv_string,))
+
+ if done_legacy:
+ os.makedirs("/lib/nvidia/legacy")
+ with open("/lib/nvidia/legacy/running", "w") as f:
+ f.write("%s" % (drv_string,))
+
+ return done_legacy, healthy
+
+def generate_nvidia_bumblebee_steps(v3dcard, company_id, card_id):
+ done_legacy, healthy = setup_nvidia_drivers(card_id)
+ if not healthy:
+ print("NVIDIA drivers couldn't be loaded, cannot enable bumblebee")
+ return
+
+ if dryrun:
+ print("Was about to start bumblebee")
+ return
+
+ if not livecd:
+ print("LiveCD mode off, not starting bumblebee service")
+ return
+
+ # This is used by our Installer
+ with open("/tmp/.bumblebee.enabled", "w") as f:
+ pass
+
+ if openrc_running():
+ os.system("/etc/init.d/bumblebee start")
+ elif systemd_running():
+ os.system("/usr/bin/systemctl start bumblebeed")
+
+def generate_nvidia_steps(videocard, cardnumber, total_cards, bus_id):
+ comp_id, card_id = extract_pci_ids(videocard)
+ done_legacy, healthy = setup_nvidia_drivers(card_id)
+
+ if healthy:
+ if done_legacy:
+ # then activate nvidia opengl subsystem after resetting it
+ steps.append((opengl_activate, "xorg-x11"))
+ steps.append((opengl_activate, "nvidia"))
+
+ steps.append((set_xorg_device, "nvidia",
+ cardnumber, total_cards, bus_id,))
+ steps.append((fix_possible_opengl_misconfiguration, "nvidia"))
+ steps.append((copy_nvidia_settings_on_desktop,))
+
+ else:
+
+ steps.append((fix_possible_opengl_misconfiguration, "nvidia"))
+ steps.append((copy_nvidia_settings_on_desktop,))
+ steps.append((opengl_activate, "nvidia"))
+ steps.append((set_xorg_device, "nvidia",
+ cardnumber, total_cards, bus_id,))
+ else:
+ print("NVIDIA drivers couldn't be loaded, switchting to nv driver")
+ steps.append((opengl_activate, "xorg-x11"))
+
+def generate_generic_steps():
+ steps.append((remove_proprietary_opengl, bb_enabled))
+ steps.append((opengl_activate, "xorg-x11",))
+
+def drop_kernel_mod(kmod):
+ return subprocess.call(["modprobe", "-r", kmod])
+
+def extract_pci_ids(videocard_str):
+ videocard_split = [x.strip() for x in videocard_str.strip().split('"') \
+ if x.strip()]
+ try:
+ card_id = videocard_split[3].split()[-1].lower().strip("[]")
+ except IndexError:
+ card_id = None
+
+ try:
+ company_id = videocard_split[2].split()[-1].lower().strip("[]")
+ except IndexError:
+ company_id = None
+
+ return company_id, card_id
+
+def extract_vga_cards(lspci_list):
+ cards = []
+ for item in lspci_list:
+ try:
+ class_type = item.split()[1].strip('"')
+ if class_type == "0300":
+ cards.append(item)
+ except IndexError:
+ continue
+ return cards
+
+def extract_3d_cards(lspci_list):
+ # bumblebee support
+ cards = []
+ for item in lspci_list:
+ try:
+ class_type = item.split()[1].strip('"')
+ if class_type == "0302":
+ cards.append(item)
+ except IndexError:
+ continue
+ return cards
+
+
+# Create videocards list
+lspci_out_split = lspci_output.split("\n")
+videocards = extract_vga_cards(lspci_out_split)
+v3dcards = extract_3d_cards(lspci_out_split)
+# Run the program
+cardnumber = -1
+
+total_cards = len(videocards)
+forced_monitor_modes = False
+steps = []
+bb_enabled = False
+write_config = False
+
+for v3dcard in v3dcards:
+
+ company_id, card_id = extract_pci_ids(v3dcard)
+
+ if company_id == "10de":
+ print("NVIDIA Optimus 3D Acceleration detected, enabling bumblebee")
+ generate_nvidia_bumblebee_steps(v3dcard, company_id, card_id)
+ bb_enabled = True
+
+for videocard in videocards:
+
+ # setup card number
+ cardnumber += 1
+ print("Card Number: " + str(cardnumber))
+ try:
+ bus_id = "PCI:%s" % (
+ videocard.split()[0].split(".", 1)[0]
+ )
+ except (IndexError,ValueError,TypeError,):
+ bus_id = None
+
+ if forced_xdriver:
+ print("You have chosen to force the X driver: " + forced_xdriver)
+ if forced_xdriver == "fglrx":
+ if check_if_proprietary_driver_system_is_healthy("fglrx") \
+ or noproprietary:
+ steps.append((opengl_activate, "xorg-x11"))
+ forced_xdriver = "ati"
+ steps.append((drop_kernel_mod, "fglrx",))
+ else:
+ steps.append((fix_possible_opengl_misconfiguration, "ati"))
+ steps.append((copy_ati_settings_on_desktop,))
+ steps.append((opengl_activate, "ati"))
+
+ elif forced_xdriver == "nvidia" and (not noproprietary):
+ generate_nvidia_steps(videocard, cardnumber, total_cards, bus_id)
+ elif forced_xdriver == "vesa":
+ forced_monitor_modes = True
+ else:
+ generate_generic_steps()
+ steps.append((set_xorg_device, forced_xdriver,
+ cardnumber, total_cards, bus_id,))
+ write_config = True
+
+ else:
+ company_id, card_id = extract_pci_ids(videocard)
+ print("[%s] company_id: %s | card_id: %s" % (
+ cardnumber, company_id, card_id,))
+
+ if company_id == "10de": # NVIDIA
+ if noproprietary:
+ steps.append((set_xorg_device, "nv",
+ cardnumber, total_cards, bus_id,))
+ else:
+ generate_nvidia_steps(
+ videocard, cardnumber, total_cards, bus_id)
+ print("NVIDIA!")
+ write_config = True
+
+ elif company_id == "1002":
+ generate_fglrx_steps(
+ videocard, cardnumber, total_cards, bus_id)
+ write_config = True
+
+ else:
+ generate_generic_steps()
+ print("GPU will be automatically detected by X.Org and udevd")
+
+
+# now create the file
+for args in steps:
+ func, args = args[0], args[1:]
+ func(*args)
+
+if write_config:
+ config = xorg_conf_structure.replace(
+ '__device_section__',
+ '\n\n'.join(device_sections))
+ config = config.replace(
+ '__screen_section__',
+ '\n\n'.join(screen_sections))
+ config = config.replace(
+ '__screen_layout_section__',
+ '\n '.join(screen_layout_sections))
+ if forced_monitor_modes:
+ config = config.replace('#Modes', 'Modes')
+
+ if not dryrun:
+ with open(xorgfile, "w") as f:
+ f.write(config)
+ f.flush()
+else:
+ try:
+ os.remove(xorgfile)
+ except (OSError, IOError):
+ pass
+
+raise SystemExit(0)
diff --git a/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild b/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild
new file mode 100644
index 00000000..7ab4534a
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild
@@ -0,0 +1,39 @@
+# Copyright 2004-2010 Sabayon
+# Copyright 2012 Rogentos
+# Original Author Fabio Erculiani
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Rogentos live tool for X.Org video driver configuration"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND="app-misc/rogentoslive-tools"
+DEPEND=""
+
+src_unpack () {
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+ cd "${WORKDIR}"
+ exeinto /sbin/
+ doexe gpu-configuration
+}
+
+pkg_postinst() {
+ local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+ if [ -f "${xorg_conf}" ]; then
+ echo
+ elog "Disabling UseEvents option in your xorg.conf if found"
+ elog "This option is known to cause Segmentation Faults on"
+ elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+ echo
+ # this is quite lame sed, but who cares
+ sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+ fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild
new file mode 100644
index 00000000..405d693b
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Sabayon live tool for X.Org video driver configuration"
+HOMEPAGE="http://www.sabayon.org"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND=">=app-misc/rogentoslive-tools-1.0
+ !>sys-apps/gpu-detector-2.6"
+DEPEND=""
+
+src_unpack () {
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+ cd "${WORKDIR}"
+ exeinto /sbin/
+ doexe gpu-configuration
+}
+
+pkg_postinst() {
+ local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+ if [ -f "${xorg_conf}" ]; then
+ echo
+ elog "Disabling UseEvents option in your xorg.conf if found"
+ elog "This option is known to cause Segmentation Faults on"
+ elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+ echo
+ # this is quite lame sed, but who cares
+ sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+ fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild b/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild
new file mode 100644
index 00000000..f392f733
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild
@@ -0,0 +1,37 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Rogentos live tool for X.Org video driver configuration"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND=">=app-misc/rogentoslive-tools-1"
+DEPEND=""
+
+src_unpack () {
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+ cd "${WORKDIR}"
+ exeinto /sbin/
+ doexe gpu-configuration
+}
+
+pkg_postinst() {
+ local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+ if [ -f "${xorg_conf}" ]; then
+ echo
+ elog "Disabling UseEvents option in your xorg.conf if found"
+ elog "This option is known to cause Segmentation Faults on"
+ elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+ echo
+ # this is quite lame sed, but who cares
+ sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+ fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-3.ebuild b/sys-apps/gpu-detector/gpu-detector-3.ebuild
new file mode 100644
index 00000000..21aa73f8
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-3.ebuild
@@ -0,0 +1,24 @@
+# Copyright 2004-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Configures your GPU when autodetection fails do to it"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND="app-misc/rogentos-live"
+DEPEND=""
+
+src_unpack () {
+ cd "${WORKDIR}"
+ cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+ cd "${WORKDIR}"
+ exeinto /sbin/
+ doexe gpu-configuration
+}
diff --git a/sys-apps/lsb-release/Manifest b/sys-apps/lsb-release/Manifest
new file mode 100644
index 00000000..abc7cd91
--- /dev/null
+++ b/sys-apps/lsb-release/Manifest
@@ -0,0 +1,4 @@
+AUX lsb-release-rogentos-version.patch 703 SHA256 715deb445f89ca85f31c079caf94d04603f971dafbbe230479059859523d681a SHA512 5ee0e7eed0410349cf2e9bb25cee7a478f87d607bc57ed1ae3a244d30855d3ec142c4bb683bcb526ec8011dd1d9e804f6126f9f9a78199b8152bca86732da6ef WHIRLPOOL deb30762e1d384d8c842e57ee02f0a581391190e1b88cb76489673a8bc96dafa3e6dc83154155e70223ad5f653d8adf303bda2d37fc86cdba83a9b9274b4d182
+DIST lsb-release-1.4.tar.gz 10769 SHA256 99321288f8d62e7a1d485b7c6bdccf06766fb8ca603c6195806e4457fdf17172 SHA512 84f6f8794380463587005043f601b7a40190cd9e3409abff7f5ce7658cf029a14346eff87838296d90307192bdeff68cc00480c5c04814da7acdb3e220640fde WHIRLPOOL e8e322f3d5fddf589ae1cdc97d143da907aad418ab6099f79e90e988450a3304c58d483e2ba8c80a9a7093f73af515e6c66a1c33881681bef2da70a35c31c28d
+EBUILD lsb-release-1.4.ebuild 773 SHA256 0391bebf0fb76699bd666d2f6615655aca591466a47ad98bcf7e5c667098727c SHA512 eea41f41c75c2f7e82c548bc321d3db83d2d2717028928a93e04a442b8c8a75de69f6bb3140e9915e8b58d6560d57df5ead92e2fb829a5aef4fdb1e89c0b73bc WHIRLPOOL 45db918ca9ec511e90ecb10904a37849299289fbe3f3bbe19ccec9318c853d0f62096058af0f50bd0f6135b885ba8aa41098ac07e342f173f8491b2e63a3a40a
+MISC metadata.xml 708 SHA256 0bdba8ef6482035e636154b74110d2218a49c44bd0de4f7f6b13568796803e3f SHA512 4fb6848036e074b4186570b0064e18e77d4d698faf639c3ff77597e73c2787fedc44ba1a4ba187d9325e20f81353674ab6b8e610f69892986fd5a80169c9c51d WHIRLPOOL 1d11dafc2c4c45c9bc941f872f46295f2d678f0c22ec290273fb5677ad40c438013edeb58a0c22090f6b873d23137115ec87b34cbd18c7442d4822e068e89da2
diff --git a/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch b/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch
new file mode 100644
index 00000000..ca9933c2
--- /dev/null
+++ b/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch
@@ -0,0 +1,12 @@
+diff -Nurp lsb-release-1.4.orig/lsb_release lsb-release-1.4/lsb_release
+--- lsb-release-1.4.orig/lsb_release 2000-12-15 08:19:16.000000000 +0100
++++ lsb-release-1.4/lsb_release 2013-02-07 13:57:00.085819790 +0100
+@@ -47,7 +47,7 @@ INFO_LSB_FILE="lsb-release"
+ INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix>
+ ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib]
+ ALTERNATE_DISTRIB_NAME="Debian" # "
+-CHECKFIRST="/etc/redhat-release" # check it before file search
++CHECKFIRST="/etc/rogentos-release" # check it before file search
+
+ # Defines our exit codes
+ EXIT_STATUS="0" # default = Ok :)
diff --git a/sys-apps/lsb-release/lsb-release-1.4.ebuild b/sys-apps/lsb-release/lsb-release-1.4.ebuild
new file mode 100644
index 00000000..2f77b4c9
--- /dev/null
+++ b/sys-apps/lsb-release/lsb-release-1.4.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="LSB version query program"
+HOMEPAGE="http://www.linuxbase.org/"
+SRC_URI="mirror://sourceforge/lsb/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
+IUSE=""
+
+# Perl isn't needed at runtime, it is just used to generate the man page.
+DEPEND="dev-lang/perl"
+RDEPEND=""
+
+src_unpack() {
+ unpack ${A}
+
+ cd "${S}"
+ epatch "${FILESDIR}/${PN}-rogentos-version.patch"
+}
+
+src_install() {
+ emake \
+ prefix="${D}/usr" \
+ mandir="${D}/usr/share/man" \
+ install \
+ || die "emake install failed"
+
+ mkdir -p "${D}/etc"
+ cat > "${D}/etc/lsb-release" <<- EOF
+ DISTRIB_ID="Sabayon"
+ EOF
+}
diff --git a/sys-apps/lsb-release/metadata.xml b/sys-apps/lsb-release/metadata.xml
new file mode 100644
index 00000000..6886884e
--- /dev/null
+++ b/sys-apps/lsb-release/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>jer@gentoo.org</email>
+ <name>Jeroen Roovers</name>
+ </maintainer>
+ <longdescription lang="en">
+ This program forms part of the required functionality of
+ the LSB (Linux Standard Base) specification.
+
+ The program queries the installed state of the distribution
+ to display certain properties such as the version of the
+ LSB against which the distribution claims compliance as
+ well. It can also attempt to display the name and release
+ of the distribution along with an identifier of who produces
+ the distribution.
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-apps/openrc/Manifest b/sys-apps/openrc/Manifest
new file mode 100644
index 00000000..06ab1adb
--- /dev/null
+++ b/sys-apps/openrc/Manifest
@@ -0,0 +1,7 @@
+DIST openrc-0.10.5.tar.bz2 171742 SHA256 27677142a7aa47a1c7e863fd4bce0d092aca7870012812e4f7a690a14f1e242c
+DIST openrc-0.11.8.tar.bz2 174860 SHA256 e1f7c5ed98a63178c20f3d023a7d35fe416e8e7db2f0cf78ff346a6d2f7949a9 SHA512 aaea9f1e1d08c367beb6d35bcc1d258eb9d7b71a659c05088f9027b0558aae068b2ad7c221cf8ff8b8950f5a4a5c187ee7b986ce2d475a9e3cccda74d040f780 WHIRLPOOL 69217f13dd05e9a443d906281ada167d6892615eb5db7c372ba535a3d4a21ac3111fad9d54ef06650c3b488b848180bbfe5257dbc83f62f5ecf60724dec2900c
+DIST openrc-0.12.4.tar.bz2 131914 SHA256 c4edda2fff4b613f50b9cc265bb457a9ab0170fbc1fe7c26eccd4a5d63b2625c SHA512 14e188e382dfe02037d3e4211fa3265152d5ec92ca491b1e86154c0615583ddfc0a2592ca849ab453068dd60000886e57e7da024036fa58d7474acdbb6b92208 WHIRLPOOL 7bdc2c310ee6e87a439574f377a3c1541a118b4122d098d727f6d4464e9f645e5a4d40bedfc82f401b53e640e78494f74fac94f9b6813eb202cc18d1c5391280
+DIST openrc-0.8.2.tar.bz2 161165 SHA256 5d603869f78692947b60528f12b3107372a9e4a469621be7bc47d3829c16f8a1
+DIST openrc-0.8.3.tar.bz2 162474 SHA256 38ce2538bffe38c00055aadb85597f6f517b3e9f760dc1ed4a27ddf28cb9f4b4
+DIST openrc-0.9.8.1.tar.bz2 166841 SHA256 ba83fd5409a4a1626f35adfd06e61675585f5ae29e14dadab958016e24d2a995
+DIST openrc-0.9.9.3.tar.bz2 169462 SHA256 75487579982eddee9bbc7c3f6515ef8924eefd35c4829361e2b4c4c69bd047ab
diff --git a/sys-apps/openrc/Reasons b/sys-apps/openrc/Reasons
new file mode 100644
index 00000000..52f2f92a
--- /dev/null
+++ b/sys-apps/openrc/Reasons
@@ -0,0 +1,5 @@
+# Fabio Erculiani <lxnay@sabayonlinux.org>
+- rebrand boot string
+- disable deprecated addons warnings
+- do not let /etc/conf.d/keymaps to be overwritten, provide .example files
+- fix Gentoo bug #299633
diff --git a/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch b/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch
new file mode 100644
index 00000000..ec925cc1
--- /dev/null
+++ b/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch
@@ -0,0 +1,34 @@
+From 9f2ef0dabec9d7644f3f13e6d9e2037396493c6d Mon Sep 17 00:00:00 2001
+From: Fabio Erculiani <lxnay@sabayon.org>
+Date: Sat, 22 Jun 2013 11:05:11 +0200
+Subject: [PATCH] Filter the systemd cgroup from the current process
+
+logind relies on the name=systemd:/ cgroup path to determine the
+session name and seat through pam_systemd. The problem arises when
+the user log into a tty or via ssh and restart a service: the
+name=systemd cgroup is not cleared and it gets inherited by all
+the child processes spawned by the service.
+---
+ sh/runscript.sh.in | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
+index 58e8eac..ba8eeb4 100644
+--- a/sh/runscript.sh.in
++++ b/sh/runscript.sh.in
+@@ -249,6 +249,12 @@ while [ -n "$1" ]; do
+ cd /
+ continue
+ fi
++ if [ "$1" = start ] && [ -d /sys/fs/cgroup/systemd ]; then
++ # reset the systemd cgroup so that it won't be
++ # propagated to children. This makes logind work,
++ # which otherwise gets confused.
++ echo $$ > /sys/fs/cgroup/systemd/tasks
++ fi
+ # See if we have the required function and run it
+ for _cmd in describe start stop status ${extra_commands:-$opts} \
+ $extra_started_commands $extra_stopped_commands
+--
+1.8.2.1
+
diff --git a/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch b/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch
new file mode 100644
index 00000000..7e1140d6
--- /dev/null
+++ b/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch
@@ -0,0 +1,41 @@
+From 29f0f55c0e7debef879674ed288c1d3af0f84772 Mon Sep 17 00:00:00 2001
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Mon, 24 Jun 2013 19:31:58 +0000
+Subject: [PATCH] efivarfs: Support EFI variable access in 3.10 kernels.
+
+In the 3.10 kernel, EFI variables are now provided by a dedicated
+filesystem that needs to be mounted.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+---
+ init.d/sysfs.in | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/init.d/sysfs.in b/init.d/sysfs.in
+index 114a653..7658cb5 100644
+--- a/init.d/sysfs.in
++++ b/init.d/sysfs.in
+@@ -81,6 +81,20 @@ mount_misc()
+ eend $?
+ fi
+ fi
++
++ # setup up kernel support for efivarfs
++ # slightly complicated, as if it's build as a module but NOT yet loaded,
++ # it will NOT appear in /proc/filesystems yet
++ if [ -d /sys/firmware/efi/efivars ] \
++ && ! mountinfo -q /sys/firmware/efi/efivars; then
++ modprobe -q efivarfs
++ if grep -qs efivarfs /proc/filesystems; then
++ ebegin "Mounting efivarfs filesystem"
++ mount -n -t efivarfs -o ${sysfs_opts} \
++ efivarfs /sys/firmware/efi/efivars
++ eend $?
++ fi
++ fi
+ }
+
+ mount_cgroups()
+--
+1.8.2.1
+
diff --git a/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch b/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch
new file mode 100644
index 00000000..eb4ed168
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch
@@ -0,0 +1,16 @@
+diff -Nurp openrc-0.5.3.orig/sh/rc-functions.sh.in openrc-0.5.3/sh/rc-functions.sh.in
+--- openrc-0.5.3.orig/sh/rc-functions.sh.in 2009-12-02 20:08:02.000000000 +0100
++++ openrc-0.5.3/sh/rc-functions.sh.in 2009-12-26 05:42:17.000000000 +0100
+@@ -18,10 +18,10 @@ _addon_warn()
+ import_addon()
+ {
+ if [ -e /@LIB@/rc/addons/"$1".sh ]; then
+- _addon_warn
++ # _addon_warn
+ . /@LIB@/rc/addons/"$1".sh
+ elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
+- _addon_warn
++ # _addon_warn
+ . /@LIB@/rcscripts/addons/"$1".sh
+ else
+ return 1
diff --git a/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch b/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch
new file mode 100644
index 00000000..2b666767
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch
@@ -0,0 +1,12 @@
+diff -Naur openrc-0.6.1.a/init.d/savecache.in openrc-0.6.1.b/init.d/savecache.in
+--- openrc-0.6.1.a/init.d/savecache.in 2010-03-22 15:02:12.000000000 -0500
++++ openrc-0.6.1.b/init.d/savecache.in 2010-07-13 13:56:47.000000000 -0500
+@@ -10,7 +10,7 @@
+ ewarn "WARNING: clock skew detected!"
+ if ! yesno "savecache_skewed"; then
+ eerror "Not saving deptree cache"
+- return 1
++ return 0
+ fi
+ fi
+ ebegin "Saving dependency cache"
diff --git a/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch b/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch
new file mode 100644
index 00000000..534a8899
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/310805
+
+patch by Lars Wendler
+
+--- openrc-0.6.1/init.d/network.in
++++ openrc-0.6.1/init.d/network.in
+@@ -74,6 +74,7 @@
+ esac
+ done
+ [ $? = 2 ]
++ ;;
+ *)
+ local inet= address= rest=
+ LC_ALL=C ifconfig -a | while read inet address rest; do
diff --git a/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch b/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch
new file mode 100644
index 00000000..14ecd5f8
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch
@@ -0,0 +1,57 @@
+From c427d3c1fec89f6a9281dccdc123bad73af80804 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 28 Jun 2011 00:02:11 -0400
+Subject: [PATCH] net: ccwgroup: smooth up/down process
+
+We need to bring the link up ourselves after we've properly configured
+the device. The common code tries to bring the link up itself, but it
+does so before things are configured, and so it ends up failing.
+
+When shutting down, we need to wait for the kernel to finish destroying
+the interface. Otherwise, when doing a restart, openrc is quick enough
+to tell the kernel to destroy things, but then start trying to bring it
+back up before the kernel has finished.
+
+X-Gentoo-Bug: 367467
+X-Gentoo-Bug-URL: http://bugs.gentoo.org/367467
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ net/ccwgroup.sh | 14 ++++++++++++--
+ 1 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/net/ccwgroup.sh b/net/ccwgroup.sh
+index 248b159..60cd25f 100644
+--- a/net/ccwgroup.sh
++++ b/net/ccwgroup.sh
+@@ -58,6 +58,11 @@ ccwgroup_pre_start()
+ echo "${val}" > /sys/devices/${ccw_type}/${first}/${var}
+ done
+ eend $?
++
++ # Now that we've properly configured the device, we can run
++ # bring the interface up. Common code tried to do this already,
++ # but it failed because we didn't setup sysfs yet.
++ _up
+ }
+
+ ccwgroup_pre_stop()
+@@ -88,9 +93,14 @@ ccwgroup_post_stop()
+ local device="$(service_get_value ccwgroup_device)"
+ [ -z "${device}" ] && return 0
+ local ccw_type="$(service_get_value ccwgroup_type)"
++ local path="/sys/devices/${ccw_type}/${device}"
+
+ einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}"
+- echo "0" >/sys/devices/${ccw_type}/"${device}"/online
+- echo "1" >/sys/devices/${ccw_type}/"${device}"/ungroup
++ if echo "0" >"${path}"/online &&
++ echo "1" >"${path}"/ungroup ; then
++ # The device doesn't disappear right away which breaks
++ # restart, or a quick start up, so wait around.
++ while [ -e "${path}" ] ; do :; done
++ fi
+ eend $?
+ }
+--
+1.7.5.3
+
diff --git a/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch b/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch
new file mode 100644
index 00000000..1aa7315b
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch
@@ -0,0 +1,33 @@
+From 24ba7955634dd571a4c34dd712dc8a592eea4d73 Mon Sep 17 00:00:00 2001
+From: Joe Harvell <jharvell@dogpad.net>
+Date: Mon, 27 Jun 2011 23:20:47 +0200
+Subject: [PATCH] Only print the deprecation warning for --chuid/-c when using it
+
+The deprecation warning has been printed when using the replecement functions as
+well, bug 373243.
+---
+ src/rc/start-stop-daemon.c | 5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
+index b5c2b6e..3017701 100644
+--- a/src/rc/start-stop-daemon.c
++++ b/src/rc/start-stop-daemon.c
+@@ -788,12 +788,11 @@ start_stop_daemon(int argc, char **argv)
+ background = true;
+ break;
+
+- case 'u': /* --user <username>|<uid> */
+ case 'c': /* --chuid <username>|<uid> */
+- {
+ /* DEPRECATED */
+ ewarn("WARNING: -c/--chuid is deprecated and will be removed in the future, please use -u/--user instead");
+-
++ case 'u': /* --user <username>|<uid> */
++ {
+ p = optarg;
+ tmp = strsep(&p, ":");
+ changeuser = xstrdup(tmp);
+--
+1.7.3.4
+
diff --git a/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch b/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch
new file mode 100644
index 00000000..b520b34c
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch
@@ -0,0 +1,25 @@
+During boot, if /lib64/rc/init.d/ is a tmpfs mount
+and rc.log can be either unavailable or no longer
+available at some point in the future.
+This patch makes rc-logger deal with ENOENT if
+rc.log cannot be opened for reading.
+--- openrc-0.9.9.3.orig/src/rc/rc-logger.c
++++ openrc-0.9.9.3/src/rc/rc-logger.c
+@@ -268,7 +268,7 @@ rc_logger_open(const char *level)
+ break;
+ }
+ }
+- } else {
++ } else if (errno != ENOENT) {
+ log_error = 1;
+ eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno));
+ }
+@@ -280,7 +280,7 @@ rc_logger_open(const char *level)
+ * logfile or its basedir may be read-only during sysinit and
+ * shutdown so skip the error in this case
+ */
+- if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) {
++ if (errno != EROFS && errno != ENOENT && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) {
+ log_error = 1;
+ eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno));
+ }
diff --git a/sys-apps/openrc/files/openrc-9999-pause.patch b/sys-apps/openrc/files/openrc-9999-pause.patch
new file mode 100644
index 00000000..bf2c94f8
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-9999-pause.patch
@@ -0,0 +1,29 @@
+From e82772a6b6d4374e81b7e19a593ffdef16753418 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 21 Dec 2009 09:02:35 -0500
+Subject: [PATCH] restore init.d pause option
+
+---
+ src/rc/runscript.c | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/src/rc/runscript.c b/src/rc/runscript.c
+index 5939dae..7147902 100644
+--- a/src/rc/runscript.c
++++ b/src/rc/runscript.c
+@@ -1316,6 +1316,12 @@ runscript(int argc, char **argv)
+ prefix = NULL;
+ retval = svc_exec("status", NULL);
+ } else {
++ if (strcmp(optarg, "pause") == 0) {
++ ewarn("WARNING: 'pause' is deprecated; please use '--nodeps stop'");
++ deps = false;
++ optarg = "stop";
++ }
++
+ if (strcmp(optarg, "conditionalrestart") == 0 ||
+ strcmp(optarg, "condrestart") == 0)
+ {
+--
+1.6.6.rc3
+
diff --git a/sys-apps/openrc/files/openrc-enable-interactive-2.patch b/sys-apps/openrc/files/openrc-enable-interactive-2.patch
new file mode 100644
index 00000000..cd56586d
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-enable-interactive-2.patch
@@ -0,0 +1,11 @@
+--- openrc-0.9.8.1.orig//etc/rc.conf.in
++++ openrc-0.9.8.1/etc/rc.conf.in
+@@ -3,7 +3,7 @@
+ # Set rc_interactive to "YES" and you'll be able to press the I key during
+ # boot so you can choose to start specific services. Set to "NO" to disable
+ # this feature.
+-#rc_interactive="YES"
++rc_interactive="YES"
+
+ # If we need to drop to a shell, you can specify it here.
+ # If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
diff --git a/sys-apps/openrc/files/openrc-enable-interactive.patch b/sys-apps/openrc/files/openrc-enable-interactive.patch
new file mode 100644
index 00000000..783c3567
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-enable-interactive.patch
@@ -0,0 +1,11 @@
+--- openrc-0.6.8.orig/etc/rc.conf.in
++++ openrc-0.6.8/etc/rc.conf.in
+@@ -13,7 +13,7 @@
+ # boot so you can choose to start specific services. Set to "NO" to disable
+ # this feature. This feature is automatically disabled if rc_parallel is
+ # set to YES.
+-#rc_interactive="YES"
++rc_interactive="YES"
+
+ # If we need to drop to a shell, you can specify it here.
+ # If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
diff --git a/sys-apps/openrc/files/openrc-netmount-fix.patch b/sys-apps/openrc/files/openrc-netmount-fix.patch
new file mode 100644
index 00000000..8e6b3686
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-netmount-fix.patch
@@ -0,0 +1,11 @@
+--- openrc-0.5.3.orig/init.d/netmount.in
++++ openrc-0.5.3/init.d/netmount.in
+@@ -80,7 +80,7 @@ stop()
+ fs="$fs${fs:+,}$x"
+ done
+ if [ -n "$fs" ]; then
+- umount -at $fs || eerror "Failed to simply unmount filesystems"
++ umount -at $fs || umount -atl $fs || eerror "Failed to simply unmount filesystems"
+ fi
+
+ eindent
diff --git a/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch b/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch
new file mode 100644
index 00000000..a202aeac
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch
@@ -0,0 +1,30 @@
+diff -Naur a/openrc-0.6.0/init.d/localmount.in b/openrc-0.6.0/init.d/localmount.in
+--- a/openrc-0.6.0/init.d/localmount.in 2009-12-21 09:30:17.000000000 -0600
++++ b/openrc-0.6.0/init.d/localmount.in 2010-03-09 10:53:53.000000000 -0600
+@@ -32,6 +32,11 @@
+ # We never unmount / or /dev or $RC_SVCDIR
+ local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
+ no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
++
++ # In case $RC_SVCDIR tries to unmount due to lib64
++ # symlink configuration, we cd to it to lock it
++ cd "$RC_SVCDIR"
++
+ # RC_NO_UMOUNTS is an env var that can be set by plugins
+ OIFS=$IFS SIFS=${IFS-y}
+ IFS=$IFS:
+diff -Naur a/openrc-0.6.0/init.d/mount-ro.in b/openrc-0.6.0/init.d/mount-ro.in
+--- a/openrc-0.6.0/init.d/mount-ro.in 2009-12-21 09:30:17.000000000 -0600
++++ b/openrc-0.6.0/init.d/mount-ro.in 2010-03-09 10:56:25.000000000 -0600
+@@ -16,6 +16,11 @@
+ sync; sync
+
+ ebegin "Remounting remaining filesystems read-only"
++
++ # cd to $RC_SVCDIR it to lock it in case of incorrect
++ # assumptions about lib64 symlink configuration.
++ cd "$RC_SVCDIR"
++
+ # We need the do_unmount function
+ . "$RC_LIBEXECDIR"/sh/rc-mount.sh
+ eindent
diff --git a/sys-apps/openrc/files/openrc-sabayon-config-2.patch b/sys-apps/openrc/files/openrc-sabayon-config-2.patch
new file mode 100644
index 00000000..7e392460
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-sabayon-config-2.patch
@@ -0,0 +1,31 @@
+diff -Nurp openrc-0.9.9.3.orig/conf.d/hwclock openrc-0.9.9.3/conf.d/hwclock
+--- openrc-0.9.9.3.orig/conf.d/hwclock 2012-03-11 21:04:51.000000000 +0100
++++ openrc-0.9.9.3/conf.d/hwclock 2012-04-19 18:50:12.000000000 +0200
+@@ -2,7 +2,7 @@
+ # Greenwich Mean Time). If that clock is set to the local time, then
+ # set CLOCK to "local". Note that if you dual boot with Windows, then
+ # you should set it to "local".
+-clock="UTC"
++clock="local"
+
+ # If you want the hwclock script to set the system time (software clock)
+ # to match the current hardware clock during bootup, leave this
+diff -Nurp openrc-0.9.9.3.orig/etc/rc.conf.in openrc-0.9.9.3/etc/rc.conf.in
+--- openrc-0.9.9.3.orig/etc/rc.conf.in 2012-03-11 21:04:51.000000000 +0100
++++ openrc-0.9.9.3/etc/rc.conf.in 2012-04-19 18:49:46.000000000 +0200
+@@ -39,13 +39,13 @@
+ # This allows net.wlan and any service not matching net.* to be plugged.
+ # Example - rc_hotplug="*"
+ # This allows all services to be hotplugged
+-#rc_hotplug="*"
++rc_hotplug="!net.*"
+
+ # rc_logger launches a logging daemon to log the entire rc process to
+ # /var/log/rc.log
+ # NOTE: Linux systems require the devfs service to be started before
+ # logging can take place and as such cannot log the sysinit runlevel.
+-#rc_logger="YES"
++rc_logger="YES"
+
+ # Through rc_log_path you can specify a custom log file.
+ # The default value is: /var/log/rc.log
diff --git a/sys-apps/openrc/files/openrc-sabayon-config.patch b/sys-apps/openrc/files/openrc-sabayon-config.patch
new file mode 100644
index 00000000..440171f9
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-sabayon-config.patch
@@ -0,0 +1,35 @@
+--- openrc-0.5.3.orig/conf.d/hwclock
++++ openrc-0.5.3/conf.d/hwclock
+@@ -2,12 +2,12 @@
+ # Greenwich Mean Time). If that clock is set to the local time, then
+ # set CLOCK to "local". Note that if you dual boot with Windows, then
+ # you should set it to "local".
+-clock="UTC"
++clock="local"
+
+ # If you want to set the Hardware Clock to the current System Time
+ # (software clock) during shutdown, then say "YES" here.
+ # You normally don't need to do this if you run a ntp daemon.
+-clock_systohc="NO"
++clock_systohc="YES"
+
+ # If you wish to pass any other arguments to hwclock during bootup,
+ # you may do so here. Alpha users may wish to use --arc or --srm here.
+--- openrc-0.5.3.orig/etc/rc.conf.in
++++ openrc-0.5.3/etc/rc.conf.in
+@@ -38,13 +38,13 @@
+ # This allows net.wlan and any service not matching net.* to be plugged.
+ # Example - rc_hotplug="*"
+ # This allows all services to be hotplugged
+-#rc_hotplug="*"
++rc_hotplug="!net.*"
+
+ # rc_logger launches a logging daemon to log the entire rc process to
+ # /var/log/rc.log
+ # NOTE: Linux systems require the devfs service to be started before
+ # logging can take place and as such cannot log the sysinit runlevel.
+-#rc_logger="YES"
++rc_logger="YES"
+
+ # By default we filter the environment for our running scripts. To allow other
+ # variables through, add them here. Use a * to allow all variables through.
diff --git a/sys-apps/openrc/files/openrc.logrotate b/sys-apps/openrc/files/openrc.logrotate
new file mode 100644
index 00000000..a168f236
--- /dev/null
+++ b/sys-apps/openrc/files/openrc.logrotate
@@ -0,0 +1,7 @@
+/var/log/rc.log {
+ compress
+ rotate 4
+ weekly
+ missingok
+ notifempty
+}
diff --git a/sys-apps/openrc/files/start-stop-daemon.pam b/sys-apps/openrc/files/start-stop-daemon.pam
new file mode 100644
index 00000000..2127f6a7
--- /dev/null
+++ b/sys-apps/openrc/files/start-stop-daemon.pam
@@ -0,0 +1,2 @@
+account required pam_permit.so
+session include system-services
diff --git a/sys-apps/openrc/metadata.xml b/sys-apps/openrc/metadata.xml
new file mode 100644
index 00000000..2b127ba5
--- /dev/null
+++ b/sys-apps/openrc/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>openrc</herd>
+</pkgmetadata>
diff --git a/sys-apps/openrc/openrc-0.10.5.ebuild b/sys-apps/openrc/openrc-0.10.5.ebuild
new file mode 100644
index 00000000..a48cb922
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.10.5.ebuild
@@ -0,0 +1,471 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.10.5.ebuild,v 1.1 2012/07/04 14:36:33 williamh Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.1-r1
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+make_args() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogento ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+}
+
+pkg_setup() {
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # Rogentos bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+ make_args
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${D}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ make_args
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+ rm -rf "${D}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Rogentos customization, do not bug user with annoying updates (for now)
+ mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # 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/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+ touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${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 conf_file
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${ROOT}"/etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # /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 [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+ rm -f "${ROOT}"/etc/init.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
+
+ # 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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+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
+
+ # 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 our 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() {
+ local conf_file
+ # Rogentos customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+ # 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"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/sysinit
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+ "${ROOT}"/etc/runlevels/sysinit
+ fi
+ if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/shutdown
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+ "${ROOT}"/etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+ elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+ 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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${ROOT}etc/local.d"
+ mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+ mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${ROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${ROOT}" = "/" ]]; then
+ if ! /$(get_libdir)/rc/sh/migrate-to-run.sh; then
+ ewarn "The dependency data could not be migrated to /run/openrc."
+ ewarn "This means you need to reboot your system."
+ fi
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.11.8.ebuild b/sys-apps/openrc/openrc-0.11.8.ebuild
new file mode 100644
index 00000000..fb5daebd
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.11.8.ebuild
@@ -0,0 +1,512 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.11.8.ebuild,v 1.7 2013/01/02 19:20:39 armin76 Exp $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+ kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.1-r1
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-init-scripts-17
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # Rogentos bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS}
+ LIBNAME=$(get_libdir)
+ LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogentos ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+ use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+ use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${ED}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+ rm -rf "${ED}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Rogentos customization, do not bug user with annoying updates (for now)
+ mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+ || return
+ [[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+ touch "${EROOT}"etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${EROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local conf_file
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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 "${EROOT}"etc/conf.d/net ]] && \
+ cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${EROOT}"etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${EROOT}"etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+ )
+ fi
+
+ # /etc/conf.d/clock moved to /etc/conf.d/hwclock
+ local clock
+ use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+ if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+ mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+ fi
+ if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+ rm -f "${EROOT}"etc/init.d/clock
+ fi
+ if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+ rm -f "${EROOT}"etc/runlevels/boot/clock
+ ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+ fi
+ if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+ rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+ ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+ fi
+
+ # /etc/conf.d/rc is no longer used for configuration
+ if [[ -e "${EROOT}"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
+
+ # force net init.d scripts into symlinks
+ for f in "${EROOT}"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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ if ! has_version ">=sys-apps/openrc-0.11"; then
+ add_boot_init sysfs sysinit
+ fi
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+ if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+ migrate_udev_mount_script
+ add_boot_init tmpfiles.setup boot
+ fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+ if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+ ! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+ add_boot_init udev-mount sysinit
+ fi
+ return 0
+}
+
+migrate_from_baselayout_1() {
+ # baselayout boot init scripts have been split out
+ for f in $(cd "${ED}"/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
+
+ # 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 "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+ [[ -e "${EROOT}"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 our state for baselayout-1 users
+ if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+ (
+ [[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+ svcdir=${svcdir:-/var/lib/init.d}
+ if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+ ewarn "No state found, and no state exists"
+ elog "You should reboot this host"
+ else
+ mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+ einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+ mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+ rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+ "${EROOT}${LIBDIR}"/rc/init.d/console
+ umount "${EROOT}${svcdir}" 2>/dev/null
+ rm -rf "${EROOT}${svcdir}"
+ fi
+ )
+ fi
+
+ # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+ rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ local f v
+ for f in "${EROOT}"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}" >> "${ED}"/etc/conf.d/modules
+ done
+ rm -f "${f}"
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ fi
+ fi
+}
+
+pkg_postinst() {
+ local conf_file
+ # Rogentos customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+ rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/sysinit
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+ "${EROOT}"etc/runlevels/sysinit
+ fi
+ if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/shutdown
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+ "${EROOT}"etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+ elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ if [[ -d "${EROOT}"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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${EROOT}etc/local.d"
+ mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+ mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${EROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+ /$(get_libdir)/rc/sh/migrate-to-run.sh
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ if use newnet; then
+ local netscript=network
+ else
+ local netscript=net.lo
+ fi
+
+ if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+ ewarn "Please add the $netscript script to your boot runlevel"
+ ewarn "as soon as possible. Not doing so could leave you with a system"
+ ewarn "without networking."
+ fi
+
+ ewarn "In this version of OpenRC, the loopback interface no longer"
+ ewarn "satisfies the net virtual."
+ ewarn "If you have services now which do not start because of this,"
+ ewarn "They can be fixed by adding rc_need=\"!net\""
+ ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+ ewarn "You should also file a bug against the service asking that"
+ ewarn "need net be dropped from the dependencies."
+ ewarn "The bug you file should block the following tracker:"
+ ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+ ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+ ewarn "longer. In order to mount nfs file systems, you must use the"
+ ewarn "nfsmount service from the nfs-utils package."
+ ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+ ewarn "more information on this."
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.12.4.ebuild b/sys-apps/openrc/openrc-0.12.4.ebuild
new file mode 100644
index 00000000..0bc61a82
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12.4.ebuild
@@ -0,0 +1,356 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="git://github.com/OpenRC/${PN}.git"
+ inherit git-2
+else
+ SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix +netifrc selinux static-libs
+ tools unicode kernel_linux kernel_FreeBSD"
+
+COMMON_DEPEND=">=sys-apps/baselayout-2.1-r1
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ tools? ( dev-lang/perl )
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ selinux? ( sec-policy/selinux-openrc )
+ !<sys-fs/udev-init-scripts-17
+ !<sys-fs/udev-133"
+DEPEND="${COMMON_DEPEND}
+ virtual/os-headers
+ ncurses? ( virtual/pkgconfig )"
+RDEPEND="${COMMON_DEPEND}
+ !prefix? (
+ kernel_linux? ( || ( >=sys-apps/sysvinit-2.86-r6 sys-process/runit ) )
+ kernel_FreeBSD? ( sys-freebsd/freebsd-sbin )
+ )"
+
+PDEPEND="netifrc? ( net-misc/netifrc )"
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # RogentOS custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # RogentOS bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+ # Linux 3.10 and EFI
+ epatch "${FILESDIR}/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch"
+}
+
+src_compile() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS}
+ LIBNAME=$(get_libdir)
+ LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc
+ MKSELINUX=$(usex selinux)
+ MKSTATICLIBS=$(usex static-libs)
+ MKTOOLS=$(usex tools)"
+
+ 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="RogentOS ${brand}"
+ use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+ use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${ED}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+ rm -rf "${ED}"/etc/runlevels
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # RogentOS customization, do not bug user with annoying updates (for now)
+ mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+
+ # install documentation
+ dodoc README.busybox
+ if use newnet; then
+ dodoc README.newnet
+ fi
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+ || return
+ [[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+ touch "${EROOT}"etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${EROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local conf_file
+ # RogentOS customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${EROOT}"etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ # termencoding was added in 0.2.1 and needed in boot
+ has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ if ! has_version ">=sys-apps/openrc-0.11"; then
+ add_boot_init sysfs sysinit
+ fi
+
+ if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+ migrate_udev_mount_script
+ add_boot_init tmpfiles.setup boot
+ fi
+
+ # these were added in 0.12.
+ if ! has_version ">=sys-apps/openrc-0.12"; then
+ add_boot_init loopback
+ add_boot_init tmpfiles.dev sysinit
+
+ # ensure existing /etc/conf.d/net is not removed
+ # undoes the hack to get around CONFIG_PROTECT in openrc-0.11.8 and earlier
+ # this needs to stay in openrc ebuilds for a long time. :(
+ # Added in 0.12.
+ if [[ -f "${EROOT}"etc/conf.d/net ]]; then
+ einfo "Modifying conf.d/net to keep it from being removed"
+ cat <<-EOF >>"${EROOT}"etc/conf.d/net
+
+# The network scripts are now part of net-misc/netifrc
+# In order to avoid sys-apps/${P} from removing this file, this comment was
+# added; you can safely remove this comment. Please see
+# /usr/share/doc/netifrc*/README* for more information.
+EOF
+ fi
+ fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+ if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+ ! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+ add_boot_init udev-mount sysinit
+ fi
+ return 0
+}
+
+pkg_postinst() {
+ local conf_file
+ # RogentOS customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+
+ local LIBDIR=$(get_libdir)
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+ rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/sysinit
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+ "${EROOT}"etc/runlevels/sysinit
+ fi
+ if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/shutdown
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+ "${EROOT}"etc/runlevels/shutdown
+ fi
+ fi
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${EROOT}etc/local.d"
+ mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+ mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${EROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+ if ! /$(get_libdir)/rc/sh/migrate-to-run.sh; then
+ ewarn "The dependency data could not be migrated to /run/openrc."
+ ewarn "This means you need to reboot your system."
+ fi
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ if ! use newnet && ! use netifrc; then
+ ewarn "You have emerged OpenRc without network support. This"
+ ewarn "means you need to SET UP a network manager such as"
+ ewarn " net-misc/netifrc, net-misc/dhcpcd, net-misc/wicd,"
+ ewarn "net-misc/NetworkManager, or net-misc/badvpn."
+ ewarn "Or, you have the option of emerging openrc with the newnet"
+ ewarn "use flag and configuring /etc/conf.d/network and"
+ ewarn "/etc/conf.d/staticroute if you only use static interfaces."
+ fi
+
+ if use newnet && [ ! -e "${EROOT}"etc/runlevels/boot/network ]; then
+ ewarn "Please add the network service to your boot runlevel"
+ ewarn "as soon as possible. Not doing so could leave you with a system"
+ ewarn "without networking."
+ fi
+
+ ewarn "In this version of OpenRC, the loopback interface no longer"
+ ewarn "satisfies the net virtual."
+ ewarn "If you have services now which do not start because of this,"
+ ewarn "They can be fixed by adding rc_need=\"!net\""
+ ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+ ewarn "You should also file a bug against the service asking that"
+ ewarn "need net be dropped from the dependencies."
+ ewarn "The bug you file should block the following tracker:"
+ ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+ ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+ ewarn "longer. In order to mount nfs file systems, you must use the"
+ ewarn "nfsmount service from the nfs-utils package."
+ ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+ ewarn "more information on this."
+
+ elog "You should now update all files in /etc, using etc-update"
+ elog "or equivalent before restarting any services or this host."
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild b/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild
new file mode 100644
index 00000000..cc6b258a
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild
@@ -0,0 +1,518 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+ EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+ EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+ inherit git-2
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+ SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+ kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.1-r1
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-init-scripts-17
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "0.12_pre1" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # RogentOS custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # Sabayon bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+ # Fix pam_systemd + logind support
+ epatch "${FILESDIR}/0001-Filter-the-systemd-cgroup-from-the-current-process.patch"
+}
+
+src_compile() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS}
+ LIBNAME=$(get_libdir)
+ LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="RogentOS ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+ use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+ use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${ED}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+ rm -rf "${ED}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # RogentOS customization, do not bug user with annoying updates (for now)
+ mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+ || return
+ [[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+ touch "${EROOT}"etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${EROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local conf_file
+ # RogentOS customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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.
+ # RogentOS, use cp -d as per Gentoo bug #462674
+ [[ -e "${EROOT}"etc/conf.d/net ]] && \
+ cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${EROOT}"etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${EROOT}"etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+ )
+ fi
+
+ # /etc/conf.d/clock moved to /etc/conf.d/hwclock
+ local clock
+ use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+ if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+ mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+ fi
+ if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+ rm -f "${EROOT}"etc/init.d/clock
+ fi
+ if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+ rm -f "${EROOT}"etc/runlevels/boot/clock
+ ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+ fi
+ if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+ rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+ ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+ fi
+
+ # /etc/conf.d/rc is no longer used for configuration
+ if [[ -e "${EROOT}"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
+
+ # force net init.d scripts into symlinks
+ for f in "${EROOT}"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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ if ! has_version ">=sys-apps/openrc-0.11"; then
+ add_boot_init sysfs sysinit
+ fi
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+ if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+ migrate_udev_mount_script
+ add_boot_init tmpfiles.setup boot
+ fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+ if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+ ! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+ add_boot_init udev-mount sysinit
+ fi
+ return 0
+}
+
+migrate_from_baselayout_1() {
+ # baselayout boot init scripts have been split out
+ for f in $(cd "${ED}"/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
+
+ # 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 "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+ [[ -e "${EROOT}"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 our state for baselayout-1 users
+ if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+ (
+ [[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+ svcdir=${svcdir:-/var/lib/init.d}
+ if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+ ewarn "No state found, and no state exists"
+ elog "You should reboot this host"
+ else
+ mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+ einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+ mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+ rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+ "${EROOT}${LIBDIR}"/rc/init.d/console
+ umount "${EROOT}${svcdir}" 2>/dev/null
+ rm -rf "${EROOT}${svcdir}"
+ fi
+ )
+ fi
+
+ # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+ rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ local f v
+ for f in "${EROOT}"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}" >> "${ED}"/etc/conf.d/modules
+ done
+ rm -f "${f}"
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ fi
+ fi
+}
+
+pkg_postinst() {
+ local conf_file
+ # RogentOS customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+ rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/sysinit
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+ "${EROOT}"etc/runlevels/sysinit
+ fi
+ if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/shutdown
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+ "${EROOT}"etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+ elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ if [[ -d "${EROOT}"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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${EROOT}etc/local.d"
+ mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+ mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${EROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+ /$(get_libdir)/rc/sh/migrate-to-run.sh
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ if use newnet; then
+ local netscript=network
+ else
+ local netscript=net.lo
+ fi
+
+ if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+ ewarn "Please add the $netscript script to your boot runlevel"
+ ewarn "as soon as possible. Not doing so could leave you with a system"
+ ewarn "without networking."
+ fi
+
+ ewarn "In this version of OpenRC, the loopback interface no longer"
+ ewarn "satisfies the net virtual."
+ ewarn "If you have services now which do not start because of this,"
+ ewarn "They can be fixed by adding rc_need=\"!net\""
+ ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+ ewarn "You should also file a bug against the service asking that"
+ ewarn "need net be dropped from the dependencies."
+ ewarn "The bug you file should block the following tracker:"
+ ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+ ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+ ewarn "longer. In order to mount nfs file systems, you must use the"
+ ewarn "nfsmount service from the nfs-utils package."
+ ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+ ewarn "more information on this."
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild b/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild
new file mode 100644
index 00000000..f8cd6271
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild
@@ -0,0 +1,520 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+ EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+ EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+ inherit git-2
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+ SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+ kernel_linux kernel_FreeBSD"
+
+RDEPEND="kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.1-r1
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-init-scripts-17
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "0.12_pre1" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # RogentOS/Argent custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # Sabayon bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+ # Fix pam_systemd + logind support
+ epatch "${FILESDIR}/0001-Filter-the-systemd-cgroup-from-the-current-process.patch"
+
+ # Linux 3.10 and EFI
+ epatch "${FILESDIR}/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch"
+}
+
+src_compile() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS}
+ LIBNAME=$(get_libdir)
+ LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="RogentOS ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+ use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+ use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${ED}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+ rm -rf "${ED}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # RogentOS/Argent customization, do not bug user with annoying updates (for now)
+ mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+ || return
+ [[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+ touch "${EROOT}"etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${EROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local conf_file
+ # RogentOS/Argent customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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.
+ # Sabayon, use cp -d as per Gentoo bug #462674
+ [[ -e "${EROOT}"etc/conf.d/net ]] && \
+ cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${EROOT}"etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${EROOT}"etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+ )
+ fi
+
+ # /etc/conf.d/clock moved to /etc/conf.d/hwclock
+ local clock
+ use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+ if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+ mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+ fi
+ if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+ rm -f "${EROOT}"etc/init.d/clock
+ fi
+ if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+ rm -f "${EROOT}"etc/runlevels/boot/clock
+ ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+ fi
+ if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+ rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+ ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+ fi
+
+ # /etc/conf.d/rc is no longer used for configuration
+ if [[ -e "${EROOT}"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
+
+ # force net init.d scripts into symlinks
+ for f in "${EROOT}"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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ if ! has_version ">=sys-apps/openrc-0.11"; then
+ add_boot_init sysfs sysinit
+ fi
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+ if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+ migrate_udev_mount_script
+ add_boot_init tmpfiles.setup boot
+ fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+ if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+ ! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+ add_boot_init udev-mount sysinit
+ fi
+ return 0
+}
+
+migrate_from_baselayout_1() {
+ # baselayout boot init scripts have been split out
+ for f in $(cd "${ED}"/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
+
+ # 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 "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+ [[ -e "${EROOT}"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 our state for baselayout-1 users
+ if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+ (
+ [[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+ svcdir=${svcdir:-/var/lib/init.d}
+ if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+ ewarn "No state found, and no state exists"
+ elog "You should reboot this host"
+ else
+ mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+ einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+ mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+ rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+ "${EROOT}${LIBDIR}"/rc/init.d/console
+ umount "${EROOT}${svcdir}" 2>/dev/null
+ rm -rf "${EROOT}${svcdir}"
+ fi
+ )
+ fi
+
+ # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+ rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ local f v
+ for f in "${EROOT}"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}" >> "${ED}"/etc/conf.d/modules
+ done
+ rm -f "${f}"
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ fi
+ fi
+}
+
+pkg_postinst() {
+ local conf_file
+ # RogentOS/Argent customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+ rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/sysinit
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+ "${EROOT}"etc/runlevels/sysinit
+ fi
+ if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/shutdown
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+ "${EROOT}"etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+ elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ if [[ -d "${EROOT}"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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${EROOT}etc/local.d"
+ mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+ mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${EROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+ /$(get_libdir)/rc/sh/migrate-to-run.sh
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ if use newnet; then
+ local netscript=network
+ else
+ local netscript=net.lo
+ fi
+
+ if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+ ewarn "Please add the $netscript script to your boot runlevel"
+ ewarn "as soon as possible. Not doing so could leave you with a system"
+ ewarn "without networking."
+ fi
+
+ ewarn "In this version of OpenRC, the loopback interface no longer"
+ ewarn "satisfies the net virtual."
+ ewarn "If you have services now which do not start because of this,"
+ ewarn "They can be fixed by adding rc_need=\"!net\""
+ ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+ ewarn "You should also file a bug against the service asking that"
+ ewarn "need net be dropped from the dependencies."
+ ewarn "The bug you file should block the following tracker:"
+ ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+ ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+ ewarn "longer. In order to mount nfs file systems, you must use the"
+ ewarn "nfsmount service from the nfs-utils package."
+ ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+ ewarn "more information on this."
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1.ebuild b/sys-apps/openrc/openrc-0.12_pre1.ebuild
new file mode 100644
index 00000000..731eb5a2
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1.ebuild
@@ -0,0 +1,515 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+ EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+ EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+ inherit git-2
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+ SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+ kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.1-r1
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-init-scripts-17
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "0.12_pre1" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # RogentOS custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # RogentOS bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS}
+ LIBNAME=$(get_libdir)
+ LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="RogentOS ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+ use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+ use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${ED}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ if ! use kernel_linux; then
+ keepdir /$(get_libdir)/rc/init.d
+ fi
+ keepdir /$(get_libdir)/rc/tmp
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+ rm -rf "${ED}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # RogentOS customization, do not bug user with annoying updates (for now)
+ mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # if the initscript is not going to be installed and is not
+ # currently installed, return
+ [[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+ || return
+ [[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+ touch "${EROOT}"etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+ local config=$1 initd=$2
+ if [[ -e ${EROOT}${config} ]] ; then
+ if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+ add_boot_init ${initd}
+ fi
+ fi
+}
+
+pkg_preinst() {
+ local conf_file
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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.
+ # RogentOS, use cp -d as per Gentoo bug #462674
+ [[ -e "${EROOT}"etc/conf.d/net ]] && \
+ cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${EROOT}"etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${EROOT}"etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+ )
+ fi
+
+ # /etc/conf.d/clock moved to /etc/conf.d/hwclock
+ local clock
+ use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+ if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+ mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+ fi
+ if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+ rm -f "${EROOT}"etc/init.d/clock
+ fi
+ if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+ rm -f "${EROOT}"etc/runlevels/boot/clock
+ ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+ fi
+ if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+ rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+ ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+ fi
+
+ # /etc/conf.d/rc is no longer used for configuration
+ if [[ -e "${EROOT}"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
+
+ # force net init.d scripts into symlinks
+ for f in "${EROOT}"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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ if ! has_version ">=sys-apps/openrc-0.11"; then
+ add_boot_init sysfs sysinit
+ fi
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+ if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+ migrate_udev_mount_script
+ add_boot_init tmpfiles.setup boot
+ fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+ if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+ ! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+ add_boot_init udev-mount sysinit
+ fi
+ return 0
+}
+
+migrate_from_baselayout_1() {
+ # baselayout boot init scripts have been split out
+ for f in $(cd "${ED}"/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
+
+ # 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 "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+ [[ -e "${EROOT}"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 our state for baselayout-1 users
+ if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+ (
+ [[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+ svcdir=${svcdir:-/var/lib/init.d}
+ if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+ ewarn "No state found, and no state exists"
+ elog "You should reboot this host"
+ else
+ mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+ einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+ mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+ rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+ "${EROOT}${LIBDIR}"/rc/init.d/console
+ umount "${EROOT}${svcdir}" 2>/dev/null
+ rm -rf "${EROOT}${svcdir}"
+ fi
+ )
+ fi
+
+ # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+ rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+ local f v
+ for f in "${EROOT}"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}" >> "${ED}"/etc/conf.d/modules
+ done
+ rm -f "${f}"
+ rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+ fi
+ fi
+}
+
+pkg_postinst() {
+ local conf_file
+ # RogentOS customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+ # Make our runlevels if they don't exist
+ if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+ einfo "Copying across default runlevels"
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+ rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/sysinit
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+ "${EROOT}"etc/runlevels/sysinit
+ fi
+ if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${EROOT}"etc/runlevels/shutdown
+ cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+ "${EROOT}"etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+ elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+ fi
+
+ if [[ -d "${EROOT}"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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${EROOT}etc/local.d"
+ mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+ mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${EROOT}"etc/local.d/*{start,stop}
+ fi
+
+ if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+ /$(get_libdir)/rc/sh/migrate-to-run.sh
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ if use newnet; then
+ local netscript=network
+ else
+ local netscript=net.lo
+ fi
+
+ if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+ ewarn "Please add the $netscript script to your boot runlevel"
+ ewarn "as soon as possible. Not doing so could leave you with a system"
+ ewarn "without networking."
+ fi
+
+ ewarn "In this version of OpenRC, the loopback interface no longer"
+ ewarn "satisfies the net virtual."
+ ewarn "If you have services now which do not start because of this,"
+ ewarn "They can be fixed by adding rc_need=\"!net\""
+ ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+ ewarn "You should also file a bug against the service asking that"
+ ewarn "need net be dropped from the dependencies."
+ ewarn "The bug you file should block the following tracker:"
+ ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+ ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+ ewarn "longer. In order to mount nfs file systems, you must use the"
+ ewarn "nfsmount service from the nfs-utils package."
+ ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+ ewarn "more information on this."
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.8.2-r1.ebuild b/sys-apps/openrc/openrc-0.8.2-r1.ebuild
new file mode 100644
index 00000000..8e23d158
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.8.2-r1.ebuild
@@ -0,0 +1,458 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild,v 1.6 2011/05/13 19:06:47 armin76 Exp $
+
+EAPI="1"
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/openrc.git"
+ inherit git
+ KEYWORDS=""
+else
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( sys-process/fuser-bsd )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( virtual/pam )
+ >=sys-apps/baselayout-2.0.0
+ kernel_linux? ( !<sys-apps/module-init-tools-3.2.2-r2 )
+ !<sys-fs/udev-133
+ !<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+make_args() {
+ 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
+ MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+ brand="Linux"
+ elif use kernel_FreeBSD ; then
+ MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+ brand="FreeBSD"
+ fi
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogentos ${brand}"
+}
+
+pkg_setup() {
+ 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}"
+ sed -i 's:0444:0644:' mk/sys.mk
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile #241342
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+ epatch "${FILESDIR}/${PN}-enable-interactive.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+ make_args
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-$(echo ${EGIT_VERSION} | cut -c1-8)"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk
+ fi
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS} || die "emake ${MAKE_ARGS} failed"
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${D}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ make_args
+ emake ${MAKE_ARGS} DESTDIR="${D}" install || die
+
+ # install the readme for the new network scripts
+ dodoc README.newnet
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+ rm -rf "${D}"/etc/runlevels
+
+ # Stick with "old" net as the default for now
+ doconfd conf.d/net || die
+ pushd "${D}"/usr/share/${PN}/runlevels/boot > /dev/null
+ rm -f network staticroute
+ ln -s /etc/init.d/net.lo net.lo
+ popd > /dev/null
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Move /etc/conf.d/keymaps to .example
+ mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # 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/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+ touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${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
+}
+
+CONFD_KEYMAPS="${ROOT}/etc/conf.d/keymaps"
+pkg_preinst() {
+ # backup user /etc/conf.d/keymaps
+ if [ -f "${CONFD_KEYMAPS}" ]; then
+ cp -p "${CONFD_KEYMAPS}" "${CONFD_KEYMAPS}.portage_openrc_bck"
+ fi
+ local f LIBDIR=$(get_libdir)
+
+ # 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/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${ROOT}"/etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # /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 [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+ rm -f "${ROOT}"/etc/init.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
+
+ # 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
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+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
+
+ # 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() {
+ # Copy config file over
+ if [ -f "${CONFD_KEYMAPS}.portage_openrc_bck" ]; then
+ cp ${CONFD_KEYMAPS}.portage_openrc_bck ${CONFD_KEYMAPS} -p
+ else
+ if [ -f "${CONFD_KEYMAPS}.example" ] && [ ! -f "${CONFD_KEYMAPS}" ]; then
+ cp ${CONFD_KEYMAPS}.example ${CONFD_KEYMAPS} -p
+ fi
+ fi
+
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+ # 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"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/sysinit
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+ "${ROOT}"/etc/runlevels/sysinit
+ fi
+ if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/shutdown
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+ "${ROOT}"/etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+ elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+ 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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${ROOT}etc/local.d"
+ mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+ mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${ROOT}"etc/local.d/*{start,stop}
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.8.3-r1.ebuild b/sys-apps/openrc/openrc-0.8.3-r1.ebuild
new file mode 100644
index 00000000..8d06e9bb
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.8.3-r1.ebuild
@@ -0,0 +1,459 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.3-r1.ebuild,v 1.5 2011/07/02 17:53:31 armin76 Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="alpha amd64 arm ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( sys-process/fuser-bsd )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( virtual/pam )
+ >=sys-apps/baselayout-2.0.0
+ kernel_linux? ( !<sys-apps/module-init-tools-3.2.2-r2 )
+ !<sys-fs/udev-133
+ !<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+make_args() {
+ 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
+ MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+ brand="Linux"
+ elif use kernel_FreeBSD ; then
+ MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+ brand="FreeBSD"
+ fi
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogentos ${brand}"
+}
+
+pkg_setup() {
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ epatch "${FILESDIR}"/${P}-deprecation_warning.patch
+ epatch "${FILESDIR}"/${P}-ccwgroup.patch #367467
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+ epatch "${FILESDIR}/${PN}-enable-interactive.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+ make_args
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${D}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ make_args
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # install the readme for the new network scripts
+ dodoc README.newnet
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+ rm -rf "${D}"/etc/runlevels
+
+ # Stick with "old" net as the default for now
+ doconfd conf.d/net || die
+ pushd "${D}"/usr/share/${PN}/runlevels/boot > /dev/null
+ rm -f network staticroute
+ ln -s /etc/init.d/net.lo net.lo
+ popd > /dev/null
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Rogentos customization, do not bug user with annoying updates (for now)
+ mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # 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/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+ touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${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() {
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${ROOT}"/etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # /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 [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+ rm -f "${ROOT}"/etc/init.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
+
+ # 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
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+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
+
+ # 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 our 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() {
+ # Rogentos customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+ # 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"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/sysinit
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+ "${ROOT}"/etc/runlevels/sysinit
+ fi
+ if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/shutdown
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+ "${ROOT}"/etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+ elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+ 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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${ROOT}etc/local.d"
+ mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+ mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${ROOT}"etc/local.d/*{start,stop}
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.9.8.1.ebuild b/sys-apps/openrc/openrc-0.9.8.1.ebuild
new file mode 100644
index 00000000..713e29a1
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.9.8.1.ebuild
@@ -0,0 +1,457 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.9.8.1.ebuild,v 1.1 2012/01/14 20:27:59 williamh Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.0.0
+ kernel_linux? (
+ !<sys-apps/module-init-tools-3.2.2-r2
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-133
+ !<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+make_args() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogentos ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+}
+
+pkg_setup() {
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+ epatch "${FILESDIR}/${PN}-enable-interactive-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ # epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+ make_args
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${D}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ make_args
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+ rm -rf "${D}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Rogentos customization, do not bug user with annoying updates (for now)
+ mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # 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/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+ touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${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() {
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${ROOT}"/etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # /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 [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+ rm -f "${ROOT}"/etc/init.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
+
+ # 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
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+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
+
+ # 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 our 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() {
+ local LIBDIR=$(get_libdir)
+
+ # Rogentos customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+ # 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"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/sysinit
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+ "${ROOT}"/etc/runlevels/sysinit
+ fi
+ if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/shutdown
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+ "${ROOT}"/etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+ elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+ 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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${ROOT}etc/local.d"
+ mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+ mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${ROOT}"etc/local.d/*{start,stop}
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ 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"
+}
diff --git a/sys-apps/openrc/openrc-0.9.9.3.ebuild b/sys-apps/openrc/openrc-0.9.9.3.ebuild
new file mode 100644
index 00000000..c439dd12
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.9.9.3.ebuild
@@ -0,0 +1,461 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.9.9.3.ebuild,v 1.1 2012/03/11 20:14:37 robbat2 Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+ kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+ elibc_glibc? ( >=sys-libs/glibc-2.5 )
+ ncurses? ( sys-libs/ncurses )
+ pam? ( sys-auth/pambase )
+ >=sys-apps/baselayout-2.0.0
+ kernel_linux? (
+ sys-process/psmisc
+ )
+ !<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+ virtual/os-headers"
+
+make_args() {
+ unset LIBDIR #266688
+
+ MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+ 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
+ if use selinux; then
+ MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+ fi
+ export BRANDING="Rogentos ${brand}"
+ if ! use static-libs; then
+ MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+ fi
+}
+
+pkg_setup() {
+ export DEBUG=$(usev debug)
+ export MKPAM=$(usev pam)
+ export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+ sed -i 's:0444:0644:' mk/sys.mk || die
+ sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+ if [[ ${PV} == "9999" ]] ; then
+ local ver="git-${EGIT_VERSION:0:6}"
+ sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+ fi
+
+ # Allow user patches to be applied without modifying the ebuild
+ epatch_user
+
+ # Rogentos custom config
+ epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+ epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+ epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+ epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+ # Rogentos bug fixes
+ epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+ make_args
+
+ tc-export CC AR RANLIB
+ emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+ local file="${D}/$1" var=$2 val com
+ eval "${@:5}" && val=$3 || val=$4
+ [[ ${val} == "#" ]] && com="#" && val='\2'
+ sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+ set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+ make_args
+ emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+ # move the shared libs back to /usr so ldscript can install
+ # more of a minimal set of files
+ # disabled for now due to #270646
+ #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+ #gen_usr_ldscript -a einfo rc
+ gen_usr_ldscript libeinfo.so
+ gen_usr_ldscript librc.so
+
+ keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+ # Backup our default runlevels
+ dodir /usr/share/"${PN}"
+ cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+ rm -rf "${D}"/etc/runlevels
+
+ # Install the default net configuration
+ doconfd conf.d/net
+
+ # Setup unicode defaults for silly unicode users
+ set_config_yes_no /etc/rc.conf unicode use unicode
+
+ # Cater to the norm
+ set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+ # On HPPA, do not run consolefont by default (bug #222889)
+ if use hppa; then
+ rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+ fi
+
+ # Support for logfile rotation
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/openrc.logrotate openrc
+
+ # Rogentos customization, do not bug user with annoying updates (for now)
+ mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+ die "cannot move keymaps"
+ mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+ die "cannot move hwclock"
+
+ # install the gentoo pam.d file
+ newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+ local initd=$1
+ local runlevel=${2:-boot}
+ # 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/${runlevel}/${initd} ]] && return
+
+ # if runlevels dont exist just yet, then create it but still flag
+ # to pkg_postinst that it needs real setup #277323
+ if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+ touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+ fi
+
+ elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${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 conf_file
+ # Rogentos customization, still protect conf files from being removed
+ # as no longer owned by package
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}" ]; then
+ cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+ fi
+ done
+
+ local f LIBDIR=$(get_libdir)
+
+ # 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/
+
+ # avoid default thrashing in conf.d files when possible #295406
+ if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+ (
+ unset hostname HOSTNAME
+ source "${ROOT}"/etc/conf.d/hostname
+ : ${hostname:=${HOSTNAME}}
+ [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+ )
+ fi
+
+ # upgrade timezone file ... do it before moving clock
+ if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+ (
+ unset TIMEZONE
+ source "${ROOT}"/etc/conf.d/clock
+ [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+ )
+ fi
+
+ # /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 [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+ rm -f "${ROOT}"/etc/init.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
+
+ # 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
+
+ # swapfiles was added in 0.9.9 and needed in boot (february 2012)
+ has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+ # set default interactive shell to sulogin if it exists
+ set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+ has_version sys-apps/openrc || migrate_from_baselayout_1
+ has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+ # make sure udev is in sysinit if it was enabled before
+ local enable_udev=false
+ local rc_devices=$(
+ [[ -f /etc/rc.conf ]] && source /etc/rc.conf
+ [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+ echo "${rc_devices:-${RC_DEVICES:-auto}}"
+ )
+ case ${rc_devices} in
+ udev|auto)
+ enable_udev=true
+ ;;
+ esac
+
+ if $enable_udev; then
+ add_boot_init udev sysinit
+ add_boot_init udev-postmount default
+ fi
+}
+
+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
+
+ # 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 our 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() {
+ local conf_file
+ # Rogentos customization, do not bug user with tedious, useless config file updates
+ for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+ if [ -e "${conf_file}.ebuild_preserved" ]; then
+ cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+ elif [ ! -e "${conf_file}" ]; then
+ cp -p "${conf_file}.example" "${conf_file}" # don't die
+ fi
+ chown root:root "${conf_file}" # don't die
+ done
+
+ local LIBDIR=$(get_libdir)
+
+ # Remove old baselayout links
+ rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+ rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+ # 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"
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+ rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+ else
+ if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/sysinit
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+ "${ROOT}"/etc/runlevels/sysinit
+ fi
+ if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+ mkdir -p "${ROOT}"/etc/runlevels/shutdown
+ cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+ "${ROOT}"/etc/runlevels/shutdown
+ fi
+ fi
+
+ # /etc/conf.d/net.example is no longer valid
+ local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+ local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+ if [[ -e "${NET_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+ rm -f "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+ elog "${NET_EXAMPLE} should be removed."
+ fi
+ elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+ fi
+
+ # /etc/conf.d/wireless.example is no longer valid
+ local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+ local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+ if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+ if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+ rm -f "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+ else
+ sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+ elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+ fi
+ elog "If you are using the old style network scripts,"
+ elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+ elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+ 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
+
+ if use hppa; then
+ elog "Setting the console font does not work on all HPPA consoles."
+ elog "You can still enable it by running:"
+ elog "# rc-update add consolefont boot"
+ fi
+
+ # Handle the conf.d/local.{start,stop} -> local.d transition
+ if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+ elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+ elog "files to ${ROOT}etc/local.d"
+ mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+ mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+ chmod +x "${ROOT}"etc/local.d/*{start,stop}
+ fi
+
+ # update the dependency tree after touching all files #224171
+ [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+ 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"
+}