summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-02-14 16:11:18 +0100
committerRemi Collet <remi@php.net>2025-02-14 16:11:18 +0100
commit2fa59b25089bcaaa48781e636e58c4d6b184f49a (patch)
treea82b0052739c961a7516272e36ce07006d9463b0
parentea0d9b9cb6c8b98edbff4f6f5c2fbcf9e136c27e (diff)
F42: workaround /usr/sbin merged in /usr/bin
add unit-debug service F42: workaround /usr/sbin merged in /usr/bin add unit-debug service
-rw-r--r--unit-debug.service26
-rw-r--r--unit.init88
-rw-r--r--unit.spec17
3 files changed, 39 insertions, 92 deletions
diff --git a/unit-debug.service b/unit-debug.service
new file mode 100644
index 0000000..12ec3db
--- /dev/null
+++ b/unit-debug.service
@@ -0,0 +1,26 @@
+# Modifying this file in-place is not recommended, because changes
+# will be overwritten during package upgrades. To customize the
+# behaviour, run "systemctl edit unit-debug" to create an override unit.
+
+# For example, to change options given to the unitd binary at startup,
+# create an override unit (as is done by systemctl edit) and enter
+# the following:
+
+# [Service]
+# Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid"
+
+[Unit]
+Description=NGINX Unit
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Type=simple
+Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /run/unit/unit.pid"
+ExecStart=/usr/sbin/unitd-debug $UNITD_OPTIONS --no-daemon
+ExecReload=
+RuntimeDirectory=unit
+RuntimeDirectoryMode=0755
+
+[Install]
+WantedBy=multi-user.target
diff --git a/unit.init b/unit.init
deleted file mode 100644
index e1aacd8..0000000
--- a/unit.init
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-#
-# unitd NGINX Unit
-#
-# chkconfig: - 86 14
-# description: NGINX Unit
-
-### BEGIN INIT INFO
-# Provides: unitd
-# Required-Start: $local_fs $network $named $syslog
-# Required-Stop: $local_fs $network $named $syslog
-# Default-Start:
-# Default-Stop: 0 1 2 3 4 5 6
-# Short-Description: NGINX Unit
-# Description: NGINX Unit
-### END INIT INFO
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-exec="/usr/sbin/unitd"
-prog="unitd"
-
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
-
-lockfile=/var/lock/subsys/$prog
-
-start() {
- [ -x $exec ] || exit 5
- echo -n $"Starting $prog: "
- daemon $exec $UNITD_OPTIONS
- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
-}
-
-stop() {
- echo -n $"Stopping $prog: "
- killproc $prog
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
-}
-
-restart() {
- stop
- start
-}
-
-rh_status() {
- status $prog
-}
-
-rh_status_q() {
- rh_status &>/dev/null
-}
-
-
-case "$1" in
- start)
- rh_status_q && exit 0
- $1
- ;;
- stop)
- rh_status_q || exit 0
- $1
- ;;
- restart)
- $1
- ;;
- reload|force-reload)
- echo "Not implemented." >&2
- exit 1
- ;;
- status)
- rh_status
- ;;
- condrestart|try-restart)
- rh_status_q || exit 0
- restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
- exit 2
-esac
-exit $?
diff --git a/unit.spec b/unit.spec
index 0aab43a..5ec0d57 100644
--- a/unit.spec
+++ b/unit.spec
@@ -23,7 +23,7 @@
Name: unit
Summary: NGINX Unit application server
Version: 1.34.1
-Release: 1%{?dist}
+Release: 2%{?dist}
# unit is Apache-2.0
# rust libraries are Apache-2.0 or MIT
License: Apache-2.0 AND MIT
@@ -31,7 +31,7 @@ URL: https://unit.nginx.org/
Source0: https://github.com/%{gh_owner}/%{project}/archive/%{gh_commit}/%{project}-%{version}-%{gh_short}.tar.gz
Source1: unit.service
-Source2: unit.init
+Source2: unit-debug.service
Source3: unit.sysconf
Source4: unit.logrotate
# awfull hack, use a bundled rust registry
@@ -126,6 +126,7 @@ grep -h rust-version mycargo/*/Cargo.toml src/otel/Cargo.toml | sort -u | tail -
unitconf() {
./configure \
--libdir=%{_libdir} \
+ --sbindir=%{_sbindir} \
--prefix=%{_prefix} \
--statedir=%{_sharedstatedir}/unit \
--control="unix:/run/unit/control.sock" \
@@ -182,7 +183,10 @@ install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# init scripts
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
+install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}-debug.service
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d
+# relocate when sbindir is /usr/bin
+sed -e 's:/usr/sbin:%{_sbindir}:' -i %{buildroot}%{_unitdir}/*.service
%if %{with wasm}
mkdir -p %{buildroot}%{_includedir}/unit/
@@ -245,8 +249,9 @@ BANNER
%{_mandir}/man8/unitd.8*
%dir %{_sysconfdir}/systemd/system/%{name}.service.d
-%{_unitdir}/unit.service
-%dir %attr(0755,root,root) %ghost /run/unit
+%{_unitdir}/%{name}.service
+%{_unitdir}/%{name}-debug.service
+%dir %attr(0755,root,root) %ghost /run/%{name}
%files devel
@@ -263,6 +268,10 @@ BANNER
%changelog
+* Fri Feb 14 2025 Remi Collet <remi@remirepo.net> - 1.34.1-2
+- F42: workaround /usr/sbin merged in /usr/bin
+- add unit-debug service
+
* Mon Jan 13 2025 Remi Collet <remi@remirepo.net> - 1.34.1-1
- update to 1.34.1