1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit toolchain-funcs flag-o-matic versionator
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 S=${WORKDIR}/admin/${P}/src
20 # we either build everything or nothing static
21 sed -i -e 's:-static: :' Makefile
23 # see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=726008
24 [[ ${COMPILER} == "diet" ]] &&
26 filter-flags "-mpowerpc-gpopt"
30 use static && append-ldflags -static
32 echo "$(tc-getCC) ${CFLAGS}" > conf-cc
33 echo "$(tc-getCC) ${LDFLAGS}" > conf-ld
38 dobin $(<../package/commands)
40 mv "${ED}"/bin/{runit-init,runit,utmpset} "${ED}"/sbin/ || die "dosbin"
41 dosym ../etc/runit/2 /sbin/runsvdir-start
45 dodoc package/{CHANGES,README,THANKS,TODO}
51 doexe "${FILESDIR}"/{1,ctrlaltdel}
52 newexe "${FILESDIR}"/2-${PV} 2
53 newexe "${FILESDIR}"/3-${PV} 3
56 for tty in tty1 tty2 tty3 tty4 tty5 tty6; do
57 exeinto /etc/sv/getty-$tty/
58 newexe "${FILESDIR}"/finish.getty finish
59 newexe "${FILESDIR}"/run.getty-${PV} run
60 for script in finish run; do
61 sed -i -e "s:TTY:${tty}:g" "${ED}"/etc/sv/getty-$tty/$script
65 # make sv command work
66 cat <<-EOF > "${T}"/env.d
71 newins "${T}"/env.d 20runit
75 if has_version 'sys-process/runit' &&
76 has_version '<sys-process/runit-2.1.2' &&
77 [ -d "${EROOT}"etc/runit/runsvdir/all ]; then
78 if [ -e "${EROOT}"etc/sv ]; then
79 mv -f "${EROOT}"etc/sv "${EROOT}"etc/sv.bak || die
80 ewarn "${EROOT}etc/sv was moved to ${EROOT}etc/sv.bak"
82 mv "${EROOT}"etc/runit/runsvdir/all "${EROOT}"etc/sv|| die
83 ln -sf "${EROOT}"etc/sv "${EROOT}"etc/runit/runsvdir/all || die
84 cp -a "${EROOT}"etc/runit/runsvdir "${T}" || die
85 touch "${T}"/make_var_service || die
90 local sv="${EROOT}"etc/sv
91 local service="${EROOT}"etc/service
92 mkdir -p "${service}" || die
93 for x in tty1 tty2 tty3 tty4 tty5 tty6; do
94 ln -sf "${sv}"/getty-$x "${service}"/getty-$x || die
96 einfo "The links to services runit will supervise are installed"
98 einfo "If you need multiple runlevels, please see the documentation"
99 einfo "for how to set them up."
104 # Create /etc/service and /var/service if requested
105 if [ -e "${T}"/make_var_service ]; then
106 ln -sf "${EROOT}"etc/runit/runsvdir/current "${EROOT}"etc/service || die
107 ln -sf "${EROOT}"etc/runit/runsvdir/current "${EROOT}"var/service || die
109 if [ -d "${T}"/runsvdir ]; then
110 cp -a "${T}"/runsvdir "${EROOT}"etc/runit || die
116 if [ -z "$REPLACING_VERSIONS" ]; then
118 elif [ ! version_is_at_least 2.1.2 $REPLACING_VERSIONS ]; then
122 ewarn "To make sure sv works correctly in your currently open"
123 ewarn "shells, please run the following command:"
125 ewarn "source /etc/profile"
128 if [ -L "${EROOT}"var/service ]; then
129 ewarn "Once this version of runit is active, please remove the"
130 ewarn "compatibility symbolic link at ${EROOT}var/service"
131 ewarn "The correct path now is ${EROOT}etc/service"
135 if [ -L "${EROOT}"etc/runit/runsvdir/all ]; then
136 ewarn "${EROOT}etc/runit/runsvdir/all has moved to"
137 iewarn "${EROOT}etc/sv."
138 ewarn "Any symbolic links under ${EROOT}etc/runit/runsvdir"
139 ewarn "which point to services through ../all should be updated to"
140 ewarn "point to them through ${EROOT}etc/sv."
141 ewarn "Once that is done, ${EROOT}etc/runit/runsvdir/all should be"