From 6276e8b2ae48a094f34de4f46dcf5146fcee81bd Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 15 Aug 2021 04:59:56 +0100 Subject: [PATCH] uvol: update to version 0.4 Create UCI fstab mount sections for existing volumes on firstboot. Introduce special handling for volumes with non-[:alnum:] prefix: - do not create UCI sections for these 'hidden' volumes - create UCI section for '.uxc' special volume with target /var/state/uxc to be used for uxc config. Signed-off-by: Daniel Golle --- utils/uvol/Makefile | 5 +-- utils/uvol/files/common.sh | 49 ++++++++++++++++++--------- utils/uvol/files/lvm.sh | 52 ++++++++++++++++++++++++++--- utils/uvol/files/ubi.sh | 60 ++++++++++++++++++++++++++++++++++ utils/uvol/files/uvol.defaults | 3 ++ 5 files changed, 147 insertions(+), 22 deletions(-) create mode 100644 utils/uvol/files/uvol.defaults diff --git a/utils/uvol/Makefile b/utils/uvol/Makefile index f929ba5154..e988d51682 100644 --- a/utils/uvol/Makefile +++ b/utils/uvol/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uvol -PKG_VERSION:=0.3 +PKG_VERSION:=0.4 PKG_RELEASE:=$(AUTORELEASE) PKG_MAINTAINER:=Daniel Golle @@ -64,12 +64,13 @@ define Package/autopart/install endef define Package/uvol/install - $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/libexec/uvol $(1)/usr/sbin $(1)/lib/functions + $(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/libexec/uvol $(1)/usr/sbin $(1)/lib/functions $(1)/etc/uci-defaults $(INSTALL_BIN) ./files/uvol.init $(1)/etc/init.d/uvol $(INSTALL_BIN) ./files/common.sh $(1)/lib/functions/uvol.sh $(INSTALL_BIN) ./files/ubi.sh $(1)/usr/libexec/uvol/20-ubi.sh $(INSTALL_BIN) ./files/lvm.sh $(1)/usr/libexec/uvol/50-lvm.sh $(INSTALL_BIN) ./files/uvol $(1)/usr/sbin + $(INSTALL_BIN) ./files/uvol.defaults $(1)/etc/uci-defaults/90-uvol-restore-uci endef $(eval $(call BuildPackage,autopart)) diff --git a/utils/uvol/files/common.sh b/utils/uvol/files/common.sh index 0eee6d432f..e3b554e180 100644 --- a/utils/uvol/files/common.sh +++ b/utils/uvol/files/common.sh @@ -11,15 +11,27 @@ uvol_uci_add() { local volname="$1" local devname="$2" local mode="$3" - local autofs uuid uciname + local autofs=0 + local target="/var/run/uvol/$volname" + local uuid uciname - uciname=${volname//-/_} + [ "$mode" = "ro" ] && autofs=1 + uciname="${volname//[-.]/_}" + uciname="${uciname//[!([:alnum:]_)]}" uuid="$(/sbin/block info | grep "^$2" | xargs -n 1 echo | grep "^UUID=.*")" [ "$uuid" ] || return 22 - _uvol_init_spooldir uuid="${uuid:5}" - autofs=0 - [ "$mode" = "ro" ] && autofs=1 + + case "$uciname" in + "_uxc") + target="/var/state/uxc" + ;; + "_"*) + return 1 + ;; + esac + + _uvol_init_spooldir if [ -e "${UCI_SPOOLDIR}/remove-$1" ]; then rm "${UCI_SPOOLDIR}/remove-$1" fi @@ -27,11 +39,10 @@ uvol_uci_add() { cat >"${UCI_SPOOLDIR}/add-$1" <"${UCI_SPOOLDIR}/remove-$1" </dev/null || uvol detect || true