Skip to content

Problem with the OpenRC init script #242

Description

@Wizarsy

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions