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>
Sun, 26 Jan 2025 13:07:08 +0000 (14:07 +0100)
commit9e88c2e03968ffc8d0c930073662b2840936e67e
tree245201c881d3d0dfa8d85215c16f48baa111d57c
parent6f7c6234b2df639525e03b6f3663ff6f049abaed
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