On Tue, 14 Nov 2023 17:41:23 +0300 Michael Tokarev <m...@tls.msk.ru> wrote:
14.11.2023 14:56, Luca Boccassi wrote:
> On Mon, 13 Nov 2023 18:42:09 +0300 Michael Tokarev <m...@tls.msk.ru>
> wrote:
..

>> With just dh_installsystemd --no-enable, it is still started.
>> With dh_installsystemd --no-enable --no-start, it is started
>> as well, - apparently because initscript is started.  Also,
>> with --no-enable --no-start, it is not restarted on upgrades
>> if enabled locally.
>>
>> After doing several iterations, I decided to abandon this attempt, -
>> it just does not work, and I've no time to fight with the tools.
>>
>> If someone has a working recipe for all this madness, please
>> share a patch for d/rules.
>>
>> Tagging with "help" for now.
> > Could you please share a branch or a patch with your attempt? What you
> tried should work, but it's hard to say without looking at the
> implementation in details.

Sure thing, it is in current busybox master on salsa, here:

https://salsa.debian.org/installer-team/busybox/-/blob/master/debian/rules#L172

with udhcpd.service & udhcpd.init in the same dir.


That should do:


diff --git a/debian/rules b/debian/rules
index 04018718b..54e5cc225 100755
--- a/debian/rules
+++ b/debian/rules
@@ -175,6 +175,4 @@ execute_before_dh_installinit-indep:
 override_dh_installsystemd-indep:
 # explicitly list all packages with .service files here
        dh_installsystemd -pbusybox-syslogd --name=busybox-klogd
-       dh_installsystemd -pbusybox-syslogd
-# the following does not work (see #1039142 for details):
-#      dh_installsystemd -pudhcpd --no-enable --no-start
+       dh_installsystemd -pudhcpd --no-enable
diff --git a/debian/udhcpd.service b/debian/udhcpd.service
index 0cdc24bc7..0d01d9722 100644
--- a/debian/udhcpd.service
+++ b/debian/udhcpd.service
@@ -1,7 +1,7 @@
 [Unit]
 Description=Busybox udhcpd DHCP daemon
 Documentation=man:udhcpd(8)
-After=syslog.service network.target
+After=network.target

 [Service]
 Environment=DHCPD_OPTS="-S"



Only "--no-enable" is necessary. disabled services won't be (re)started.
Once enabled by the user, future package upgrades will restart the service.

I've also dropped After=syslog.service as syslog is socket activated by default, so this is not necessary.


root@pluto:~# apt install /tmp/udhcpd_1.36.1-5_all.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'udhcpd' instead of '/tmp/udhcpd_1.36.1-5_all.deb'
The following NEW packages will be installed:
  udhcpd
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/12.4 kB of archives.
After this operation, 51.2 kB of additional disk space will be used.
Get:1 /tmp/udhcpd_1.36.1-5_all.deb udhcpd all 1:1.36.1-5 [12.4 kB]
Retrieving bug reports... Done
Parsing Found/Fixed information... Done
Selecting previously unselected package udhcpd.
(Reading database ... 403057 files and directories currently installed.)
Preparing to unpack /tmp/udhcpd_1.36.1-5_all.deb ...
Unpacking udhcpd (1:1.36.1-5) ...
Setting up udhcpd (1:1.36.1-5) ...
udhcpd.service is a disabled or a static unit, not starting it.
Processing triggers for man-db (2.12.0-1) ...

root@pluto:~# systemctl status udhcpd.service
○ udhcpd.service - Busybox udhcpd DHCP daemon
Loaded: loaded (/usr/lib/systemd/system/udhcpd.service; disabled; preset: enabled)
     Active: inactive (dead)
       Docs: man:udhcpd(8)



Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to