cs/device
This commit is contained in:
parent
e0ba419f2a
commit
f4f1aeaccf
1 changed files with 13 additions and 1 deletions
|
@ -29,7 +29,19 @@ rwx_crypt() {
|
||||||
case "${action}" in
|
case "${action}" in
|
||||||
"${action_open}")
|
"${action_open}")
|
||||||
rwx_log_info "OPEN"
|
rwx_log_info "OPEN"
|
||||||
# TODO find next available device
|
local nbd_device nbd_size
|
||||||
|
local nbd_index=0
|
||||||
|
while [ -z "${nbd_device}" ]; do
|
||||||
|
if [ -f "/dev/nbd${nbd_index}" ]; then
|
||||||
|
nbd_size="$(cat /sys/block/nbd"${nbd_index}/size")"
|
||||||
|
[ "${nbd_size}" -eq 0 ] &&
|
||||||
|
nbd_device="/dev/nbd${nbd_index}"
|
||||||
|
fi
|
||||||
|
nbd_index=$((nbd_index + 1))
|
||||||
|
done
|
||||||
|
[ -z "${nbd_device}" ] &&
|
||||||
|
rwx_log_error 4 "No device available"
|
||||||
|
rwx_log_info "device: ${nbd_device}"
|
||||||
# TODO connect device
|
# TODO connect device
|
||||||
# TODO open device
|
# TODO open device
|
||||||
echo "${pass_phrase}"
|
echo "${pass_phrase}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue