uvol: unbreak build and adapt to updated ucode

* Fix build which was broken by a wrong path in the Makefile.

Adapt to ucode commit 4618807 ("main: rework CLI frontend"):
 * ucode now no longer needs the {% %} around each code file, remove
   that and safe one level of indentation.
 * ARGV now no longer includes ucode executable and script itself

Fixes: 6350c7bc6 ("uvol: replace with re-write in ucode")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2022-03-31 21:41:17 +01:00
parent 8324c1fe06
commit 22d202e3a5
No known key found for this signature in database
GPG Key ID: 5A8F39C31C3217CA
6 changed files with 932 additions and 943 deletions

View File

@ -67,7 +67,7 @@ define Package/autopart/install
endef
define Package/uvol/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/uvol/backends $(1)/usr/sbin $(1)/etc/uci-defaults
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/lib/uvol/backends $(1)/usr/sbin $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/uvol.init $(1)/etc/init.d/uvol
$(INSTALL_DATA) ./files/blockdev_common.uc $(1)/usr/lib/uvol/
$(INSTALL_DATA) ./files/uci.uc $(1)/usr/lib/uvol/

View File

@ -1,6 +1,6 @@
{%
// SPDX-License-Identifier: GPL-2.0-or-later
// Helper functions used to identify the boot device
// adapted from /lib/functions.sh
let cmdline_get_var = function(var) {
let cmdline = fs.open("/proc/cmdline", "r");
@ -78,6 +78,7 @@
ord(bduuid, 7), ord(bduuid, 6),
ord(bduuid, 8), ord(bduuid, 9),
ord(bduuid, 10), ord(bduuid, 11), ord(bduuid, 12), ord(bduuid, 13), ord(bduuid, 14), ord(bduuid, 15));
if (uuidarg == uuid) {
uevent = sprintf("/sys/class/block/%s/uevent", bd);
break;
@ -120,4 +121,3 @@
blockdev_common = {};
blockdev_common.get_partition = get_partition;
blockdev_common.get_bootdev = get_bootdev;
%}

View File

@ -1,4 +1,3 @@
{%
// SPDX-License-Identifier: GPL-2.0-or-later
// LVM2 backend for uvol
// (c) 2022 Daniel Golle <daniel@makrotopia.org>
@ -464,4 +463,3 @@
backend.create = lvm_create;
backend.remove = lvm_remove;
backend.write = lvm_write;
%}

View File

@ -1,4 +1,3 @@
{%
// SPDX-License-Identifier: GPL-2.0-or-later
// UBI backend for uvol
// (c) 2022 Daniel Golle <daniel@makrotopia.org>
@ -375,4 +374,3 @@
backend.create = ubi_create;
backend.remove = ubi_remove;
backend.write = ubi_write;
%}

View File

@ -1,4 +1,3 @@
{%
// SPDX-License-Identifier: GPL-2.0-or-later
// UCI tools for uvol
// (c) 2022 Daniel Golle <daniel@makrotopia.org>
@ -136,4 +135,3 @@ uvol_uci = {
return 0;
}
};
%}

View File

@ -1,13 +1,9 @@
#!/usr/bin/ucode
{%
// SPDX-License-Identifier: GPL-2.0-or-later
// uvol - storage volume manager for OpenWrt
// (c) 2022 Daniel Golle <daniel@makrotopia.org>
function help() {
%}
uvol storage volume manager
let help_output = "uvol storage volume manager
syntax: uvol command ...
commands:
@ -29,8 +25,11 @@ commands:
1 - volume is not ready for use
2 - volume doesn'y exist
write volname size write to volume from stdin, size in bytes
{%
}
"
function help() {
printf("%s", help_output);
);
let fs = require("fs");
let uci = require("uci");
@ -56,7 +55,6 @@ commands:
type(current_backend.priority) == "int" &&
backend.priority > current_backend.priority)
continue;
if (type(current_backend.init) == "function" &&
current_backend.init(ctx)) {
backend = current_backend;
@ -70,8 +68,6 @@ commands:
exit(2);
}
shift(ARGV);
shift(ARGV);
let cmd = shift(ARGV);
if (!cmd || cmd == "-h" || cmd == "help") {
@ -126,5 +122,4 @@ commands:
printf("%s\n", legacy_output(backend[cmd]));
}
return 0;
%}
exit(0);