Files
packages/utils/uvol/Makefile
T
Daniel Golle cb60600aec uvol: bump version to 1.1
manage volume state over ubus instead of the rootfs

Rework the volume lifecycle around blockd's ubus API, so volume state
lives entirely on the self-describing LVM/UBI backing store and never
leaks into the firmware rootfs.

- register active volumes with blockd over ubus (mount.uc) instead of
  spooling mounts into /etc/config/fstab (uci.uc)

- bootstrap .meta from 'uvol boot' and drop the broken 90-uvol-init
  uci-default

- run 'uvol boot' straight from the mount.ready trigger, and query
  'ubus call block status' at service start to cover storage already
  being ready

- defer removal of a volume whose backing device is still held, and
  reap it from the mount.umount trigger once it is free

- enforce content-addressed "<algo>-<hexdigest>" volumes in the
  dispatcher: reuse an existing volume of the same digest, verify
  every write

- verify a content-addressed write in place while the volume is still
  incomplete, reporting EBADMSG on mismatch instead of flipping
  volume state

- purge incomplete wo/wp leftovers on boot and reclaim an exactly
  matching one on create

- serialise mutating commands with a device-wide lock, plus a
  per-volume lock ordered after it so a slow write cannot stall other
  volumes

- add a grow-only 'resize' verb to both backends: lvextend plus the
  matching fs-grow tool for lvm, ubirsvol for ubi

- create ext4 volumes with a journal (was ext2) and request check_fs
  when registering a read-write volume

- declare read-only mounts to blockd rather than letting block guess
  from the filesystem

- reject non-numeric and non-positive sizes in create and resize

- report its own version

- simplify command line parsing (drop compatibility with ancient ucode)

Requires the matching fstools changes from
openwrt/openwrt@9b11fa4088.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-07-25 23:53:57 +01:00

82 lines
2.2 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=uvol
PKG_VERSION:=1.1
PKG_RELEASE:=1
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=GPL-2.0-or-later
include $(INCLUDE_DIR)/package.mk
define Package/autopart
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Disc
TITLE:=Automatically initialize LVM partition
DEPENDS:=+lvm2 +partx-utils +sfdisk +e2fsprogs +mkf2fs +f2fsck
PKGARCH=all
endef
define Package/autopart/description
Automatically allocate and initialize a partition for LVM on first boot.
endef
define Package/uvol
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Disc
TITLE:=OpenWrt UBI/LVM volume abstraction
DEPENDS:=+blockd +ucode +ucode-mod-fs +ucode-mod-math +ucode-mod-uci +ucode-mod-ubus
PKGARCH=all
endef
define Package/uvol/description
'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
top of them.
Also install the 'autopart' package to easily make use of 'uvol' on
block-storage based devices.
Examples:
uvol create example_volume_1 268435456 rw
uvol up example_volume_1
uvol device example_volume_1
uvol create example_volume_2 9812733 ro
cat example_volume_2.squashfs | uvol write example_volume_2 9812733
uvol up example_volume_2
uvol device example_volume_2
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/autopart/install
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/autopart.defaults $(1)/etc/uci-defaults/30-autopart
endef
define Package/uvol/install
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/lib/uvol/backends $(1)/usr/sbin
$(INSTALL_BIN) ./files/uvol.init $(1)/etc/init.d/uvol
$(INSTALL_DATA) ./files/blockdev_common.uc $(1)/usr/lib/uvol/
$(INSTALL_DATA) ./files/mount.uc $(1)/usr/lib/uvol/
$(INSTALL_DATA) ./files/lvm.uc $(1)/usr/lib/uvol/backends/
$(INSTALL_DATA) ./files/ubi.uc $(1)/usr/lib/uvol/backends/
$(INSTALL_BIN) ./files/uvol $(1)/usr/sbin
$(SED) 's/@PKG_VERSION@/$(PKG_VERSION)/g' $(1)/usr/sbin/uvol
endef
$(eval $(call BuildPackage,autopart))
$(eval $(call BuildPackage,uvol))