Splux Linux

source-based Linux using SPS

sps-core · log · files · refs · tags · releases · people · languages · GitHub · commit

55125c3


core: ship dbus, sshd, and dhcpcd units for both inits

Date
Commit55125c3c88f2e2f06d17281a159b1e6774685c0c
GitHubmirror

Parents

Stat

 libs/dbus/files/dbus.service    | 14 ++++++++++++++
 libs/dbus/files/openrc-dbus     | 15 +++++++++++++++
 libs/dbus/hooks/post-install    |  5 +++++
 libs/dbus/recipe                |  5 ++++-
 net/dhcpcd/files/dhcpcd.service | 12 ++++++++++++
 net/dhcpcd/files/openrc-dhcpcd  | 10 ++++++++++
 net/dhcpcd/hooks/post-install   |  5 +++++
 net/dhcpcd/recipe               |  5 ++++-
 net/openssh/files/openrc-sshd   | 18 ++++++++++++++++++
 net/openssh/files/sshd.service  | 11 +++++++++++
 net/openssh/hooks/post-install  |  5 +++++
 net/openssh/recipe              |  5 ++++-
 12 files changed, 107 insertions(+), 3 deletions(-)

Diff

diff --git a/libs/dbus/files/dbus.service b/libs/dbus/files/dbus.service
new file mode 100644
index 0000000..11cf4f2
--- /dev/null
+++ b/libs/dbus/files/dbus.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=D-Bus System Message Bus
+Documentation=man:dbus-daemon(1)
+DefaultDependencies=no
+After=local-fs.target
+
+[Service]
+ExecStartPre=/bin/mkdir -p /run/dbus
+ExecStart=/usr/bin/dbus-daemon --system --nofork --nopidfile --nosyslog
+ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/libs/dbus/files/openrc-dbus b/libs/dbus/files/openrc-dbus
new file mode 100644
index 0000000..48bd671
--- /dev/null
+++ b/libs/dbus/files/openrc-dbus
@@ -0,0 +1,15 @@
+#!/sbin/openrc-run
+description="D-Bus system message bus"
+command="/usr/bin/dbus-daemon"
+command_args="--system --nofork --nopidfile --nosyslog"
+command_background="yes"
+pidfile="/run/dbus/dbus.pid"
+
+depend() {
+	need localmount
+	provide dbus
+}
+
+start_pre() {
+	mkdir -p /run/dbus /var/lib/dbus
+}
diff --git a/libs/dbus/hooks/post-install b/libs/dbus/hooks/post-install
new file mode 100644
index 0000000..537437f
--- /dev/null
+++ b/libs/dbus/hooks/post-install
@@ -0,0 +1,5 @@
+# Enable this package's service for the init recorded in $SPS_ROOT/etc/sps/init.
+[ -n "${SPS_LIBDIR-}" ] && [ -f "$SPS_LIBDIR/setup/service.sh" ] || exit 0
+# shellcheck disable=SC1091
+. "$SPS_LIBDIR/setup/service.sh"
+setup_service_hook_enable || :
diff --git a/libs/dbus/recipe b/libs/dbus/recipe
index 81a8f76..9125aac 100644
--- a/libs/dbus/recipe
+++ b/libs/dbus/recipe
@@ -1,6 +1,6 @@
 name        dbus
 version     1.16.2
-release     1
+release     2
 description dbus: message bus
 
 source      https://dbus.freedesktop.org/releases/dbus/dbus-1.16.2.tar.xz
@@ -12,3 +12,6 @@ depend      expat
 configure   meson setup build --prefix=/usr --buildtype=release -Dsystemd=disabled -Dselinux=disabled
 build       meson compile -C build
 install     DESTDIR="$PKG" meson install -C build --no-rebuild
+install     mkdir -p "$PKG/usr/lib/systemd/system" "$PKG/etc/init.d"
+install     install -m 0644 "$SRC/files/dbus.service" "$PKG/usr/lib/systemd/system/dbus.service"
+install     install -m 0755 "$SRC/files/openrc-dbus" "$PKG/etc/init.d/dbus"
diff --git a/net/dhcpcd/files/dhcpcd.service b/net/dhcpcd/files/dhcpcd.service
new file mode 100644
index 0000000..1534c40
--- /dev/null
+++ b/net/dhcpcd/files/dhcpcd.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=DHCP Client Daemon
+After=network-pre.target
+Wants=network.target
+Before=network.target
+
+[Service]
+ExecStart=/usr/sbin/dhcpcd --nobackground
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net/dhcpcd/files/openrc-dhcpcd b/net/dhcpcd/files/openrc-dhcpcd
new file mode 100644
index 0000000..64a6b93
--- /dev/null
+++ b/net/dhcpcd/files/openrc-dhcpcd
@@ -0,0 +1,10 @@
+#!/sbin/openrc-run
+description="DHCP client"
+command="/usr/sbin/dhcpcd"
+command_args="--nobackground"
+command_background="yes"
+pidfile="/run/dhcpcd.pid"
+
+depend() {
+	provide net
+}
diff --git a/net/dhcpcd/hooks/post-install b/net/dhcpcd/hooks/post-install
new file mode 100644
index 0000000..537437f
--- /dev/null
+++ b/net/dhcpcd/hooks/post-install
@@ -0,0 +1,5 @@
+# Enable this package's service for the init recorded in $SPS_ROOT/etc/sps/init.
+[ -n "${SPS_LIBDIR-}" ] && [ -f "$SPS_LIBDIR/setup/service.sh" ] || exit 0
+# shellcheck disable=SC1091
+. "$SPS_LIBDIR/setup/service.sh"
+setup_service_hook_enable || :
diff --git a/net/dhcpcd/recipe b/net/dhcpcd/recipe
index bda9b9b..e9b23c6 100644
--- a/net/dhcpcd/recipe
+++ b/net/dhcpcd/recipe
@@ -1,6 +1,6 @@
 name        dhcpcd
 version     10.2.4
-release     1
+release     2
 description dhcpcd: DHCP client
 
 source      https://github.com/NetworkConfiguration/dhcpcd/archive/refs/tags/v10.2.4.tar.gz
@@ -11,3 +11,6 @@ depend      filesystem
 configure   ./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib/dhcpcd --dbdir=/var/lib/dhcpcd
 build       make -j"$MAKEJOBS"
 install     make install DESTDIR="$PKG"
+install     mkdir -p "$PKG/usr/lib/systemd/system" "$PKG/etc/init.d"
+install     install -m 0644 "$SRC/files/dhcpcd.service" "$PKG/usr/lib/systemd/system/dhcpcd.service"
+install     install -m 0755 "$SRC/files/openrc-dhcpcd" "$PKG/etc/init.d/dhcpcd"
diff --git a/net/openssh/files/openrc-sshd b/net/openssh/files/openrc-sshd
new file mode 100644
index 0000000..8c8ec2c
--- /dev/null
+++ b/net/openssh/files/openrc-sshd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+description="OpenSSH server"
+command="/usr/sbin/sshd"
+command_args="-D"
+command_background="yes"
+pidfile="/run/sshd.pid"
+
+depend() {
+	use net
+	after net
+}
+
+start_pre() {
+	if command -v ssh-keygen >/dev/null 2>&1; then
+		ssh-keygen -A
+	fi
+	mkdir -p /var/lib/sshd
+}
diff --git a/net/openssh/files/sshd.service b/net/openssh/files/sshd.service
new file mode 100644
index 0000000..a6a2d33
--- /dev/null
+++ b/net/openssh/files/sshd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenSSH server daemon
+After=network.target
+
+[Service]
+ExecStartPre=/bin/sh -c 'if command -v ssh-keygen >/dev/null 2>&1; then ssh-keygen -A; fi'
+ExecStart=/usr/sbin/sshd -D
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net/openssh/hooks/post-install b/net/openssh/hooks/post-install
new file mode 100644
index 0000000..537437f
--- /dev/null
+++ b/net/openssh/hooks/post-install
@@ -0,0 +1,5 @@
+# Enable this package's service for the init recorded in $SPS_ROOT/etc/sps/init.
+[ -n "${SPS_LIBDIR-}" ] && [ -f "$SPS_LIBDIR/setup/service.sh" ] || exit 0
+# shellcheck disable=SC1091
+. "$SPS_LIBDIR/setup/service.sh"
+setup_service_hook_enable || :
diff --git a/net/openssh/recipe b/net/openssh/recipe
index 12c3c1d..df280ad 100644
--- a/net/openssh/recipe
+++ b/net/openssh/recipe
@@ -1,6 +1,6 @@
 name        openssh
 version     10.5p1
-release     1
+release     2
 description OpenSSH: remote login client and server
 
 source      https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${version}.tar.gz
@@ -13,3 +13,6 @@ depend      openssl
 configure   ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-privsep-path=/var/lib/sshd --with-privsep-user=nobody --with-default-path=/usr/bin:/bin --with-superuser-path=/usr/sbin:/usr/bin:/sbin:/bin
 build       make -j"$MAKEJOBS"
 install     make install-nokeys DESTDIR="$PKG" && install -dm700 "$PKG/var/lib/sshd"
+install     mkdir -p "$PKG/usr/lib/systemd/system" "$PKG/etc/init.d"
+install     install -m 0644 "$SRC/files/sshd.service" "$PKG/usr/lib/systemd/system/sshd.service"
+install     install -m 0755 "$SRC/files/openrc-sshd" "$PKG/etc/init.d/sshd"