0

Initial commit

This commit is contained in:
eleksir
2023-11-19 18:01:40 +03:00
commit 80ec8a7529
586 changed files with 29486 additions and 0 deletions

7
runit/README Normal file
View File

@@ -0,0 +1,7 @@
runit (a UNIX init scheme with service supervision)
a cross-platform Unix init scheme with service supervision, a
replacement for sysvinit, and other init schemes.
runit can replace init or its service supervision can be used with
traditional init. runit is compatible with djb's daemontools

10
runit/config/etc/runit/1 Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
# system one time tasks
PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin
/etc/rc.d/rc.S
/etc/rc.d/rc.M
touch /etc/runit/stopit
chmod 0 /etc/runit/stopit

8
runit/config/etc/runit/2 Normal file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
runsvchdir default >/dev/null
exec env - PATH=$PATH \
runsvdir -P /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

15
runit/config/etc/runit/3 Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
exec 2>&1
PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin
echo "Running shutdown script $0:"
echo 'Waiting for services to stop...'
sv force-stop /service/*
sv exit /service/*
if [ -x /etc/runit/reboot ] ;then
/etc/rc.d/rc.6
else
/etc/rc.d/rc.0
fi

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty1

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty1 linux

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty2

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty2 linux

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty3

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty3 linux

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty4

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty4 linux

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty5

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty5 linux

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec utmpset -w tty6

View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec setsid /sbin/agetty 38400 tty6 linux

View File

@@ -0,0 +1,93 @@
#!/bin/sh
sysv() {
/sbin/shutdown "$@"
}
single() {
runsvchdir single
}
abort() {
printf '%s\n' "$1" >&2
exit 1
}
usage() {
abort "Usage: ${0##*/} [-fF] [-kchPr] time [warning message]"
}
runit_init() {
while getopts akrhPHfFnct: opt; do
case "$opt" in
a|n|H) abort "'-$opt' is not implemented";;
t) ;;
f) touch /fastboot;;
F) touch /forcefsck;;
k) action=true;;
c) action=cancel;;
h|P) action="/sbin/runit-init 0";;
r) action="/sbin/runit-init 6";;
[?]) usage;;
esac
done
shift $((OPTIND - 1))
[ $# -eq 0 ] && usage
time=$1; shift
message="${*:-system is going down}"
if [ "$action" = "cancel" ]; then
kill "$(cat /run/shutdown.pid)"
if [ -e /etc/nologin ] && ! [ -s /etc/nologin ]; then
rm /etc/nologin
fi
echo "${*:-shutdown cancelled}" | wall
exit
fi
touch /run/shutdown.pid 2>/dev/null || abort "Not enough permissions to execute ${0#*/}"
echo $$ >/run/shutdown.pid
case "$time" in
now) time=0;;
+*) time=${time#+};;
*:*) abort "absolute time is not implemented";;
*) abort "invalid time";;
esac
for break in 5 0; do
[ "$time" -gt "$break" ] || continue
[ "$break" = 0 ] && touch /etc/nologin
printf '%s in %s minutes\n' "$message" "$time" | wall
printf 'shutdown: sleeping for %s minutes... ' "$(( time - break ))"
sleep $(( (time - break) * 60 ))
time="$break"
printf '\n'
[ "$break" = 0 ] && rm /etc/nologin
done
printf '%s NOW\n' "$message" | wall
$action
}
initsystem=$( ps -p 1 -o comm= )
action=single
case "$initsystem" in
'init')
sysv "$@"
;;
'runit')
runit_init "$@"
;;
*)
exit
esac

View File

@@ -0,0 +1,57 @@
From 20a0afcd367666efc17c59cf121a0d991ff1bd09 Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@smarden.org>
Date: Thu, 31 Jul 2014 12:25:49 +0000
Subject: [PATCH] utmpset.c: mixes "int32_t *" and "time_t *"
Don't pass int32_t to time(), thx Lorenzo Beretta,
https://bugs.debian.org/754849
---
runit-2.1.2/src/utmpset.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/runit-2.1.2/src/utmpset.c b/runit-2.1.2/src/utmpset.c
index eea41a5..2e8a525 100644
--- a/runit-2.1.2/src/utmpset.c
+++ b/runit-2.1.2/src/utmpset.c
@@ -24,6 +24,7 @@ void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
int utmp_logout(const char *line) {
int fd;
uw_tmp ut;
+ time_t t;
int ok =-1;
if ((fd =open(UW_TMP_UFILE, O_RDWR, 0)) < 0)
@@ -35,7 +36,8 @@ int utmp_logout(const char *line) {
if (!ut.ut_name[0] || (str_diff(ut.ut_line, line) != 0)) continue;
memset(ut.ut_name, 0, sizeof ut.ut_name);
memset(ut.ut_host, 0, sizeof ut.ut_host);
- if (time(&ut.ut_time) == -1) break;
+ if (time(&t) == -1) break;
+ ut.ut_time = t;
#ifdef DEAD_PROCESS
ut.ut_type =DEAD_PROCESS;
#endif
@@ -52,6 +54,7 @@ int wtmp_logout(const char *line) {
int len;
struct stat st;
uw_tmp ut;
+ time_t t;
if ((fd = open_append(UW_TMP_WFILE)) == -1)
strerr_die4sys(111, FATAL, "unable to open ", UW_TMP_WFILE, ": ");
@@ -65,10 +68,11 @@ int wtmp_logout(const char *line) {
memset(&ut, 0, sizeof(uw_tmp));
if ((len =str_len(line)) > sizeof ut.ut_line) len =sizeof ut.ut_line -2;
byte_copy(ut.ut_line, len, line);
- if (time(&ut.ut_time) == -1) {
+ if (time(&t) == -1) {
close(fd);
return(-1);
}
+ ut.ut_time = t;
#ifdef DEAD_PROCESS
ut.ut_type =DEAD_PROCESS;
#endif
--
2.0.1

View File

@@ -0,0 +1,21 @@
Description: Make buildsystem respect dpkg-buildflags
Author: Dmitry Bogatov <KAction@gnu.org>
Last-Update: 2016-06-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/src/print-cc.sh
+++ b/runit-2.1.2/src/print-cc.sh
@@ -2,4 +2,4 @@ cc="`head -n1 conf-cc`"
systype="`cat systype`"
cat warn-auto.sh
-echo exec "$cc" '-c ${1+"$@"}'
+echo exec "$cc" "$CPPFLAGS" "$CFLAGS" '-c ${1+"$@"}'
--- a/runit-2.1.2/src/print-ld.sh
+++ b/runit-2.1.2/src/print-ld.sh
@@ -3,4 +3,4 @@ systype="`cat systype`"
cat warn-auto.sh
echo 'main="$1"; shift'
-echo exec "$ld" '-o "$main" "$main".o ${1+"$@"}'
+echo exec "$ld" "$LDFLAGS" '-o "$main" "$main".o ${1+"$@"}'

View File

@@ -0,0 +1,77 @@
Description: Move communication files under /run
Runit by default uses files /etc/runit/stop and /etc/runit/reboot.
This configuration will not work when /etc is mounted read-only,
as such this patch renames this files into /run/runit.stop and
/run/runit.reboot
Author: Dmitry Bogatov <KAction@gnu.org>
Last-Update: 2016-06-02
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/etc/debian/1
+++ b/runit-2.1.2/etc/debian/1
@@ -6,5 +6,5 @@ PATH=/command:/sbin:/bin:/usr/sbin:/usr/
/etc/init.d/rcS
/etc/init.d/rmnologin
-touch /etc/runit/stopit
-chmod 0 /etc/runit/stopit
+touch /run/runit.stopit
+chmod 0 /run/runit.stopit
--- a/runit-2.1.2/etc/debian/3
+++ b/runit-2.1.2/etc/debian/3
@@ -4,7 +4,7 @@ exec 2>&1
PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin
LAST=0
-test -x /etc/runit/reboot && LAST=6
+test -x /run/runit.reboot && LAST=6
echo 'Waiting for services to stop...'
sv -w196 force-stop /service/*
--- a/runit-2.1.2/etc/debian/ctrlaltdel
+++ b/runit-2.1.2/etc/debian/ctrlaltdel
@@ -4,6 +4,6 @@ PATH=/bin:/usr/bin
MSG="System is going down in 14 seconds..."
# echo 'disabled.' ; exit
-touch /etc/runit/stopit
-chmod 100 /etc/runit/stopit && echo "$MSG" | wall
+touch /etc/runit.stopit
+chmod 100 /etc/runit.stopit && echo "$MSG" | wall
/bin/sleep 14
--- a/runit-2.1.2/man/runit-init.8
+++ b/runit-2.1.2/man/runit-init.8
@@ -26,9 +26,9 @@ To signal
the system halt request,
.B runit-init
removes all permissions of the file
-.I /etc/runit/reboot
+.I /run/runit.reboot
(chmod 0), and sets the execute by owner permission of the file
-.I /etc/runit/stopit
+.I /run/runit.stopit
(chmod 100).
Then a CONT signal is sent to
.BR runit (8).
@@ -40,9 +40,9 @@ To signal
the system reboot request,
.B runit-init
sets the execute by owner permission of the files
-.I /etc/runit/reboot
+.I /run/runit.reboot
and
-.I /etc/runit/stopit
+.I /run/runit.stopit
(chmod 100). Then a CONT signal is sent to
.BR runit (8).
.SH EXIT CODES
--- a/runit-2.1.2/src/runit.h
+++ b/runit-2.1.2/src/runit.h
@@ -1,5 +1,5 @@
#define RUNIT "/sbin/runit"
-#define STOPIT "/etc/runit/stopit"
-#define REBOOT "/etc/runit/reboot"
+#define STOPIT "/run/runit.stopit"
+#define REBOOT "/run/runit.reboot"
#define NOSYNC "/run/runit.nosync"
#define CTRLALTDEL "/etc/runit/ctrlaltdel"

View File

@@ -0,0 +1,20 @@
Description: Emulalate sysv runlevel 5 by default
Currently, not many daemons in Debian provides proper runscripts, so
if user switches to runit, she will on next reboot, that none of daemons,
including essential, like cron, are started.
.
This patch starts them in sysv-init style -- unmanaged, in background.
It is sub-par solution, but allows one-by-one transition.
Author: Dmitry Bogatov
Forwarded: not-needed
Last-Update: 2016-06-09
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/etc/debian/1
+++ b/runit-2.1.2/etc/debian/1
@@ -8,3 +8,5 @@ PATH=/command:/sbin:/bin:/usr/sbin:/usr/
touch /run/runit.stopit
chmod 0 /run/runit.stopit
+
+[ -e /etc/runit/no-emulate-sysv ] || /etc/init.d/rc 5

View File

@@ -0,0 +1,18 @@
commit e0f48258bb2ff9f65524530771d4f6f4b2948384
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:12:35 2020 -0300
svlogd.c: Clear dir struct.
diff --git a/src/svlogd.c b/src/svlogd.c
index 5e55a90..006493e 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -705,6 +705,7 @@ int main(int argc, const char **argv) {
coe(fdwdir);
dir =(struct logdir*)alloc(dirn *sizeof(struct logdir));
if (! dir) die_nomem();
+ memset(dir, 0, dirn * sizeof(struct logdir));
for (i =0; i < dirn; ++i) {
dir[i].fddir =-1; dir[i].fdcur =-1;
dir[i].btmp =(char*)alloc(buflen *sizeof(char));

View File

@@ -0,0 +1,20 @@
commit 4d2a8e66a3c62f47ca7b9e91c49afbeaa0cfc0b1
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:12:45 2020 -0300
svlogd.c: Initialize all fields of sockaddr_in.
http://skarnet.org/cgi-bin/archive.cgi?2:mss:1163:201602:gpiglpbjdemlioaeabbn
diff --git a/src/svlogd.c b/src/svlogd.c
index 006493e..8de65e0 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -430,6 +430,7 @@ unsigned int logdir_open(struct logdir *ld, const char *fn) {
ld->name =(char*)fn;
ld->ppid =0;
ld->match ='+';
+ ld->udpaddr.sin_family =AF_INET;
ld->udpaddr.sin_port =0;
ld->udponly =0;
while (! stralloc_copys(&ld->prefix, "")) pause_nomem();

View File

@@ -0,0 +1,18 @@
commit ec0f605d5b385c6c230a10312697315e01dad217
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:37 2020 -0300
svlogd.c: add missing header.
diff --git a/src/svlogd.c b/src/svlogd.c
index 8de65e0..8c68c73 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -8,6 +8,7 @@
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
+#include <string.h>
#include "pmatch.h"
#include "fmt_ptime.h"
#include "alloc.h"

View File

@@ -0,0 +1,18 @@
commit 53bf22e68c36b2fc2281998f8311c7c73c17259c
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:45 2020 -0300
seek_set.c: add missing header.
diff --git a/src/seek_set.c b/src/seek_set.c
index 19b8265..a1a36d0 100644
--- a/runit-2.1.2/src/seek_set.c
+++ b/runit-2.1.2/src/seek_set.c
@@ -1,6 +1,7 @@
/* Public domain. */
#include <sys/types.h>
+#include <unistd.h>
#include "seek.h"
#define SET 0 /* sigh */

View File

@@ -0,0 +1,17 @@
commit 3295cb4865759a71c27ca5fe4ade980c8b69db6c
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:51 2020 -0300
pathexec_run.c:: add missing header.
diff --git a/src/pathexec_run.c b/src/pathexec_run.c
index 1770ac7..70ac7a8 100644
--- a/runit-2.1.2/src/pathexec_run.c
+++ b/runit-2.1.2/src/pathexec_run.c
@@ -1,5 +1,6 @@
/* Public domain. */
+#include <unistd.h>
#include "error.h"
#include "stralloc.h"
#include "str.h"

View File

@@ -0,0 +1,23 @@
commit c3c65bcdfe53aac4f1bd27f4bfb3faccabfa2fd3
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:57 2020 -0300
chkshsgr.c: use gid_t.
diff --git a/src/chkshsgr.c b/src/chkshsgr.c
index 38c352d..31eda67 100644
--- a/runit-2.1.2/src/chkshsgr.c
+++ b/runit-2.1.2/src/chkshsgr.c
@@ -1,10 +1,11 @@
/* Public domain. */
+#include <sys/types.h>
#include <unistd.h>
int main()
{
- short x[4];
+ gid_t x[4];
x[0] = x[1] = 0;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);

View File

@@ -0,0 +1,48 @@
commit fc2f8674d726df289e650b79189c4221ff66c8a5
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:20:03 2020 -0300
prot.c, prot.h: use gid_t and uid_t.
diff --git a/src/prot.c b/src/prot.c
index 79a88c5..66cdc05 100644
--- a/runit-2.1.2/src/prot.c
+++ b/runit-2.1.2/src/prot.c
@@ -3,7 +3,11 @@
#include "hasshsgr.h"
#include "prot.h"
-int prot_gid(int gid)
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
short x[2];
@@ -15,7 +19,7 @@ int prot_gid(int gid)
return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
}
-int prot_uid(int uid)
+int prot_uid(uid_t uid)
{
return setuid(uid);
}
diff --git a/src/prot.h b/src/prot.h
index 2e5cb81..b9fa6c8 100644
--- a/runit-2.1.2/src/prot.h
+++ b/runit-2.1.2/src/prot.h
@@ -3,7 +3,9 @@
#ifndef PROT_H
#define PROT_H
-extern int prot_gid(int);
-extern int prot_uid(int);
+#include <sys/types.h>
+
+extern int prot_gid(gid_t);
+extern int prot_uid(uid_t);
#endif

View File

@@ -0,0 +1,24 @@
commit 727b2a5236346e75ec6455179d5073e348d165be (HEAD -> refs/heads/master, refs/remotes/origin/master, refs/remotes/origin/HEAD)
Author: Érico Rolim <erico.erc@gmail.com>
Date: Wed Aug 26 21:00:34 2020 -0300
chpst: fix undefined operation on sequence point.
Based on patch from
https://salsa.debian.org/debian/runit/-/blob/77a49befd7c1a08bfe0613454e540562529811fa/debian/patches/0016-fix-warning-for-undefined-operation-on-sequence-poin.patch
diff --git a/src/chpst.c b/src/chpst.c
index f279d44..1cca5f4 100644
--- a/runit-2.1.2/src/chpst.c
+++ b/runit-2.1.2/src/chpst.c
@@ -308,7 +308,8 @@ int main(int argc, const char **argv) {
case 'n':
switch (*optarg) {
case '-':
- if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul;
+ ++optarg;
+ if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
nicelvl *=-1;
break;
case '+': ++optarg;

View File

@@ -0,0 +1,25 @@
From 8a090ee97d4037ed19fc468ce2933db8cb264016 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Sun, 26 Jan 2020 13:39:52 +0100
Subject: [PATCH] fix: runsvdir.c event check
- fix runsvdir: wrong operator in event check, should be 'and' instead of 'or'.
This is a common typo. The IOPAUSE_READ is not being checked and the condition
always wrongly evaluates to true.
---
runit-2.1.2/src/runsvdir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/runsvdir.c b/runit-2.1.2/src/runsvdir.c
index 1317fe9..aca22d0 100644
--- a/runit-2.1.2/src/runsvdir.c
+++ b/runit-2.1.2/src/runsvdir.c
@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
iopause(0, 0, &deadline, &now);
sig_unblock(sig_child);
- if (rplog && (io[0].revents | IOPAUSE_READ))
+ if (rplog && (io[0].revents & IOPAUSE_READ))
while (read(logpipe[0], &ch, 1) > 0)
if (ch) {
for (i =6; i < rploglen; i++)

View File

@@ -0,0 +1,89 @@
From 62031255f6e7f6ef0355c81010bb193153267485 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Fri, 8 Mar 2019 21:18:35 +0100
Subject: [PATCH] fix: resource leaks and other issues as reported by infer
to run infer static code analyzer (fbinfer.com):
cd src; infer run -- make
- fix: fd_move.c resource leak - close file handle
- fix: runit-init.c resource leak - close file handle
- fix: svlogd.c dead storage - value never used
- fix: x86cpuid.c uninitialized value read
- fix: package/install-man - do not use unreliable symlinks
---
runit-2.1.2/package/install-man | 11 +++--------
runit-2.1.2/src/fd_move.c | 5 ++++-
runit-2.1.2/src/runit-init.c | 6 +++---
runit-2.1.2/src/svlogd.c | 2 +-
runit-2.1.2/src/x86cpuid.c | 4 ++++
5 files changed, 15 insertions(+), 13 deletions(-)
diff -ruNp admin/runit-2.1.2/src/fd_move.c admin.new/runit-2.1.2/src/fd_move.c
--- admin/runit-2.1.2/src/fd_move.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/fd_move.c 2020-11-04 16:04:06.064942243 +0300
@@ -6,7 +6,10 @@
int fd_move(int to,int from)
{
if (to == from) return 0;
- if (fd_copy(to,from) == -1) return -1;
+ if (fd_copy(to,from) == -1) {
+ close(from);
+ return -1;
+ }
close(from);
return 0;
}
diff -ruNp admin/runit-2.1.2/src/runit-init.c admin.new/runit-2.1.2/src/runit-init.c
--- admin/runit-2.1.2/src/runit-init.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/runit-init.c 2020-11-04 16:04:06.065942238 +0300
@@ -17,7 +17,7 @@ const char *progname;
void usage(void) { strerr_die4x(0, "usage: ", progname, USAGE, "\n"); }
void runit_halt () {
- if (open_trunc(STOPIT) == -1)
+ if (close(open_trunc(STOPIT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
if (chmod(STOPIT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
@@ -29,11 +29,11 @@ void runit_halt () {
}
void runit_reboot () {
- if (open_trunc(STOPIT) == -1)
+ if (close(open_trunc(STOPIT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
if (chmod(STOPIT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
- if (open_trunc(REBOOT) == -1)
+ if (close(open_trunc(REBOOT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", REBOOT, ": ");
if (chmod(REBOOT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", REBOOT, ": ");
diff -ruNp admin/runit-2.1.2/src/svlogd.c admin.new/runit-2.1.2/src/svlogd.c
--- admin/runit-2.1.2/src/svlogd.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/svlogd.c 2020-11-04 16:06:23.526311748 +0300
@@ -396,7 +396,8 @@ unsigned int ip4_scan(const char *s,char
if (*s != '.') return 0; ++s; ++len;
i = scan_ulong(s,&u); if (!i) return 0; ip[2] = u; s += i; len += i;
if (*s != '.') return 0; ++s; ++len;
- i = scan_ulong(s,&u); if (!i) return 0; ip[3] = u; s += i; len += i;
+ i = scan_ulong(s,&u); if (!i) return 0; ip[3] = u; len += i;
+
return len;
}
diff -ruNp admin/runit-2.1.2/src/x86cpuid.c admin.new/runit-2.1.2/src/x86cpuid.c
--- admin/runit-2.1.2/src/x86cpuid.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/x86cpuid.c 2020-11-04 16:04:06.067942229 +0300
@@ -21,6 +21,10 @@ int main()
x[1] = 0;
x[2] = 0;
x[3] = 0;
+ y[0] = 0;
+ y[1] = 0;
+ y[2] = 0;
+ y[3] = 0;
asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
if (!x[0]) return 0;

View File

@@ -0,0 +1,40 @@
From f7b8f943d1f7a8f26df8d81eeb0a2d5a69ee7e22 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Wed, 6 Mar 2019 18:38:04 +0100
Subject: [PATCH] fix: replace obsolete usleep with nanosleep
POSIX.1-2001 declares usleep obsolete,
POSIX.1-2008 removes the specification of usleep,
see https://linux.die.net/man/3/usleep
---
runit-2.1.2/src/sv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/sv.c b/runit-2.1.2/src/sv.c
index 6cc2a8b..f97c5a2 100644
--- a/runit-2.1.2/src/sv.c
+++ b/runit-2.1.2/src/sv.c
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <time.h>
#include <unistd.h>
#include "str.h"
#include "strerr.h"
@@ -271,6 +272,7 @@ int control(char *a) {
int main(int argc, char **argv) {
unsigned int i, done;
char *x;
+ const struct timespec sleeptime = {0, 420000000};
progname =*argv;
for (i =str_len(*argv); i; --i) if ((*argv)[i -1] == '/') break;
@@ -388,7 +390,7 @@ int main(int argc, char **argv) {
fatal("unable to change to original directory");
}
if (done) break;
- usleep(420000);
+ nanosleep(&sleeptime, NULL);
taia_now(&tnow);
}
return(rc > 99 ? 99 : rc);

View File

@@ -0,0 +1,294 @@
diff -ruNp admin/runit-2.1.2/src/chkshsgr.c admin.new/runit-2.1.2/src/chkshsgr.c
--- admin/runit-2.1.2/src/chkshsgr.c 2020-11-04 16:53:26.482378214 +0300
+++ admin.new/runit-2.1.2/src/chkshsgr.c 2020-11-04 16:55:36.400785552 +0300
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <grp.h>
int main()
{
diff -ruNp admin/runit-2.1.2/src/chpst.c admin.new/runit-2.1.2/src/chpst.c
--- admin/runit-2.1.2/src/chpst.c 2020-11-04 16:53:35.608336583 +0300
+++ admin.new/runit-2.1.2/src/chpst.c 2020-11-04 16:57:34.848244408 +0300
@@ -3,6 +3,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
+#include <grp.h>
#include "sgetopt.h"
#include "error.h"
#include "strerr.h"
@@ -40,7 +41,7 @@ void usage() { strerr_die4x(100, "usage:
char *set_user =0;
char *env_user =0;
-const char *argv0 =0;
+char *argv0 =0;
const char *env_dir =0;
unsigned int verbose =0;
unsigned int pgrp =0;
@@ -258,14 +259,14 @@ void slimit() {
}
/* argv[0] */
-void setuidgid(int, const char *const *);
-void envuidgid(int, const char *const *);
-void envdir(int, const char *const *);
-void pgrphack(int, const char *const *);
-void setlock(int, const char *const *);
-void softlimit(int, const char *const *);
+void setuidgid(int, char *const *);
+void envuidgid(int, char *const *);
+void envdir(int, char *const *);
+void pgrphack(int, char *const *);
+void setlock(int, char *const *);
+void softlimit(int, char *const *);
-int main(int argc, const char **argv) {
+int main(int argc, char **argv) {
int opt;
int i;
unsigned long ul;
@@ -367,7 +368,7 @@ int main(int argc, const char **argv) {
void setuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_SETUIDGID, "\n");
}
-void setuidgid(int argc, const char *const *argv) {
+void setuidgid(int argc, char *const *argv) {
const char *account;
if (! (account =*++argv)) setuidgid_usage();
@@ -380,7 +381,7 @@ void setuidgid(int argc, const char *con
void envuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_ENVUIDGID, "\n");
}
-void envuidgid(int argc, const char *const *argv) {
+void envuidgid(int argc, char *const *argv) {
const char *account;
if (! (account =*++argv)) envuidgid_usage();
@@ -393,7 +394,7 @@ void envuidgid(int argc, const char *con
void envdir_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_ENVDIR, "\n");
}
-void envdir(int argc, const char *const *argv) {
+void envdir(int argc, char *const *argv) {
const char *dir;
if (! (dir =*++argv)) envdir_usage();
@@ -406,7 +407,7 @@ void envdir(int argc, const char *const
void pgrphack_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_PGRPHACK, "\n");
}
-void pgrphack(int argc, const char *const *argv) {
+void pgrphack(int argc, char *const *argv) {
if (! *++argv) pgrphack_usage();
setsid();
pathexec(argv);
@@ -416,7 +417,7 @@ void pgrphack(int argc, const char *cons
void setlock_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_SETLOCK, "\n");
}
-void setlock(int argc, const char *const *argv) {
+void setlock(int argc, char *const *argv) {
int opt;
unsigned int delay =0;
unsigned int x =0;
@@ -450,7 +451,7 @@ void getlarg(long *l) {
if (optarg[scan_ulong(optarg, &ul)]) usage();
*l =ul;
}
-void softlimit(int argc, const char *const *argv) {
+void softlimit(int argc, char *const *argv) {
int opt;
while ((opt =getopt(argc,argv,"a:c:d:f:l:m:o:p:r:s:t:")) != opteof)
diff -ruNp admin/runit-2.1.2/src/pathexec.h admin.new/runit-2.1.2/src/pathexec.h
--- admin/runit-2.1.2/src/pathexec.h 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/pathexec.h 2020-11-04 16:54:40.572040232 +0300
@@ -3,9 +3,9 @@
#ifndef PATHEXEC_H
#define PATHEXEC_H
-extern void pathexec_run(const char *,const char * const *,const char * const *);
+extern void pathexec_run(const char *, char *const *, char *const *);
extern int pathexec_env(const char *,const char *);
-extern void pathexec_env_run(const char *, const char * const *);
-extern void pathexec(const char * const *);
+extern void pathexec_env_run(const char *, char *const *);
+extern void pathexec(char * const *);
#endif
diff -ruNp admin/runit-2.1.2/src/pathexec_env.c admin.new/runit-2.1.2/src/pathexec_env.c
--- admin/runit-2.1.2/src/pathexec_env.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/pathexec_env.c 2020-11-04 16:54:40.573040227 +0300
@@ -22,9 +22,9 @@ int pathexec_env(const char *s,const cha
return stralloc_cat(&plus,&tmp);
}
-void pathexec_env_run(const char *file, const char *const *argv)
+void pathexec_env_run(const char *file, char *const *argv)
{
- const char **e;
+ char **e;
unsigned int elen;
unsigned int i;
unsigned int j;
@@ -40,7 +40,7 @@ void pathexec_env_run(const char *file,
if (!plus.s[i])
++elen;
- e = (const char **) alloc((elen + 1) * sizeof(char *));
+ e = (char **) alloc((elen + 1) * sizeof(char *));
if (!e) return;
elen = 0;
@@ -68,7 +68,7 @@ void pathexec_env_run(const char *file,
alloc_free(e);
}
-void pathexec(const char *const *argv)
+void pathexec(char *const *argv)
{
return pathexec_env_run(*argv, argv);
}
diff -ruNp admin/runit-2.1.2/src/pathexec_run.c admin.new/runit-2.1.2/src/pathexec_run.c
--- admin/runit-2.1.2/src/pathexec_run.c 2020-11-04 16:53:22.330397154 +0300
+++ admin.new/runit-2.1.2/src/pathexec_run.c 2020-11-04 16:54:42.135033101 +0300
@@ -9,7 +9,7 @@
static stralloc tmp;
-void pathexec_run(const char *file,const char * const *argv,const char * const *envp)
+void pathexec_run(const char *file, char *const *argv, char *const *envp)
{
const char *path;
unsigned int split;
diff -ruNp admin/runit-2.1.2/src/prot.c admin.new/runit-2.1.2/src/prot.c
--- admin/runit-2.1.2/src/prot.c 2020-11-04 16:53:30.775358630 +0300
+++ admin.new/runit-2.1.2/src/prot.c 2020-11-04 16:59:33.850699916 +0300
@@ -10,7 +10,7 @@
int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
- short x[2];
+ gid_t x[2];
x[0] = gid; x[1] = 73; /* catch errors */
if (setgroups(1,x) == -1) return -1;
#else
diff -ruNp admin/runit-2.1.2/src/runsvdir.c admin.new/runit-2.1.2/src/runsvdir.c
--- admin/runit-2.1.2/src/runsvdir.c 2020-11-04 16:53:40.102316083 +0300
+++ admin.new/runit-2.1.2/src/runsvdir.c 2020-11-04 16:54:50.376995503 +0300
@@ -63,7 +63,7 @@ void runsv(int no, char *name) {
}
if (pid == 0) {
/* child */
- const char *prog[3];
+ char *prog[3];
prog[0] ="runsv";
prog[1] =name;
@@ -71,7 +71,7 @@ void runsv(int no, char *name) {
sig_uncatch(sig_hangup);
sig_uncatch(sig_term);
if (pgrp) setsid();
- pathexec_run(*prog, prog, (const char* const*)environ);
+ pathexec_run(*prog, prog, (char * const *)environ);
fatal("unable to start runsv ", name);
}
sv[no].pid =pid;
diff -ruNp admin/runit-2.1.2/src/sgetopt.c admin.new/runit-2.1.2/src/sgetopt.c
--- admin/runit-2.1.2/src/sgetopt.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/sgetopt.c 2020-11-04 16:54:52.310986681 +0300
@@ -27,7 +27,7 @@ Documentation in sgetopt.3.
int opterr = 1;
const char *optprogname = 0;
-int getopt(int argc,const char *const *argv,const char *opts)
+int getopt(int argc,char *const *argv,const char *opts)
{
int c;
const char *s;
diff -ruNp admin/runit-2.1.2/src/sgetopt.h admin.new/runit-2.1.2/src/sgetopt.h
--- admin/runit-2.1.2/src/sgetopt.h 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/sgetopt.h 2020-11-04 16:54:52.311986676 +0300
@@ -16,7 +16,7 @@
#include "subgetopt.h"
-extern int sgetoptmine(int,const char *const *,const char *);
+extern int sgetoptmine(int,char *const *,const char *);
extern int sgetopterr;
extern const char *sgetoptprogname;
diff -ruNp admin/runit-2.1.2/src/subgetopt.c admin.new/runit-2.1.2/src/subgetopt.c
--- admin/runit-2.1.2/src/subgetopt.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/subgetopt.c 2020-11-04 16:54:52.312986672 +0300
@@ -16,7 +16,7 @@ const char *optarg = 0;
int optproblem = 0;
int optdone = SUBGETOPTDONE;
-int sgopt(int argc,const char *const *argv,const char *opts)
+int sgopt(int argc,char *const *argv,const char *opts)
{
int c;
const char *s;
diff -ruNp admin/runit-2.1.2/src/subgetopt.h admin.new/runit-2.1.2/src/subgetopt.h
--- admin/runit-2.1.2/src/subgetopt.h 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/subgetopt.h 2020-11-04 16:54:52.312986672 +0300
@@ -15,7 +15,7 @@
#define SUBGETOPTDONE -1
-extern int subgetopt(int,const char *const *,const char *);
+extern int subgetopt(int,char *const *,const char *);
extern const char *subgetoptarg;
extern int subgetoptind;
extern int subgetoptpos;
diff -ruNp admin/runit-2.1.2/src/sv.c admin.new/runit-2.1.2/src/sv.c
--- admin/runit-2.1.2/src/sv.c 2020-11-04 16:53:54.756249234 +0300
+++ admin.new/runit-2.1.2/src/sv.c 2020-11-04 16:54:54.886974929 +0300
@@ -283,7 +283,7 @@ int main(int argc, char **argv) {
lsb =(str_diff(progname, "sv"));
if ((x =env_get("SVDIR"))) varservice =x;
if ((x =env_get("SVWAIT"))) scan_ulong(x, &wait);
- while ((i =getopt(argc, (const char* const*)argv, "w:vV")) != opteof) {
+ while ((i =getopt(argc, (char* const*)argv, "w:vV")) != opteof) {
switch(i) {
case 'w': scan_ulong(optarg, &wait);
case 'v': verbose =1; break;
diff -ruNp admin/runit-2.1.2/src/svlogd.c admin.new/runit-2.1.2/src/svlogd.c
--- admin/runit-2.1.2/src/svlogd.c 2020-11-04 16:53:47.389282841 +0300
+++ admin.new/runit-2.1.2/src/svlogd.c 2020-11-04 16:54:56.968965432 +0300
@@ -53,7 +53,7 @@ unsigned long linelen;
const char *replace ="";
char repl =0;
-const char **fndir;
+char **fndir;
int fdwdir;
struct stat st;
stralloc sa;
@@ -664,7 +664,7 @@ void logmatch(struct logdir *ld) {
i +=byte_chr(&ld->inst.s[i], ld->inst.len -i, 0);
}
}
-int main(int argc, const char **argv) {
+int main(int argc, char **argv) {
int i;
int opt;
diff -ruNp admin/runit-2.1.2/src/utmpset.c admin.new/runit-2.1.2/src/utmpset.c
--- admin/runit-2.1.2/src/utmpset.c 2020-11-04 16:52:29.062640152 +0300
+++ admin.new/runit-2.1.2/src/utmpset.c 2020-11-04 16:54:59.851952280 +0300
@@ -85,7 +85,7 @@ int wtmp_logout(const char *line) {
return(1);
}
-int main (int argc, const char * const *argv, const char * const *envp) {
+int main (int argc, char * const *argv, char * const *envp) {
int opt;
int wtmp =0;

View File

@@ -0,0 +1,22 @@
From 7791b76917a00ca44e3a5c297675214a40f7f215 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <KAction@gnu.org>
Date: Mon, 28 May 2018 21:46:39 +0300
Subject: [PATCH] [PATCH] Fix spin lock on systems with poor clock
---
runit-2.1.2/src/svlogd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/svlogd.c b/runit-2.1.2/src/svlogd.c
index 90a3321..fab8441 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -234,7 +234,7 @@ void rmoldest(struct logdir *ld) {
if (unlink(f->d_name) == -1)
warn2("unable to unlink processor leftover", f->d_name);
}
- else {
+ else if (f->d_name[26] != 'u') {
++n;
if (str_diff(f->d_name, oldest) < 0) byte_copy(oldest, 27, f->d_name);
}

View File

@@ -0,0 +1,27 @@
diff -ruN admin/runit-2.1.2/package/commands admin.new/runit-2.1.2/package/commands
--- admin/runit-2.1.2/package/commands 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/package/commands 2020-04-29 00:52:22.669255084 +0300
@@ -5,5 +5,7 @@
runsvchdir
runsvdir
sv
+svwaitdown
+svwaitup
svlogd
utmpset
diff -ruN admin/runit-2.1.2/src/Makefile admin.new/runit-2.1.2/src/Makefile
--- admin/runit-2.1.2/src/Makefile 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/Makefile 2020-04-29 00:50:35.024580450 +0300
@@ -1,9 +1,10 @@
-IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
+IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd svwaitdown svwaitup utmpset
+ME=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
default: sysdeps $(IT)
check: $(IT)
- ./check-local $(IT)
+ ./check-local $(ME)
runit: load runit.o unix.a byte.a
./load runit unix.a byte.a -static

View File

@@ -0,0 +1,13 @@
diff -ruNp admin/runit-2.1.2/src/alloc.c admin.new/runit-2.1.2/src/alloc.c
--- admin/runit-2.1.2/src/alloc.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/alloc.c 2020-11-04 19:12:09.110651948 +0300
@@ -18,7 +18,7 @@ unsigned int n;
char *x;
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
if (n <= avail) { avail -= n; return space + avail; }
- x = malloc(n);
+ x = calloc(n, sizeof(char));
if (!x) errno = error_nomem;
return x;
}

135
runit/runit.SlackBuild Executable file
View File

@@ -0,0 +1,135 @@
#!/bin/sh
# Slackware package build script for runit
# Copyright 2023 Sergei Fedosoff <eleksir@gmail.com>
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=runit
VERSION=${VERSION:-2.1.2}
BUILD=${BUILD:-4}
TAG=${TAG:-_EXs}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
set -e
CWD=$(pwd)
TMP=${TMP:-/tmp/EXs}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -g -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -g -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -g -fPIC"
else
SLKCFLAGS="-O2 -g"
fi
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xf $CWD/$PRGNAM-$VERSION.tar.gz --strip-components=1
cd $PRGNAM-$VERSION
patch -p2 -i $CWD/patches/0003-utmpset.c-mixes-int32_t-and-time_t.diff
patch -p2 -i $CWD/patches/0006-make-buildsystem-respect-CFLAGS.patch
patch -p2 -i $CWD/patches/0007-move-communication-files.patch
patch -p2 -i $CWD/patches/0008-emulate-sysv-runlevel-5.patch
patch -p2 -i $CWD/patches/0009-svlogd.c_clear_dir_struct.patch
patch -p2 -i $CWD/patches/0010-svlogd.c_Initialize_all_fields_of_sockaddr_in.patch
patch -p2 -i $CWD/patches/0011-svlogd.c_add_missing_header.patch
patch -p2 -i $CWD/patches/0012-seek_set.c_add_missing_header.patch
patch -p2 -i $CWD/patches/0013-pathexec_run.c_add_missing_header.patch
patch -p2 -i $CWD/patches/0014-chkshsgr.c_use_gid_t.patch
patch -p2 -i $CWD/patches/0015-prot.c_prot.h_use_gid_t_and_uid_t.patch
patch -p2 -i $CWD/patches/0016-chpst_fix_undefined_operation_on_sequence_point.patch
patch -p2 -i $CWD/patches/enable-runsvup-and-runsvdown.patch
patch -p2 -i $CWD/patches/0017-fix_runsvdir_c_event_check.patch
patch -p2 -i $CWD/patches/0018-resource_leaks_and_other_issues_as_reported_by_infer.patch
patch -p2 -i $CWD/patches/0019-replace_obsolete_usleep_with_nanosleep.patch
patch -p2 -i $CWD/patches/0020-implicit_declarations_incompatible_types_argv_type.patch
patch -p2 -i $CWD/patches/0022-fix_spin_lock_on_systems_with_poor_clock.patch
patch -p2 -i $CWD/patches/malloc-to-calloc.patch
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
echo gcc $SLKCFLAGS -Wall > src/conf-cc
package/compile
package/check
install -d $PKG/{sbin,usr/bin}
install -Dpm 0755 command/{runit*,utmpset} $PKG/sbin
install -Dpm 0755 command/{chpst,runsv*,sv*} $PKG/usr/bin
install -Dpm 0750 etc/2 $PKG/sbin/runsvdir-start
install -d $PKG/usr/man/man8
install -Dpm 0644 man/* $PKG/usr/man/man8
install -Dpm 0644 $CWD/svwaitdown.8 $PKG/usr/man/man8
install -Dpm 0644 $CWD/svwaitup.8 $PKG/usr/man/man8
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find $PKG/usr/man -type f -exec gzip -9 {} \+
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
# Proceed with the configuration files. By default we install them.
if [ "${CONFIG:-no}" != "yes" ]; then
# Set up the configuration files
cp -rp $CWD/config/* $PKG/
# Set up the runlevels
mkdir -p $PKG/etc/runit/runsvdir/{default,single}/
ln -s /etc/sv/agetty-tty1 $PKG/etc/runit/runsvdir/single/
ln -s default $PKG/etc/runit/runsvdir/current
for N in 1 2 3 4 5 6; do
ln -s /etc/sv/agetty-tty${N} $PKG/etc/runit/runsvdir/default/
done
ln -s /etc/runit/runsvdir/current $PKG/service
fi
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a package/CHANGES package/README package/TODO package/COPYING package/THANKS \
doc/ etc/ $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

10
runit/runit.info Normal file
View File

@@ -0,0 +1,10 @@
PRGNAM="runit"
VERSION="2.1.2"
HOMEPAGE="http://smarden.org/runit/"
DOWNLOAD="http://smarden.org/runit/runit-2.1.2.tar.gz"
MD5SUM="6c985fbfe3a34608eb3c53dc719172c4"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="Sergei Fedosoff"
EMAIL="eleksir@gmail.com"

19
runit/slack-desc Normal file
View File

@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
runit: runit (a UNIX init scheme with service supervision)
runit:
runit: a cross-platform Unix init scheme with service supervision, a
runit: replacement for sysvinit, and other init schemes.
runit:
runit: runit can replace init or its service supervision can be used with
runit: traditional init. runit is compatible with djb's daemontools
runit:
runit: Homepage: http://smarden.org/runit/index.html
runit:
runit:

119
runit/svwaitdown.8 Normal file
View File

@@ -0,0 +1,119 @@
.TH svwaitdown 8
.SH NAME
svwaitdown \- waits for services controlled by runsv(8) or supervise(8) to be down
.SH SYNOPSIS
.B svwaitdown
[
.B \-v
] [
.B \-k
] [
.B \-t
.I sec
]
.I services
.SH DESCRIPTION
.I services
consists of one or more arguments. Each
.I service
directory must start with a slash.
.P
.B svwaitdown
sends each
.I service
given at the command line the ``down'' command, and waits for it to become
down.
The
.I services
given at the command line must be controlled by
.BR runsv (8),
or
.BR supervise (8).
.P
.B svwaitdown
blocks, limited by a
.IR timeout ,
until all
.I services
are down or reports errors.
.SH OPTIONS
.TP
.B \-v
verbose. Print verbose messages to stderr.
.TP
.B \-t \fIsec
Set the timeout for waiting for
.I services
to become down to
.I sec
seconds.
.I sec
must be between 2 and 6000. Default is 600 (10 minutes).
.TP
.B \-k
Kill. If the timeout is reached before all
.I services
are down, tell the
.BR runsv (8)
processes to send the
.I services
a KILL signal.
.TP
.B \-x
Exit. Send each
.I service
the ``exit'' command additionally to the ``down'' command, and wait for the
corresponding
.BR runsv (8)
processes to exit instead for the
.I services
to be down.
This option should only be used by
.BR runit (8)
in stage 3 when
.BR runsvdir (8)
is already stopped.
.SH EXIT CODES
.B svwaitdown
returns 0 as soon as all
.I services
are down.
.P
If a
.I service
is usually controlled by
.B runsv (8)
or
.BR supervise (8),
but no supervisor process is currently running,
.B svwaitdown
treats this
.I service
as if it would be down.
.P
For each
.I service
that causes an error while checking,
.B svwaitdown
increases the exit code by one and exits non zero. The maximum is 100.
.P
.B svwaitdown
returns 111 if the timeout
.I sec
was reached.
.SH SEE ALSO
svwaitdown(8),
runsv(8),
runsvctrl(8),
runsvstat(8),
runsvdir(8),
runsvchdir(8),
runit(8),
runit-init(8),
supervise(8),
svscan(8)
.P
http://smarden.org/runit/
http://cr.yp.to/daemontools.html
.SH AUTHOR
Gerrit Pape <pape@smarden.org>

104
runit/svwaitup.8 Normal file
View File

@@ -0,0 +1,104 @@
.TH svwaitup 8
.SH NAME
svwaitup \- waits for services controlled by runsv(8) or supervise(8) to be up
.SH SYNOPSIS
.B svwaitup
[
.B \-v
]
[
.B \-s
.I sec
]
.I services
.SH DESCRIPTION
.I services
consist of one or more arguments. Each
.I service
directory must start with a slash.
.P
.B svwaitup
checks each
.I service
given at the command line for being at least the specified number of seconds
.I sec
up. The
.I services
given at the command line must be controlled by
.BR runsv (8),
or
.BR supervise (8).
.P
.B svwaitup
blocks until all
.I services
were up and running at least
.I sec
seconds when
.B svwaitup
was checking or reports errors.
.SH OPTIONS
.TP
.B \-v
verbose. Print verbose messages to stderr.
.TP
.B \-s \fIsec
Set the minimum number of seconds each
.I service
has to be up to
.I sec
seconds.
.I sec
must be between 2 and 600. Default is 2.
.SH EXIT CODES
.B svwaitup
returns 0 as soon as all
.I services
were at least
.I sec
seconds up.
.P
.BR Note :
If
.B svwaitup
exits 0, it does not guarantee that all
.I services
are actually running. A
.I service
could have crashed immediatly after
.B svwaitup
was successfully checking it to be up
.I sec
seconds.
.I services
should be designed not to rely on
.B svwaitup
to resolve dependencies.
.P
For each
.I service
that is down and not requested to become up, or that causes an error while
checking (e.g.
.BR runsv (8)
is not running),
.B svwaitup
increases the exit code by one and exits non zero. The maximum is 100.
.P
.B svwaitup
returns 111 on error.
.SH SEE ALSO
svwaitdown(8),
runsv(8),
runsvctrl(8),
runsvstat(8),
runsvdir(8),
runsvchdir(8),
runit(8),
runit-init(8),
supervise(8),
svscan(8)
.P
http://smarden.org/runit/
http://cr.yp.to/daemontools.html
.SH AUTHOR
Gerrit Pape <pape@smarden.org>