Ping. Discussion and diff below. j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:
> j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes: > >> Manolis Tzanidakis <mtzanida...@gmail.com> writes: >> >>> Hey there, >>> >>> On Thu (10/01/13), Jérémie Courrèges-Anglas wrote: >>>> >>>> If runit going back to /service is a problem, I can provide a diff for >>>> it to stay in /var/service. >>> >>> I think it's better to stick with upstream's choice (/service) and avoid >>> maintaining an extra patch in the future. >> >> IMHO what would be even better is a newer version of runit. >> >> If /service is a no-no, I can handle the source and documentation >> patches to make it stay in /var/service; I just need an answer. > > No answer, so here's a diff for this proposal. > > Building on Manolis Tzanidakis' work and changelog: >> Changelog for the diff: >> - Update to v2.1.1. >> - Upstream changed service directory to /service from /var/service. > > I made this configurable with SUBST_CMD, along with using full paths for > executables. I only patched the manpages, not the html documentation. > >> - Add rc.d(8) script. > > This one used to install -d /service. I removed that and did not provide > /service -> /var/service compat symlink. People may already have > a /service directory used by djbware. > >> - Remove files/rc.shutdown sample; functionality merged in rc.d script. >> - Document upstream and port changes in pkg/MESSAGE. > > The fact that the OpenBSD port will default to /var/service is > documented there. > >> - Remove USE_GROFF. >> - Add license as comment. > > I also added my patch to handle ctrl-alt-del, but it's a bit rough; I'm > not sure it's good enough for inclusion in the port. On the other hand, > I could add a *big* warning about replacing our /sbin/init not being > supported / handled by the port. :) > >> >> I'm also willing to take maintainership. > Done. > > Thoughts? Index: Makefile =================================================================== RCS file: /cvs/ports/sysutils/runit/Makefile,v retrieving revision 1.12 diff -u -p -r1.12 Makefile --- Makefile 11 Mar 2013 11:41:32 -0000 1.12 +++ Makefile 22 Oct 2013 20:18:26 -0000 @@ -1,15 +1,16 @@ -# $OpenBSD: Makefile,v 1.12 2013/03/11 11:41:32 espie Exp $ +$OpenBSD: Makefile,v 1.12 2013/03/11 11:41:32 espie Exp $ COMMENT= daemontools alike replacement for init -DISTNAME= runit-1.7.2 -REVISION= 0 +DISTNAME= runit-2.1.1 CATEGORIES= sysutils HOMEPAGE= http://www.smarden.org/runit/ +MAINTAINER= Jeremie Courreges-Anglas <j...@wxcvbn.org> +# BSD3 PERMIT_PACKAGE_CDROM= Yes -WANTLIB= c +WANTLIB= c MASTER_SITES= ${HOMEPAGE} WRKDIST= ${WRKDIR}/admin/${DISTNAME} @@ -25,23 +26,27 @@ DOCS1= benefits.html chpst.8.html depe upgrade.html useinit.html index.html utmpset.8.html DOCS2= CHANGES README COPYING THANKS EXAMPLES= etc/2 etc/openbsd/1 etc/openbsd/3 etc/openbsd/ctrlaltdel -USE_GROFF = Yes -pre-build: +RUNIT_SERVICE_DIR= ${LOCALSTATEDIR}/service +SUBST_FILES= etc/openbsd/3 man/runsv.8 man/runsvchdir.8 man/sv.8 \ + man/utmpset.8 src/sv.c +SUBST_VARS= RUNIT_SERVICE_DIR + +do-configure: + cd ${WRKDIST} && ${SUBST_CMD} ${SUBST_FILES} echo "${CC} ${CFLAGS} ${COPTS}" > ${WRKSRC}/conf-cc echo "${CC} ${LDFLAGS}" > ${WRKSRC}/conf-ld do-build: - cd ${WRKDIST} && package/compile + cd ${WRKDIST} && ${SETENV} ${MAKE_ENV} package/compile do-test: - cd ${WRKDIST}/compile && make check + cd ${WRKDIST}/compile && ${SETENV} ${MAKE_ENV} make check do-install: .for pgm in ${SBINPROGRAMS} ${INSTALL_PROGRAM} ${WRKDIST}/command/${pgm} ${PREFIX}/sbin/ .endfor - ${INSTALL_SCRIPT} ${WRKDIST}/etc/2 ${PREFIX}/sbin/runsvdir-start .for page in ${MANPAGES} ${INSTALL_MAN} ${WRKDIST}/man/${page} ${PREFIX}/man/man8 .endfor @@ -53,7 +58,6 @@ do-install: ${INSTALL_DATA} ${WRKDIST}/package/${doc} ${PREFIX}/share/doc/runit/ .endfor ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/runit - ${INSTALL_DATA} ${FILESDIR}/rc.shutdown ${PREFIX}/share/examples/runit/ ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/runit/init .for file in ${EXAMPLES} ${INSTALL_DATA} ${WRKDIST}/${file} ${PREFIX}/share/examples/runit/init/ Index: distinfo =================================================================== RCS file: /cvs/ports/sysutils/runit/distinfo,v retrieving revision 1.6 diff -u -p -r1.6 distinfo --- distinfo 5 Apr 2007 17:26:12 -0000 1.6 +++ distinfo 22 Oct 2013 20:18:26 -0000 @@ -1,5 +1,2 @@ -MD5 (runit-1.7.2.tar.gz) = NUSOlxiFRJFPKYyIhxq5hA== -RMD160 (runit-1.7.2.tar.gz) = szd8Nc3xrfUNMNxGo/Y8c9SDrkg= -SHA1 (runit-1.7.2.tar.gz) = W40TUf6C/1xUcXkjXt4f2xkL6MM= -SHA256 (runit-1.7.2.tar.gz) = zJEEH/jvsyN2Owc9VLpuvvZQKEu9GJPJrxmW/FaAnf4= -SIZE (runit-1.7.2.tar.gz) = 102942 +SHA256 (runit-2.1.1.tar.gz) = /88tJ7MvWawU8tSwdyo+uA2TQmhaIEK3+7xHLAfPKiw= +SIZE (runit-2.1.1.tar.gz) = 109661 Index: patches/patch-etc_openbsd_3 =================================================================== RCS file: patches/patch-etc_openbsd_3 diff -N patches/patch-etc_openbsd_3 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-etc_openbsd_3 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,16 @@ +$OpenBSD$ +- make runit service dir configurable at build time +- use full path to binaries +--- etc/openbsd/3.orig Sun Oct 4 22:44:02 2009 ++++ etc/openbsd/3 Wed Apr 17 00:19:32 2013 +@@ -4,8 +4,8 @@ exec 2>&1 + PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin + + echo 'Waiting for services to stop...' +-sv -w196 force-stop /service/* +-sv exit /service/* ++${TRUEPREFIX}/sbin/sv -w196 force-stop ${RUNIT_SERVICE_DIR}/* ++${TRUEPREFIX}/sbin/sv exit ${RUNIT_SERVICE_DIR}/* + + echo 'Shutdown...' + if test -x /etc/runit/reboot; then Index: patches/patch-man_runsv_8 =================================================================== RCS file: patches/patch-man_runsv_8 diff -N patches/patch-man_runsv_8 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-man_runsv_8 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ +- make runit service dir configurable at build time +- use full path to binaries +--- man/runsv.8.orig Sun Oct 4 22:44:02 2009 ++++ man/runsv.8 Wed Apr 17 00:16:03 2013 +@@ -157,9 +157,9 @@ This command is ignored if it is given to + .IR service /log/supervise/control. + .P + Example: to send a TERM signal to the socklog-unix service, either do +- # sv term /service/socklog-unix ++ # ${TRUEPREFIX}/sbin/sv term ${RUNIT_SERVICE_DIR}/socklog-unix + or +- # printf t >/service/socklog-unix/supervise/control ++ # printf t >${RUNIT_SERVICE_DIR}/socklog-unix/supervise/control + .P + .BR printf (1) + usually blocks if no Index: patches/patch-man_runsvchdir_8 =================================================================== RCS file: patches/patch-man_runsvchdir_8 diff -N patches/patch-man_runsvchdir_8 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-man_runsvchdir_8 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,20 @@ +$OpenBSD$ +- make runit service dir configurable at build time +--- man/runsvchdir.8.orig Sun Oct 4 22:44:02 2009 ++++ man/runsvchdir.8 Wed Apr 17 00:16:03 2013 +@@ -27,13 +27,13 @@ with a symlink pointing to + .IR dir . + .P + Normally +-.I /service ++.I ${RUNIT_SERVICE_DIR} + is a symlink to + .IR current , + and + .BR runsvdir (8) + is running +-.IR /service/ . ++.IR ${RUNIT_SERVICE_DIR} . + .SH EXIT CODES + .B runsvchdir + prints an error message and exits 111 on error. Index: patches/patch-man_sv_8 =================================================================== RCS file: patches/patch-man_sv_8 diff -N patches/patch-man_sv_8 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-man_sv_8 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,22 @@ +$OpenBSD$ +- make runit service dir configurable at build time +--- man/sv.8.orig Sun Oct 4 22:44:02 2009 ++++ man/sv.8 Wed Apr 17 00:16:03 2013 +@@ -30,7 +30,7 @@ If + .I service + doesn't start with a dot or slash and doesn't end with a slash, it is + searched in the default services directory +-.IR /service/ , ++.IR ${RUNIT_SERVICE_DIR} , + otherwise relative to the current directory. + .P + .I command +@@ -217,7 +217,7 @@ This option implies + .TP + .B SVDIR + The environment variable $SVDIR overrides the default services directory +-.IR /service/ . ++.IR ${RUNIT_SERVICE_DIR} . + .TP + .B SVWAIT + The environment variable $SVWAIT overrides the default 7 seconds to wait Index: patches/patch-man_utmpset_8 =================================================================== RCS file: patches/patch-man_utmpset_8 diff -N patches/patch-man_utmpset_8 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-man_utmpset_8 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,13 @@ +$OpenBSD$ +- make runit service dir configurable at build time +--- man/utmpset.8.orig Sun Oct 4 22:44:02 2009 ++++ man/utmpset.8 Wed Apr 17 00:16:03 2013 +@@ -34,7 +34,7 @@ to the + .I finish + scripts, e.g.: + .P +- $ cat /service/getty-5/finish ++ $ cat ${RUNIT_SERVICE_DIR}/getty-5/finish + #!/bin/sh + exec utmpset \-w tty5 + $ Index: patches/patch-src_runit_c =================================================================== RCS file: patches/patch-src_runit_c diff -N patches/patch-src_runit_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_runit_c 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,38 @@ +$OpenBSD$ +- ctrl-alt-del support +--- src/runit.c.orig Sun Dec 9 19:35:19 2012 ++++ src/runit.c Sun Dec 9 19:38:42 2012 +@@ -66,6 +66,8 @@ int main (int argc, const char * const *argv, char * c + sig_block(sig_hangup); + sig_block(sig_int); + sig_catch(sig_int, sig_int_handler); ++ sig_block(sig_usr1); ++ sig_catch(sig_usr1, sig_int_handler); + sig_block(sig_pipe); + sig_block(sig_term); + +@@ -129,6 +131,8 @@ int main (int argc, const char * const *argv, char * c + sig_unblock(sig_hangup); + sig_unblock(sig_int); + sig_uncatch(sig_int); ++ sig_unblock(sig_usr1); ++ sig_uncatch(sig_usr1); + sig_unblock(sig_pipe); + sig_unblock(sig_term); + +@@ -145,6 +149,7 @@ int main (int argc, const char * const *argv, char * c + sig_unblock(sig_child); + sig_unblock(sig_cont); + sig_unblock(sig_int); ++ sig_unblock(sig_usr1); + #ifdef IOPAUSE_POLL + poll(&x, 1, 14000); + #else +@@ -156,6 +161,7 @@ int main (int argc, const char * const *argv, char * c + sig_block(sig_cont); + sig_block(sig_child); + sig_block(sig_int); ++ sig_block(sig_usr1); + + while (read(selfpipe[0], &ch, 1) == 1) {} + while ((child =wait_nohang(&wstat)) > 0) Index: patches/patch-src_sig_c =================================================================== RCS file: patches/patch-src_sig_c diff -N patches/patch-src_sig_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_sig_c 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +- ctrl-alt-del support +--- src/sig.c.orig Sun Oct 4 22:44:02 2009 ++++ src/sig.c Sun Dec 9 19:31:42 2012 +@@ -10,6 +10,7 @@ int sig_hangup = SIGHUP; + int sig_int = SIGINT; + int sig_pipe = SIGPIPE; + int sig_term = SIGTERM; ++int sig_usr1 = SIGUSR1; + + void (*sig_defaulthandler)() = SIG_DFL; + void (*sig_ignorehandler)() = SIG_IGN; Index: patches/patch-src_sig_h =================================================================== RCS file: patches/patch-src_sig_h diff -N patches/patch-src_sig_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_sig_h 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,12 @@ +$OpenBSD$ +- ctrl-alt-del support +--- src/sig.h.orig Sun Dec 9 19:48:13 2012 ++++ src/sig.h Sun Dec 9 19:48:04 2012 +@@ -10,6 +10,7 @@ extern int sig_hangup; + extern int sig_int; + extern int sig_pipe; + extern int sig_term; ++extern int sig_usr1; + + extern void (*sig_defaulthandler)(); + extern void (*sig_ignorehandler)(); Index: patches/patch-src_sv_c =================================================================== RCS file: patches/patch-src_sv_c diff -N patches/patch-src_sv_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_sv_c 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,13 @@ +$OpenBSD$ +- make runit service dir configurable at build time +--- src/sv.c.orig Wed Apr 17 00:13:38 2013 ++++ src/sv.c Wed Apr 17 00:13:48 2013 +@@ -32,7 +32,7 @@ + char *progname; + char *action; + char *acts; +-char *varservice ="/service/"; ++char *varservice ="${RUNIT_SERVICE_DIR}"; + char **service; + char **servicex; + unsigned int services; Index: pkg/MESSAGE =================================================================== RCS file: /cvs/ports/sysutils/runit/pkg/MESSAGE,v retrieving revision 1.4 diff -u -p -r1.4 MESSAGE --- pkg/MESSAGE 26 Dec 2006 15:04:55 -0000 1.4 +++ pkg/MESSAGE 22 Oct 2013 20:18:26 -0000 @@ -1,12 +1,4 @@ -You will need to add +Since runit 1.9.0 the default service directory has moved to /service. +The OpenBSD port makes it stay at /var/service. - csh -cf '${PREFIX}/sbin/runsvdir-start &' - -to /etc/rc.local in order to have runit start at boot. - -The service directory has moved from /service to /var/service. - -With this version the runsvctrl, runsvstat, svwaitdown, and svwaitup -programs no longer are being installed. The functionality of these -programs has been incorporated into the sv program. -Read ${PREFIX}/share/doc/runit/upgrade.html on update. +Read ${TRUEPREFIX}/share/doc/runit/upgrade.html on update. Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/sysutils/runit/pkg/PLIST,v retrieving revision 1.2 diff -u -p -r1.2 PLIST --- pkg/PLIST 26 Dec 2006 15:04:55 -0000 1.2 +++ pkg/PLIST 22 Oct 2013 20:18:26 -0000 @@ -1,4 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.2 2006/12/26 15:04:55 simon Exp $ +@comment $OpenBSD$ @man man/man8/chpst.8 @man man/man8/runit-init.8 @man man/man8/runit.8 @@ -8,16 +8,15 @@ @man man/man8/sv.8 @man man/man8/svlogd.8 @man man/man8/utmpset.8 -sbin/chpst -sbin/runit -sbin/runit-init -sbin/runsv -sbin/runsvchdir -sbin/runsvdir -sbin/runsvdir-start -sbin/sv -sbin/svlogd -sbin/utmpset +@bin sbin/chpst +@bin sbin/runit +@bin sbin/runit-init +@bin sbin/runsv +@bin sbin/runsvchdir +@bin sbin/runsvdir +@bin sbin/sv +@bin sbin/svlogd +@bin sbin/utmpset share/doc/runit/ share/doc/runit/CHANGES share/doc/runit/COPYING @@ -51,4 +50,5 @@ share/examples/runit/init/ctrlaltdel share/examples/runit/init/getty-ttyC4/ share/examples/runit/init/getty-ttyC4/finish share/examples/runit/init/getty-ttyC4/run -share/examples/runit/rc.shutdown +@rcscript ${RCDIR}/runsvdir +@sample /var/service/ Index: pkg/runsvdir.rc =================================================================== RCS file: pkg/runsvdir.rc diff -N pkg/runsvdir.rc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/runsvdir.rc 22 Oct 2013 20:18:26 -0000 @@ -0,0 +1,29 @@ +#!/bin/sh +# +# $OpenBSD$ + +daemon="${TRUEPREFIX}/sbin/runsvdir" +daemon_flags="-P ${RUNIT_SERVICE_DIR} \'log: ..........................\ +.......................................................................\ +.......................................................................\ +.......................................................................\ +.......................................................................\ +.......................................................................\ +..............\'" + +. /etc/rc.d/rc.subr + +rc_bg=YES +rc_reload=NO + +rc_pre() { + PATH=/command:$PATH +} + +rc_stop() { + ${TRUEPREFIX}/sbin/sv -w196 force-stop ${RUNIT_SERVICE_DIR}/* + ${TRUEPREFIX}/sbin/sv exit ${RUNIT_SERVICE_DIR}/* + pkill -f "^${pexp}" +} + +rc_cmd $1