Browse Source

Update syno_hdd_db.sh

Fixed bug where "M.2 volume support already enabled" message appeared when NAS had no M.2 drives.
pull/14/head
007revad 3 years ago
committed by GitHub
parent
commit
85479bc766
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      syno_hdd_db.sh

38
syno_hdd_db.sh

@ -49,6 +49,8 @@
# #
# Fixed bug where removable drives were being detected and added to drive database. # Fixed bug where removable drives were being detected and added to drive database.
# #
# Fixed bug where "M.2 volume support already enabled" message appeared when NAS had no M.2 drives.
#
# #
# Added check that M.2 volume support is enabled (on supported models). # Added check that M.2 volume support is enabled (on supported models).
# #
@ -380,11 +382,11 @@ if [[ ${#nvmelist[@]} -gt "0" ]]; then
fi fi
# Check nvmes array isn't empty # Check nvmes array isn't empty
if [[ ${#nvmes[@]} -eq "0" ]]; then if [[ $m2 != "no" ]]; then
if [[ $m2 != "no" ]]; then if [[ ${#nvmes[@]} -eq "0" ]]; then
echo -e "No M.2 drives found\n" echo -e "No M.2 drives found\n"
fi else
else m2exists="yes"
echo "M.2 drive models found: ${#nvmes[@]}" echo "M.2 drive models found: ${#nvmes[@]}"
num="0" num="0"
while [[ $num -lt "${#nvmes[@]}" ]]; do while [[ $num -lt "${#nvmes[@]}" ]]; do
@ -392,6 +394,7 @@ else
num=$((num +1)) num=$((num +1))
done done
echo echo
fi
fi fi
@ -608,30 +611,35 @@ else
fi fi
# Check m2 volume support enabled # Enable m2 volume support
smp=support_m2_pool if [[ $m2 != "no" ]]; then
setting="$(get_key_value $synoinfo ${smp})" if [[ $m2exists == "yes" ]]; then
enabled="" # Check if m2 volume support is enabled
if [[ ! $setting ]]; then smp=support_m2_pool
setting="$(get_key_value $synoinfo ${smp})"
enabled=""
if [[ ! $setting ]]; then
# Add support_m2_pool"yes" # Add support_m2_pool"yes"
echo 'support_m2_pool="yes"' >> "$synoinfo" echo 'support_m2_pool="yes"' >> "$synoinfo"
enabled="yes" enabled="yes"
elif [[ $setting == "no" ]]; then elif [[ $setting == "no" ]]; then
# Change support_m2_pool"no" to "yes" # Change support_m2_pool"no" to "yes"
sed -i "s/${smp}=\"no\"/${smp}=\"yes\"/" "$synoinfo" sed -i "s/${smp}=\"no\"/${smp}=\"yes\"/" "$synoinfo"
enabled="yes" enabled="yes"
elif [[ $setting == "yes" ]]; then elif [[ $setting == "yes" ]]; then
echo -e "\nM.2 volume support already enabled." echo -e "\nM.2 volume support already enabled."
fi fi
# Check if we enabled m2 volume support # Check if we enabled m2 volume support
setting="$(get_key_value $synoinfo ${smp})" setting="$(get_key_value $synoinfo ${smp})"
if [[ $enabled == "yes" ]]; then if [[ $enabled == "yes" ]]; then
if [[ $setting == "yes" ]]; then if [[ $setting == "yes" ]]; then
echo -e "\nEnabled M.2 volume support." echo -e "\nEnabled M.2 volume support."
else else
echo -e "${Error}ERROR${Off} Failed to enable m2 volume support!" echo -e "${Error}ERROR${Off} Failed to enable m2 volume support!"
fi fi
fi
fi
fi fi

Loading…
Cancel
Save