Skip to content

Commit

Permalink
Merge pull request #277 from 007revad/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
007revad authored Apr 9, 2024
2 parents ef17d13 + f1a9181 commit 590f3e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.5.89
- Bug fix for -s, --showedits option with multiple of the same drive model but with different firmware versions. Issue #276

v3.5.88
- Changed how memory compatibility is disabled for older models. Issue #272

Expand Down
49 changes: 25 additions & 24 deletions syno_hdd_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#--------------------------------------------------------------------------------------------------

# CHANGES
# Bug fix for -s, --showedits option for multiple of the same drive model
# but with different firmware versions. Issue #276
#
# Changed disabling memory compatibility for older models. Issue #272
#
# Hard coded /usr/syno/bin/<command> for Synology commands (to prevent $PATH issues).
Expand All @@ -37,7 +40,7 @@
# /var/packages/StorageManager/target/ui/storage_panel.js


scriptver="v3.5.88"
scriptver="v3.5.89"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"
scriptname=syno_hdd_db
Expand Down Expand Up @@ -1920,32 +1923,30 @@ fi
#------------------------------------------------------------------------------
# Finished

show_changes(){
# Assign passed drive models array to my_array
local my_array=("$@")
local drive_models=()
for i in "${!my_array[@]}"; do
drive_models+=$(printf "%s" "${my_array[i]}" | cut -d"," -f 1)
done
# Sort array to remove duplicates
IFS=$'\n'
drives_sorted=($(sort -u <<<"${drive_models[*]}"))
unset IFS
for drive_model in "${drives_sorted[@]}"; do
echo -e "\n$drive_model:"
jq -r --arg drive_model "$drive_model" '.disk_compatbility_info[$drive_model]' "${db1list[0]}"
done
}

# Show the changes
if [[ ${showedits,,} == "yes" ]]; then
if [[ ${#db1list[@]} -gt "0" ]]; then
getdbtype "${db1list[0]}"
if [[ $dbtype -gt "6" ]]; then
# Show 11 lines after hdmodel line
lines=11
elif [[ $dbtype -eq "6" ]]; then
# Show 2 lines after hdmodel line
lines=2
fi

# HDDs/SSDs
for i in "${!hdds[@]}"; do
hdmodel=$(printf "%s" "${hdds[i]}" | cut -d"," -f 1)
echo
jq . "${db1list[0]}" | grep -A "$lines" "$hdmodel"
done
# HDDs/SSDs
show_changes "${hdds[@]}"

# NVMe drives
for i in "${!nvmes[@]}"; do
hdmodel=$(printf "%s" "${nvmes[i]}" | cut -d"," -f 1)
echo
jq . "${db1list[0]}" | grep -A "$lines" "$hdmodel"
done
fi
# NVMe drives
show_changes "${nvmes[@]}"
fi


Expand Down

0 comments on commit 590f3e1

Please sign in to comment.