procd: procd.sh: make no assumptions about init script path
authorJo-Philipp Wich <jo@mein.io>
Thu, 20 Aug 2020 14:17:34 +0000 (16:17 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 21 Feb 2024 21:31:36 +0000 (22:31 +0100)
commit82a8b4e0e23ae555d70a1e48e65902aeff2dd1e3
treef6f982f2775bb411d22ddd10a95250d82547b3ce
parent2a752ff0281a0a060175f660895630804e2b95b7
procd: procd.sh: make no assumptions about init script path

Init scripts in /etc/init.d/ may be symlinks pointing elsewhere, so it
is not safe to assume that the basename of the real path is existing.

Instead of trying to reassemble the target path from the basename when
setting up triggers, trust the result of readlink and fall back to
`$initscript` which corresponds to `argv[0]` when readlink failed.

This fixes reload trigger setup for init script symlinks that point
to files with different base names.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
package/system/procd/files/procd.sh