cs/mkdir
This commit is contained in:
parent
930f296dc8
commit
715708dc3d
1 changed files with 10 additions and 5 deletions
|
@ -52,32 +52,37 @@ rwx_crypt() {
|
|||
local device
|
||||
case "${action}" in
|
||||
"${action_open}")
|
||||
# find device
|
||||
if ! device="$(rwx_crypt_device)"; then
|
||||
rwx_log_error 4 "No device available"
|
||||
fi
|
||||
# make directory
|
||||
if ! mkdir --parents "${RWX_CRYPT_VAR}"; then
|
||||
rwx_log_error 5 "Making failure: ${RWX_CRYPT_VAR}"
|
||||
fi
|
||||
# record device
|
||||
if ! rwx_file_write \
|
||||
"${RWX_CRYPT_VAR}/${crypt_arg}" "${device}"; then
|
||||
rwx_log_error 5 "Writing failure: ${device}"
|
||||
rwx_log_error 6 "Writing failure: ${device}"
|
||||
fi
|
||||
# connect device
|
||||
if ! qemu-nbd --connect "${device}" "${crypt_file}"; then
|
||||
rwx_log_error 6 "Connection failure: ${device}"
|
||||
rwx_log_error 7 "Connection failure: ${device}"
|
||||
fi
|
||||
# open device
|
||||
if ! echo "${pass_phrase}" |
|
||||
cryptsetup luksOpen "${device}" "${crypt_arg}"; then
|
||||
rwx_log_error 7 "Opening failure: ${device}"
|
||||
rwx_log_error 8 "Opening failure: ${device}"
|
||||
fi
|
||||
# make mount directory
|
||||
if ! mkdir --parents "${crypt_mount}"; then
|
||||
rwx_log_error 8 "Making failure: ${crypt_mount}"
|
||||
rwx_log_error 9 "Making failure: ${crypt_mount}"
|
||||
fi
|
||||
# mount file system
|
||||
if ! mount \
|
||||
--options "autodefrag,compress-force=zstd" \
|
||||
"${crypt_map}" "${crypt_mount}"; then
|
||||
rwx_log_error 9 "Mounting failure: ${crypt_map}"
|
||||
rwx_log_error 10 "Mounting failure: ${crypt_map}"
|
||||
fi
|
||||
;;
|
||||
"${action_close}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue