1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs flag-o-matic
8 DESCRIPTION="A UNIX init scheme with service supervision"
9 HOMEPAGE="http://smarden.org/runit/"
10 SRC_URI="http://smarden.org/runit/${P}.tar.gz"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
17 RDEPEND="sys-apps/openrc"
19 S=${WORKDIR}/admin/${P}/src
24 # we either build everything or nothing static
25 sed -i -e 's:-static: :' Makefile
27 # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726008
28 [[ ${COMPILER} == "diet" ]] &&
30 filter-flags "-mpowerpc-gpopt"
34 use static && append-ldflags -static
36 echo "$(tc-getCC) ${CFLAGS}" > conf-cc
37 echo "$(tc-getCC) ${LDFLAGS}" > conf-ld
42 dobin $(<../package/commands)
44 mv "${ED}"/bin/{runit-init,runit,utmpset} "${ED}"/sbin/ || die "dosbin"
45 dosym ../etc/runit/2 /sbin/runsvdir-start
47 DOCS=( ../package/{CHANGES,README,THANKS,TODO} )
48 HTML_DOCS=( ../doc/*.html )
54 doexe "${FILESDIR}"/ctrlaltdel
55 newexe "${FILESDIR}"/1-${PV} 1
56 newexe "${FILESDIR}"/2-${PV} 2
57 newexe "${FILESDIR}"/3-${PV} 3
60 for tty in tty1 tty2 tty3 tty4 tty5 tty6; do
61 exeinto /etc/sv/getty-$tty/
62 newexe "${FILESDIR}"/finish.getty finish
63 newexe "${FILESDIR}"/run.getty-${PV} run
64 for script in finish run; do
65 sed -i -e "s:TTY:${tty}:g" "${ED}"/etc/sv/getty-$tty/$script
69 # make sv command work
70 cat <<-EOF > "${T}"/env.d
75 newins "${T}"/env.d 20runit
79 if has_version 'sys-process/runit' &&
80 has_version '<sys-process/runit-2.1.2' &&
81 [ -d "${EROOT}"etc/runit/runsvdir/all ]; then
82 if [ -e "${EROOT}"etc/sv ]; then
83 mv -f "${EROOT}"etc/sv "${EROOT}"etc/sv.bak || die
84 ewarn "${EROOT}etc/sv was moved to ${EROOT}etc/sv.bak"
86 mv "${EROOT}"etc/runit/runsvdir/all "${EROOT}"etc/sv|| die
87 ln -sf "${EROOT}"etc/sv "${EROOT}"etc/runit/runsvdir/all || die
88 cp -a "${EROOT}"etc/runit/runsvdir "${T}" || die
89 touch "${T}"/make_var_service || die
94 local sv="${EROOT}"etc/sv
95 local service="${EROOT}"etc/service
96 mkdir -p "${service}" || die
97 for x in tty1 tty2 tty3 tty4 tty5 tty6; do
98 ln -sf "${sv}"/getty-$x "${service}"/getty-$x || die
100 einfo "The links to services runit will supervise are installed"
102 einfo "If you need multiple runlevels, please see the documentation"
103 einfo "for how to set them up."
108 # Create /etc/service and /var/service if requested
109 if [ -e "${T}"/make_var_service ]; then
110 ln -sf "${EROOT}"etc/runit/runsvdir/current "${EROOT}"etc/service || die
111 ln -sf "${EROOT}"etc/runit/runsvdir/current "${EROOT}"var/service || die
113 if [ -d "${T}"/runsvdir ]; then
114 cp -a "${T}"/runsvdir "${EROOT}"etc/runit || die
120 if has_version '<sys-process/runit-2.1.2'; then
126 if [[ -z $REPLACING_VERSIONS ]]; then
128 elif [[ -n $pre_212 ]]; then
132 ewarn "To make sure sv works correctly in your currently open"
133 ewarn "shells, please run the following command:"
135 ewarn "source /etc/profile"
138 if [ -L "${EROOT}"var/service ]; then
139 ewarn "Once this version of runit is active, please remove the"
140 ewarn "compatibility symbolic link at ${EROOT}var/service"
141 ewarn "The correct path now is ${EROOT}etc/service"
145 if [ -L "${EROOT}"etc/runit/runsvdir/all ]; then
146 ewarn "${EROOT}etc/runit/runsvdir/all has moved to"
147 iewarn "${EROOT}etc/sv."
148 ewarn "Any symbolic links under ${EROOT}etc/runit/runsvdir"
149 ewarn "which point to services through ../all should be updated to"
150 ewarn "point to them through ${EROOT}etc/sv."
151 ewarn "Once that is done, ${EROOT}etc/runit/runsvdir/all should be"