1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: Workaround possible issues with the file command (tm_mad/fs_lvm)

(cherry picked from commit 38b5b99539e6209b37b035ec72879fb2b0a5fbdc)
This commit is contained in:
Michal Opala 2022-01-24 11:34:55 +01:00 committed by Ruben S. Montero
parent 8f6ce0c025
commit 3e55e9584d
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -77,8 +77,9 @@ SIZE="${XPATH_ELEMENTS[j++]}"
ORIGINAL_SIZE="${XPATH_ELEMENTS[j++]}"
TM_MAD="${XPATH_ELEMENTS[j++]}"
# Remove potential " and ' chars to avoid bash syntax errors on ssh command below.
FILE_TYPE=`file --brief ${SRC_PATH} | tr -d \"\'`
FILE_SIZE=`fs_size "${SRC_PATH}" YES`
FILE_TYPE=`file --brief ${SRC_PATH}`
if [ $? -ne 0 ]; then
FILE_SIZE=0
@ -143,7 +144,7 @@ CLONE_CMD=$(cat <<EOF
seek="${ZERO_SEEK_BYTES}" count="\$(( LVSIZE - ${ZERO_SEEK_BYTES} ))"
fi
if [[ "$FILE_TYPE" =~ "LUKS encrypted file" ]]; then
if [[ '$FILE_TYPE' =~ "LUKS encrypted file" ]]; then
cat "$SRC_PATH" > "$DEV"
else
$QEMU_IMG convert -O raw "$SRC_PATH" "$DEV"