4 # future development roadmap (aka. to-do):
5 # * re-implement in C (use libubox, execve lvm/ubi*)
6 # * hash to validate volume while writing
7 # * add atomic batch processing for use by container/package manager
9 if [ -z "$1" ]; then cat <<EOF
10 uvol storage volume manager
12 syntax: uvol command ...
15 boot get active volumes ready (called on boot)
16 free show number of bytes available
17 total show total number of bytes
18 align show sector size in bytes
19 list [volname] list volumes
20 create volname size type create new volume
23 remove volname delete volume
24 device volname show block device for mounting
25 size volname show size of volume
26 up volname get volume ready for mounting
27 down volname take volume down after unmounting
28 status volname return status of volume
29 return code: 0 - volume is ready for use
30 1 - volume is not ready for use
31 2 - volume doesn'y exist
32 write volname size write to volume from stdin, size in bytes
40 for backend
in /usr
/libexec
/uvol
/*.sh
; do
41 total
=$
($backend total
)
42 backends_tried
="$backends_tried $($backend name)"
43 [ "$total" ] && uvol_backend
=$backend
46 if [ -z "$uvol_backend" ]; then
47 echo "No backend available. (tried:$backends_tried)"
48 echo "To setup devices with block storage install 'autopart'."
52 flock
-x /tmp
/run
/uvol.lock
"$uvol_backend" "$@"