initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

12
runit/30-sysctl.hook Normal file
View File

@@ -0,0 +1,12 @@
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = etc/sysctl.d/*.conf
Target = lib/sysctl.d/*.conf
[Action]
Description = Applying kernel sysctl settings...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/runit-hook sysctl
NeedsTargets

105
runit/PKGBUILD Normal file
View File

@@ -0,0 +1,105 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgbase=runit
pkgname=(runit runit-sysvcompat)
pkgver=2.1.2
_debver=$pkgver
_debrel=41
pkgrel=6
pkgdesc="A UNIX init scheme with service supervision"
arch=('i686' 'x86_64')
url='http://smarden.org/runit/'
license=('Modified-BSD')
depends=('runit-init-scripts')
makedepends=('quilt')
source=(${pkgbase}-${pkgver}.tar.gz::https://deb.debian.org/debian/pool/main/r/runit/runit_${pkgver}.orig.tar.gz
https://deb.debian.org/debian/pool/main/r/runit/runit_$_debver-$_debrel.debian.tar.xz
runit-hook
runit-install.hook
runit-remove.hook
30-sysctl.hook
default-directory-for-services.patch)
sha512sums=('a18773ebf1aa22305dd89ed67363165b9fcf86c192b2be4e268d08005dd82d51265160c637abe072f2f2e378c4b315a75bd3d3e602c3e75bdd451a3b0190f8cf'
'913077c52085bdcef3d40d512f662f21c2324ad5e93e5da6c2a3ab41c2d68a277c4d1fc270290d178f0a126a213b3bfd83357b93110de6fb43ceab031b3f04a8'
'81b39ce971c5e1d23a7d6b8da9ae72553682a48a103112741ca78816776692d4db2d296c469acc786ad2eacbd4d149b5320763b35f0f0fa88c489bba08123faa'
'4bdd02170955c07db37f02ba60d6bf3ed8f19f540330ef63db27845314de244bfd56f2e2212d98a1a2d9a9f253fa3bbc99cea47f49eee11f5a5c7e1252be9ef9'
'4438c2cfa2de5ad84d3cd802a63288c43dde08c1f8f42bd92851250303fafc79ce84e1488cac76f86455e428881cf3dc47e2534f8a7e5a07e82f9a5e462c8001'
'2af8331837dd8fcf1af8ed4f97b0c0fab8df8d0eb160ca38a5a1f6f3e7b484385cdc0bb099aa8fc20731903e059d2f30d6490156ccb2fcad9d9a967b954d57c1'
'bb27a8bdfb5e932de138a473fc998acc2cec0799df2ca1bd02e6b521d64a1bcd5dc338b742437cb875bd1ed92c9e00164551a5f80729e592fdd383c6089d8c61')
prepare() {
cd admin
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply
rm -v debian/patches/0001-default-directory-for-services-on-Debian-is-etc-servi.diff || true
quilt push -av
fi
# set default service path to /var/service
cd $pkgbase-$pkgver
patch -p1 -i $srcdir/default-directory-for-services.patch
}
build() {
cd admin/$pkgbase-$pkgver
package/compile
}
package_runit() {
cd admin/$pkgbase-$pkgver
# create folders
install -dm755 $pkgdir/sbin
# commands
install -Dm755 command/* $pkgdir/sbin
# man pages
install -dm755 $pkgdir/usr/share/man/man8
install -Dm644 man/* $pkgdir/usr/share/man/man8
# alpm hooks
install -Dm755 $srcdir/runit-hook $pkgdir/usr/share/libalpm/scripts/runit-hook
install -Dm644 -t $pkgdir/usr/share/libalpm/hooks $srcdir/*.hook
# license
install -Dm644 package/COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
}
package_runit-sysvcompat() {
pkgdesc='SysV-style init compatibility for runit'
depends=('runit')
provides=('sysvinit')
conflicts=('sysvinit')
mkdir -p "${pkgdir}/sbin"
cd "${pkgdir}/sbin"
ln -s runit-init init
for i in halt shutdown; do
ln -s runit-$i $i
done
for i in poweroff reboot; do
ln -s halt $i
done
mkdir -p "${pkgdir}/usr/share/man/man8"
cd "${pkgdir}/usr/share/man/man8"
ln -s runit.8.gz init.8.gz
for i in halt shutdown; do
ln -s runit-$i.1.gz $i.1.gz
done
for i in poweroff reboot; do
ln -s halt.1.gz $i.1.gz
done
# license
install -Dm644 "${srcdir}/admin/${pkgbase}-${pkgver}/package/COPYING" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

View File

@@ -0,0 +1,71 @@
diff --git a/man/runsv.8 b/man/runsv.8
index 7c5abfc..53f1b1b 100644
--- a/man/runsv.8
+++ b/man/runsv.8
@@ -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
+ # sv term /var/service/socklog-unix
or
- # printf t >/service/socklog-unix/supervise/control
+ # printf t >/var/service/socklog-unix/supervise/control
.P
.BR printf (1)
usually blocks if no
diff --git a/man/runsvchdir.8 b/man/runsvchdir.8
index f7f94dc..793d653 100644
--- a/man/runsvchdir.8
+++ b/man/runsvchdir.8
@@ -27,13 +27,13 @@ with a symlink pointing to
.IR dir .
.P
Normally
-.I /service
+.I /var/service
is a symlink to
.IR current ,
and
.BR runsvdir (8)
is running
-.IR /service/ .
+.IR /var/service/ .
.SH EXIT CODES
.B runsvchdir
prints an error message and exits 111 on error.
diff --git a/man/sv.8 b/man/sv.8
index 7ed9852..58f1c07 100644
--- a/man/sv.8
+++ b/man/sv.8
@@ -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 /var/service/ ,
otherwise relative to the current directory.
.P
.I command
@@ -232,7 +232,7 @@ This option implies
.TP
.B SVDIR
The environment variable $SVDIR overrides the default services directory
-.IR /service/ .
+.IR /var/service/ .
.TP
.B SVWAIT
The environment variable $SVWAIT overrides the default 7 seconds to wait
diff --git a/src/sv.c b/src/sv.c
index 0125795..7c6f6ed 100644
--- a/src/sv.c
+++ b/src/sv.c
@@ -32,7 +32,7 @@
char *progname;
char *action;
char *acts;
-char *varservice ="/service/";
+char *varservice ="/var/service/";
char **service;
char **servicex;
unsigned int services;

44
runit/runit-hook Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/sh -e
runit_live() {
if [ ! -L /var/service ]; then
echo >&2 " Skipped: Current root is not booted."
exit 0
fi
}
svc_help(){
echo " ==> Start/stop/restart a service:"
echo " sv <start/stop/restart> <service>"
}
svc_add_help(){
echo " ==> Add a service:"
echo " ln -s /etc/sv/<service> /var/service"
svc_help
}
svc_del_help(){
echo " ==> Remove a service:"
echo " rm /var/service/<service>"
svc_help
}
each_conf() {
while read -r f; do
"$@" "/$f"
done
}
op="$1"; shift
case $op in
sysctl) runit_live; each_conf /sbin/sysctl -q -p ;;
# For use by other packages
reload) runit_live; /usr/bin/sv "$@" reload ;;
add) svc_add_help ;;
del) svc_del_help ;;
*) echo >&2 " Invalid operation '$op'"; exit 1 ;;
esac
exit 0

11
runit/runit-install.hook Normal file
View File

@@ -0,0 +1,11 @@
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = etc/sv/*
[Action]
Description = Displaying runit service help ...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/runit-hook add
NeedsTargets

10
runit/runit-remove.hook Normal file
View File

@@ -0,0 +1,10 @@
[Trigger]
Type = File
Operation = Remove
Target = etc/sv/*
[Action]
Description = Displaying runit service help ...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/runit-hook del
NeedsTargets