Skip to content

Commit

Permalink
FL-786: openrc-0.12, masked for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Vinichenko committed Sep 26, 2013
1 parent 09ad5e7 commit 33da0a2
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 0 deletions.
6 changes: 6 additions & 0 deletions profiles/package.mask/funtoo-staging
@@ -1,5 +1,11 @@
# Keep the most recent masks in a reverse chrono order
# newest on top
# Oleg Vinichenko (26 Sep 2012)
# update to openrc. upstream 0.12 version+Funtoo tweaks on top
# masked for testing. Additional work required to investigate tmpfiles support, update to kmod and static nodes. Ebuild added as WIP,
# use at own risk. buge reports: http://bugs.funtoo.org/browse/FL-786
=sys-apps/openrc-0.12

# Oleg Vinichenko (24 Sep 2013)
# FL-759 new debian kernel to test. 3.10.11 added
=sys-kernel/debian-sources-3.2.51
Expand Down
1 change: 1 addition & 0 deletions sys-apps/openrc/Manifest
Expand Up @@ -5,3 +5,4 @@ DIST corenetwork-1.3.5.tar.gz 13717 SHA256 3fb2722c3125f830062964cf02a16a884868b
DIST openrc-funtoo-openrc-0.10.2-r4.tar.gz 214794 SHA256 f134da20ea689b4fff938a47177528ee40bb56c96d40deeffd5c6fdf86da898d
DIST openrc-funtoo-openrc-0.10.2-r7.tar.gz 214846 SHA256 71c1663eb0f2cd0593d634123ee47f2bc1fcfeca2bfbbd694ed2a5f2e4fc2970 SHA512 2992108fde145e5221a435456bc1e4f7357d04a8c97e40ad7d10ae51ed7457a58eff8f16ebf14dc3a04e880778e9ce27a8e19b53d87b4de4b2db37311d9f86ef WHIRLPOOL 21679d721f7c9690e245b076d531c6bbad558195fb274dac96e0512642d37a75c3f622ccfdc3b06179ff50fa72566d7a6f48a4ba669eb349afc6c8f8b13c4415
DIST openrc-funtoo-openrc-0.10.3.tar.gz 215104 SHA256 4dbcdf207b23ec54bb97c83890c0926d75b512a64559946bc40765fc1dd79a8b SHA512 ea11dfc24ae7cb0c3b4bab775f5d95bae59ac67f9fe5f1ce312410032a9f6554a944ede9f886bad48986edff4405ebd5234e87e624e06aec137aaad460fec6e3 WHIRLPOOL 010722504d91ed05e3d6d20235386b3d0be085157e5e3742c4ee5c1c346dba3a4d7c2e6749f62008918202bb0ec05b533088e448964f6e5226c44f1c12db65c8
DIST openrc-funtoo-openrc-0.12-r0.tar.gz 167278 SHA256 811b013ab7f3a7b94b066e752ef5ca22cfbbaecf8b27bde01f410b777822131e SHA512 0b0a90158902363f3b2b5d3b61b6fc40118c5c94ab381e12895e16a76d60f21b0d56ae25e43a5a4a6a173e39ff8b9f8a04bd34caa300c3c32a44a3555ebee73e WHIRLPOOL 4e8bb5e629c687b8e8392b73e1c1ff7741b0a3a4b6f6bc9cad86e074d4198ad05eee7d7310709cf046d24492a1f10322853f007eb1e61cbc2205d938b585a929
231 changes: 231 additions & 0 deletions sys-apps/openrc/openrc-0.12.ebuild
@@ -0,0 +1,231 @@
# Distributed under the terms of the GNU General Public License v2

EAPI="5"

inherit eutils flag-o-matic multilib pam toolchain-funcs

DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
HOMEPAGE="http://roy.marples.name/openrc"
PROVIDE="virtual/baselayout"
RESTRICT="mirror"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="*"
IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"

RDEPEND="kernel_linux? ( >=sys-apps/sysvinit-2.86-r11 )
kernel_FreeBSD? ( sys-process/fuser-bsd )
pam? ( virtual/pam )
>=sys-apps/baselayout-2.2
sys-apps/iproute2"

DEPEND="ncurses? ( sys-libs/ncurses ) pam? ( virtual/pam ) virtual/os-headers virtual/pkgconfig"

GITHUB_REPO="${PN}"
GITHUB_USER="funtoo"
GITHUB_TAG="funtoo-openrc-0.12-r0"
NETV="1.3.5"
GITHUB_REPO_CN="corenetwork"
GITHUB_TAG_CN="$NETV"

SRC_URI="
https://www.github.com/${GITHUB_USER}/${GITHUB_REPO}/tarball/${GITHUB_TAG} -> ${PN}-${GITHUB_TAG}.tar.gz
https://www.github.com/${GITHUB_USER}/${GITHUB_REPO_CN}/tarball/${GITHUB_TAG_CN} -> corenetwork-${NETV}.tar.gz
"

make_args() {
unset LIBDIR #266688

MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc MKNET=no"

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="Funtoo ${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_unpack() {
unpack $A
# rename github directories to the names we're expecting:
local old=${WORKDIR}/${GITHUB_USER}-${PN}-*
mv $old "${WORKDIR}/${P}" || die "move fail 1"
old="${WORKDIR}/${GITHUB_USER}-corenetwork-*"
mv $old "${WORKDIR}/corenetwork-${NETV}" || die "move fail 2"
}

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
##epatch "${FILESDIR}/openrc-nodevfs.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

# 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

# install the gentoo pam.d file
newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon

# Install funtoo networking parts:

cd ${WORKDIR}/corenetwork-${NETV} || die
dodoc docs/index.rst || die
exeinto /etc/init.d || die
doexe init.d/{netif.tmpl,netif.lo} || die
cp -a netif.d ${D}/etc || die
chown -R root:root ${D}/etc/netif.d || die
chmod 0755 ${D}/etc/netif.d || die
chmod -R 0644 ${D}/etc/netif.d/* || die
ln -s /etc/init.d/netif.lo ${D}/usr/share/openrc/runlevels/sysinit/netif.lo || die
}

add_init() {
local runl=$1
shift
if [ ! -e ${ROOT}/etc/runlevels/${runl} ]
then
install -d -m0755 ${ROOT}/etc/runlevels/${runl}
fi
for initd in $*
do
[[ -e ${ROOT}/etc/runlevels/${runl}/${initd} ]] && continue
elog "Auto-adding '${initd}' service to your ${runl} runlevel"
ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runl}/${initd}
done
}

pkg_postinst() {
local runl
install -d -m0755 ${ROOT}/etc/runlevels
local runldir="${ROOT}usr/share/openrc/runlevels"

# Remove old baselayout links
rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
rm -f "${ROOT}"/etc/runlevels/boot/netif.lo

# CREATE RUNLEVEL DIRECTORIES
# ===========================

# To ensure proper system operation, this portion of the script ensures that
# all of OpenRC's default initscripts in all runlevels are properly
# installed.

for runl in $( cd "$runldir"; echo * )
do
einfo "Processing $runl..."
einfo "Ensuring runlevel $runl has all required scripts..."
add_init $runl $( cd "$runldir/$runl"; echo * )
done

# Rather than try to migrate everyone using complex scripts, simply print
# names of initscripts that are in the user's runlevels but not provided by
# OpenRC. This loop can be upgraded to look for particular scripts that
# might have come from baselayout.

for runl in $( cd ${ROOT}/etc/runlevels; echo * )
do
[ ! -d ${runldir}/${runl} ] && continue
for init in $( cd "$runldir/$runl"; echo * )
do
if [ -e ${ROOT}/etc/runlevels/${runl}/${init} ] && [ ! -e ${runldir}/${runl}/${init} ]
then
echo "Initscript ${init} exists in runlevel ${runl} but not in OpenRC."
fi
done
done

chmod +x ${ROOT}/etc/netif.d

# OTHER STUFF
# ===========

# update the dependency tree bug #224171
[[ "${ROOT}" = "/" ]] && "${ROOT}/$(get_libdir)"/rc/bin/rc-depend -u

elog "You should now update all files in /etc, using etc-update"
elog "or equivalent before rebooting."
elog

if path_exists -o "${ROOT}"/etc/conf.d/local.{start,stop} ; then
ewarn "/etc/conf.d/local.{start,stop} are deprecated. Please convert"
ewarn "your files to /etc/conf.d/local and delete the files."
fi

ewarn "Make sure that correct symlink exist"
ewarn "Re-establish it by ln -s /etc/init.d/netif.tmpl /etc/init.d/netif.ethX"
}

0 comments on commit 33da0a2

Please sign in to comment.