local voldev=$(getdev "$@")
local evdata
[ "$voldev" ] || return 2
- local volnum=${voldev#${ubidev}_}
if vol_is_mode $voldev rw ; then
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/$voldev\"}"
- elif vol_is_mode $voldev ro ; then
+ elif vol_is_mode $voldev ro && [ -e "/dev/ubiblock${voldev:3}" ]; then
evdata="{\"name\": \"$1\", \"action\": \"down\", \"device\": \"/dev/ubiblock${voldev:3}\"}"
fi
+ local volnum=${voldev#${ubidev}_}
ubirmvol /dev/$ubidev -n $volnum || return $?
- ubus send block.volume "$evdata"
+ [ "$evdata" ] && ubus send block.volume "$evdata"
}
activatevol() {
# uvol prototype
# future development roadmap (aka. to-do):
# * re-implement in C (use libubox, execve lvm/ubi*)
+# * hash to validate volume while writing
# * add atomic batch processing for use by container/package manager
if [ -z "$1" ]; then cat <<EOF