return null;
let tmp = lvm("pvs", "-o", "vg_name", "-S", sprintf("\"pv_name=~^/dev/%s.*\$\"", rootdev));
- if (tmp.report.pv)
+ if (tmp.report.pv[0])
return tmp.report.pv[0].vg_name;
else
return null;
function lvm_init(ctx) {
cursor = ctx.cursor;
fs = ctx.fs;
-// if (!fs.access(lvm_exec, "x"))
-// return false;
+ if (type(fs.access) == "function" && !fs.access(lvm_exec, "x"))
+ return false;
vg_name = pvs();
if (!vg_name)
status volname return status of volume
return code: 0 - volume is ready for use
1 - volume is not ready for use
- 2 - volume doesn'y exist
+ 2 - volume doesn't exist
write volname size write to volume from stdin, size in bytes
";
out += "\n";
}
} else if (type(var) == "object") {
- out += join(" ", values(line));
+ out += join(" ", values(var));
+ out += "\n";
+ } else if (type(var) == "string") {
+ out += var;
out += "\n";
}
return out;
};
-if (type(backend[cmd]) == "string") {
- printf("%s\n", backend[cmd]);
-} else if (type(backend[cmd]) == "function") {
+if (type(backend[cmd]) == "function") {
let ret = backend[cmd](...ARGV);
- if (type(ret) == "int")
+ if (type(ret) == "int") {
exit(ret);
-
- if (type(ret) == "string") {
- printf("%s\n", ret);
} else {
if (json_output)
printf("%.J\n", ret);