snapos icon indicating copy to clipboard operation
snapos copied to clipboard

openwrt: convert to procd

Open xabolcs opened this issue 5 years ago • 17 comments
trafficstars

procd is the new process management daemon and supports a new style init script.

xabolcs avatar Mar 04 '20 23:03 xabolcs

I tested only the snapclient.init part.

xabolcs avatar Mar 05 '20 00:03 xabolcs

After commit badaix/snapcast@a2311dfbfd1c06451ece242b7ff65a09f660f9e8 I'm wondering how to take the logging defaults into account from /etc/default/snap{client,server} in the init files.

procd have to run the programs in foreground. Therefore I have to set the logging sink to system (and also wipe out all -d and --daemon argument from SNAPSERVER_OPTS).

Should I override it like the --daemon? Should I create a patches directory and patch debian/snap{client,server}.default to add the log sink param to SNAPSERVER_OPTS?

xabolcs avatar May 01 '20 21:05 xabolcs

... I'm wondering how to take the logging defaults into account ...

I decided to override them with --logging.sink system and --logsink system.

Filtering out -d and --daemon is still TODO.

xabolcs avatar May 10 '20 20:05 xabolcs

Is it recommended by OpenWRT to migrate to procd? And yes: using system as log sink is the proper way, what about -d? Is it set somewhere?

badaix avatar May 14 '20 14:05 badaix

As this is the new init format, I think it's recommended. Just see the related commits in openwrt/packages repository! I have to mention that I was unable to find an explicit recommendation on OpenWrt Wiki or in CONTRIBUTING.md.

I want the -d filter stuff because the old behavior automatically adds it to the options:

SNAPCLIENT_OPTS="-d $SNAPCLIENT_OPTS"

In turn, it forces to daemonize the process.

That's why I want to force running the process in the foreground ...

xabolcs avatar May 14 '20 14:05 xabolcs

With the upcoming v0.21 version is it feasible to refresh this PR and upstream Snapcast to OpenWrt Packages?

xabolcs avatar Aug 19 '20 19:08 xabolcs

Hi, the fork of 21.0x already happened, maybe we can still upstream this into OpenWRT packages? is there any argument against it? I'd love to help.

db4rne avatar Mar 11 '21 13:03 db4rne

I have started to include this into openwrt, if any of you would like to test and/or change something please contact me. you can find my branch for the snapcast package here: https://github.com/db4rne/packages/tree/snapcast

it's just the makefile from this repo (changed for version 0.24), and the procd-scripts from this PR.

db4rne avatar Apr 02 '21 20:04 db4rne

@db4rne , it would be nice to include it in OpenWrt Packages repo.

I think, this PR is ready to use.

xabolcs avatar Jul 23 '21 23:07 xabolcs

master updated to v0.27.0, but develop was left behind. Should I re-target the PR?

xabolcs avatar Feb 05 '23 12:02 xabolcs

Retargeted the PR to master.

xabolcs avatar Feb 16 '23 15:02 xabolcs

@xabolcs With https://github.com/badaix/snapos/pull/29, snapcast can be built again for OpenWRT 23.05 and current SNAPSHOT.

Have you tried this PR with OpenWRT 23.05 yet ?

I am keen to help test this PR on OpenWRT snapshot.

davidandreoletti avatar Mar 29 '24 11:03 davidandreoletti

Is it recommended by OpenWRT to migrate to procd?

@badaix Yes, procd is THE startup/process management facility for OpenWRT.

davidandreoletti avatar Mar 29 '24 11:03 davidandreoletti

Have you tried this PR with OpenWRT 23.05 yet ?

I tried this PR long time ago, because of the debian files. But I use the init files directly with OpenWrt SNAPSHOT and 23.05.

xabolcs avatar Mar 29 '24 11:03 xabolcs

But I use the init files

@xabolcs Do you mean the init files using procd (from this PR) were copied to your OpenWRT 23.05/snapshot device and are working as intended ?

davidandreoletti avatar Mar 29 '24 14:03 davidandreoletti

Yup!

Just save those init files as /etc/init.d/snap{client,server} and they will be ready to use.

xabolcs avatar Mar 30 '24 09:03 xabolcs

@xabolcs Thanks!

@badaix: @xabolcs confirmed the procd enabled init files in this PR are working on the latest OpenWRT stable and snapshot release.

Benefits for snapcast: better integration with OpenWRT's system service

  • enabling auto start after boot
  • auto restart the snapcast binaries upon crash (happens on v0.28.beta1)
  • running status
  • restart,
  • etc

Would you mind merging this PR please ?

davidandreoletti avatar Mar 30 '24 15:03 davidandreoletti

@badaix This PR will take 4 min of your time max to review its usefullness/merge.

davidandreoletti avatar Apr 09 '24 17:04 davidandreoletti