Don't use features which are not yet present in the version of ucode
currently shipped with OpenWrt (such as `fs.access()` or assuming raw
mode by default).
Fix syntax error in main executable.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
(cherry picked from commit
74caff0d5988b721c08b9a8e35bce79a3d167dd6)
endef
define Package/uvol/description
- 'uvol' is tool to automate storage volume handling on embedded
+ 'uvol' is a tool to automate storage volume handling on embedded
devices in a generic way.
Depending on what is available, 'uvol' will use either UBI or LVM2
as storage backends and transparently offer identical operations on
// adapted from /lib/upgrade/common.sh
let get_partition = function(dev, num) {
+ if (!dev)
+ return null;
+
for (let bd in get_blockdevs()) {
let r = get_uevent_major_minor(sprintf("/sys/class/block/%s/uevent", bd));
if (r.major == dev.major && r.minor == dev.minor + num) {
}
include("/usr/lib/uvol/blockdev_common.uc");
let rootdev = blockdev_common.get_partition(blockdev_common.get_bootdev(), 0);
+ if (!rootdev)
+ return null;
+
let tmp = lvm("pvs", "-o", "vg_name", "-S", sprintf("\"pv_name=~^/dev/%s.*\$\"", rootdev));
if (tmp.report.pv)
return tmp.report.pv[0].vg_name;
function lvm_init(ctx) {
cursor = ctx.cursor;
fs = ctx.fs;
- if (!fs.access(lvm_exec, "x"))
- return false;
+// if (!fs.access(lvm_exec, "x"))
+// return false;
vg_name = pvs();
if (!vg_name)
-#!/usr/bin/ucode
+#!/usr/bin/ucode -R
// SPDX-License-Identifier: GPL-2.0-or-later
// uvol - storage volume manager for OpenWrt
// (c) 2022 Daniel Golle <daniel@makrotopia.org>
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");
let cmd = shift(ARGV);
if (!cmd || cmd == "-h" || cmd == "help") {
- help();
+ printf("%s", help_output);
return cmd?0:22;
}