Bash might be smarter, but POSIX-compliant shells like Dash aren't, $command_args doesn't expand correctly in Dash, and removing the quotes in the checkconf() function fixes this.
Output:
❯ sudo rc-service bpftune checkconf
bpftune |/usr/sbin/bpftune: invalid option -- ' '
bpftune |unrecognized option '-S'
bpftune |Usage: /usr/sbin/bpftune [OPTIONS]
bpftune | OPTIONS := { { -a|--allow tuner}
bpftune | { -d|--debug} {-D|--daemon}
bpftune | { -c|--cgroup cgroup_path}
bpftune | { -L|--legacy}
bpftune | { -h|--help}}
bpftune | { -l|--libdir library_path}
bpftune | { -p|--port port}
bpftune | { -q|--query query}
bpftune | { -r|--learning_rate learning_rate}
bpftune | { -R|--rollback}
bpftune | { -s|--stderr}
bpftune | { -S|--suppport}
bpftune | { -V|--version}}
Fix:
#!/sbin/openrc-run
# SPDX-License-Identifier: GPL-2.0-or-later
description="BPF-based auto-tuning of system parameters"
command="/usr/sbin/bpftune"
: "${command_args:=-R -c /sys/fs/cgroup}"
extra_commands="checkconf"
supervisor=supervise-daemon
depend() {
need cgroups sysctl net
}
checkconf() {
"${command}" -S $command_args 2>&1
}
start_pre() {
checkconf > /dev/null 2>&1
}
Bash might be smarter, but POSIX-compliant shells like Dash aren't,
$command_argsdoesn't expand correctly in Dash, and removing the quotes in thecheckconf()function fixes this.Output:
Fix: