Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 102866 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/sys-process/daemontools/daemontools-0.76-r4.ebuild (-3 / +8 lines)
Lines 25-30 Link Here
25
	epatch ${FILESDIR}/${PV}-errno.patch
25
	epatch ${FILESDIR}/${PV}-errno.patch
26
	epatch ${FILESDIR}/${PV}-head-1.patch
26
	epatch ${FILESDIR}/${PV}-head-1.patch
27
27
28
	# adding svscan-start
29
	einfo "Adding svscan-start command ..."
30
	cat >${S}/src/svscan-start.c ${FILESDIR}/svscan-start.c
31
	cat >>${S}/src/Makefile ${FILESDIR}/svscan-start-Makefile
32
28
	use static && LDFLAGS="${LDFLAGS} -static"
33
	use static && LDFLAGS="${LDFLAGS} -static"
29
34
30
	echo "$(tc-getCC) ${CFLAGS}" > src/conf-cc
35
	echo "$(tc-getCC) ${CFLAGS}" > src/conf-cc
Lines 34-40 Link Here
34
39
35
src_compile() {
40
src_compile() {
36
	cd ${S}/src
41
	cd ${S}/src
37
	emake || die "make failed"
42
	emake svscan-start it || die "make failed"
38
}
43
}
39
44
40
src_install() {
45
src_install() {
Lines 44-56 Link Here
44
	einfo "Installing package ..."
49
	einfo "Installing package ..."
45
	cd ${S}/src
50
	cd ${S}/src
46
	exeinto /usr/bin
51
	exeinto /usr/bin
47
	for x in `cat ../package/commands` ; do
52
	for x in `cat ../package/commands` svscan-start; do
48
		doexe $x || die
53
		doexe $x || die
49
	done
54
	done
50
55
51
	dodoc CHANGES ../package/README TODO
56
	dodoc CHANGES ../package/README TODO
52
57
53
	newinitd ${FILESDIR}/svscan-0.76-r4 svscan
58
	newinitd ${FILESDIR}/svscan-start-0.76-r4 svscan
54
}
59
}
55
60
56
pkg_postinst() {
61
pkg_postinst() {
(-)/usr/portage/sys-process/daemontools/files/svscan-start-0.76-r4 (+36 lines)
Line 0 Link Here
1
#!/sbin/runscript
2
# Copyright 1999-2004 Gentoo Foundation
3
# Distributed under the terms of the GNU General Public License v2
4
# $$
5
6
depend() {
7
	need net
8
	after net
9
	before ntpd ntp-client
10
	before spamd
11
	before apache apache2
12
}
13
14
start() {
15
	ebegin "Starting service scan"
16
	(
17
	# workaround for #25754
18
	unset -f `declare -F | sed 's:declare -f::g'`
19
	PATH="/usr/bin:$PATH"
20
	start-stop-daemon --start --quiet --exec /usr/bin/svscan-start --pidfile /var/run/svscan.pid -- /service &
21
	echo $! > /var/run/svscan.pid
22
	)
23
	eend $?
24
}
25
26
stop() {
27
	ebegin "Stopping service scan"
28
	start-stop-daemon --stop --quiet --pidfile /var/run/svscan.pid
29
	eend $?
30
	ebegin "Stopping services"
31
	svc -dx /service/* 2>/dev/null
32
	eend $?
33
	ebegin "Stopping service logging"
34
	svc -dx /service/*/log 2>/dev/null
35
	eend $?
36
}
(-)/usr/portage/sys-process/daemontools/files/svscan-start-Makefile (+10 lines)
Line 0 Link Here
1
2
svscan-start: byte.a load svscan-start.o unix.a
3
	./load svscan-start unix.a byte.a 
4
5
svscan-start.o: byte.h coe.h compile direntry.h env.h error.h fd.h \
6
pathexec.h str.h strerr.h svscan-start.c wait.h
7
	./compile svscan-start.c
8
9
svscan-start-clean:
10
	rm -f svscan-start svscan-start.o
(-)/usr/portage/sys-process/daemontools/files/svscan-start.c (+82 lines)
Line 0 Link Here
1
#include <unistd.h>
2
#include <sys/types.h>
3
#include <sys/stat.h>
4
#include "strerr.h"
5
#include "error.h"
6
#include "wait.h"
7
#include "coe.h"
8
#include "fd.h"
9
#include "env.h"
10
#include "sig.h"
11
#include "str.h"
12
#include "byte.h"
13
#include "pathexec.h"
14
15
#define FATAL "svscan-start: fatal: "
16
17
#define DOTS \
18
"........................................................................" \
19
"........................................................................" \
20
"........................................................................" \
21
"........................................................................" \
22
"........................................................................"
23
24
int main(int argc,char **argv)
25
{
26
  int pi[2];
27
  const char *args[5];
28
  char *fn;
29
  int child;
30
  int r;
31
  int wstat;
32
33
  fn = argv[0] && argv[1] ? argv[1] : "/service";
34
35
  if (pipe(pi) == -1)
36
    strerr_die4sys(100,FATAL,"unable to create pipe for svscan ",fn,": ");
37
38
  switch(child = fork()) {
39
    case -1:
40
      strerr_die4sys(111,FATAL,"unable to fork for readproctitle ",fn,": ");
41
      return;
42
    case 0:
43
      coe(pi[1]);
44
      if (fd_move(0,pi[0]) == -1)
45
        strerr_die4sys(111,FATAL,"unable to set up descriptors for readproctitle ",fn,": ");
46
47
      sig_block(sig_hangup);
48
      sig_block(sig_int);
49
      sig_block(sig_alarm);
50
      sig_block(sig_term);
51
52
      args[0] = "readproctitle";
53
      args[1] = fn;
54
      args[2] = ":";
55
      args[3] = DOTS;
56
      args[4] = 0;
57
      pathexec_run(*args,args,environ);
58
      strerr_die2sys(111,FATAL,"unable to start readproctitle: ");
59
    default:
60
      sleep(2);
61
      for (;;) {
62
        r = wait_nohang(&wstat);
63
	if (!r) break;
64
	if (r == -1) {
65
	  if (errno == error_intr) continue; /* impossible */
66
	  break;
67
	}
68
69
	if (child == r)
70
	  strerr_die2x(111,FATAL,"readproctitle child died");
71
      }
72
  }
73
74
  if (fd_move(2,pi[1]) == -1)
75
    strerr_die4sys(111,FATAL,"unable to set up descriptors for svscan ",fn,": ");
76
77
  args[0] = "svscan";
78
  args[1] = fn;
79
  args[2] = 0;
80
  pathexec_run(*args,args,environ);
81
  strerr_die4sys(111,FATAL,"unable to start svscan ",fn,": ");
82
}

Return to bug 102866