From: Daniel Golle Date: Mon, 4 Apr 2022 10:57:29 +0000 (+0100) Subject: uvol: yet another small compatibility hack X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=31f02d5c1e1fcad0205ac814f52014ed8906db79;p=openwrt-packages.git uvol: yet another small compatibility hack Shift ARGV until actual parameters start to compensate for older versions of ucode passing the complete cmdline. Signed-off-by: Daniel Golle --- diff --git a/utils/uvol/files/uvol b/utils/uvol/files/uvol index 6a5a82c13..a4f023ffd 100644 --- a/utils/uvol/files/uvol +++ b/utils/uvol/files/uvol @@ -64,7 +64,18 @@ if (!backend) { exit(2); } -let cmd = shift(ARGV); +// The below code is needed as older versions of ucode pass the complete cmdline via ARGV +// Once we can rely in more recent ucode the while loop can be replaced by simply +// let cmd = shift(ARGV); +let skip = null; +let cmd = null; +let skip_argv = ["/usr/bin/ucode", "-R", "/usr/sbin/uvol"]; +while (skip = shift(ARGV)) { + if (skip != shift(skip_argv)) { + cmd = skip; + break; + } +} if (!cmd || cmd == "-h" || cmd == "help") { printf("%s", help_output);