Fix blkid parsing, succeed when unspecified fs is present
@@ -223,9 +223,11 @@ formatDevIfNeed() {
fi
if OUT=$(blkid ${fullDevName}); then
+ debug "blkid ${OUT}"
+
oldFsType=$(echo ${OUT} | grep -E -o ' TYPE=\"[[:alnum:]]{1,}\"' | awk -F"\"" '{print $2}')
debug "dev ${fullDevName} have already fstype ${oldFsType}"
- if [ "${oldFsType}" != "${newFsType}" ]; then
+ if [ "${newFsType}" != "" ] && [ "${oldFsType}" != "${newFsType}" ]; then
echo -ne "Failed to create device ${fullDevName} newfs ${newFsType} oldfs ${oldFsType}"
else
echo -ne "Success"
