Skip to content

Commit

Permalink
Merge pull request #271 from 007revad/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
007revad authored Mar 31, 2024
2 parents aab2fff + 63518c6 commit f999e8a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.4.87
- Fix Invalid json format syslog output #270

v3.4.86
- Hard coded /usr/syno/bin/<command> for Synology commands (to prevent $PATH issues). #249

Expand Down
19 changes: 16 additions & 3 deletions syno_hdd_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# /var/packages/StorageManager/target/ui/storage_panel.js


scriptver="v3.4.86"
scriptver="v3.4.87"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"
scriptname=syno_hdd_db
Expand Down Expand Up @@ -271,6 +271,16 @@ fi
#echo "" # To keep output readable


# shellcheck disable=SC2317 # Don't warn about unreachable commands in this function
pause(){
# When debugging insert pause command where needed
read -s -r -n 1 -p "Press any key to continue..."
read -r -t 0.1 -s -e -- # Silently consume all input
stty echo echok # Ensure read didn't disable echoing user input
echo -e "\n"
}


#------------------------------------------------------------------------------
# Check latest release with GitHub API

Expand Down Expand Up @@ -1040,6 +1050,7 @@ fi

getdbtype(){
# Detect drive db type
# Synology misspelt compatibility as compatbility
if grep -F '{"disk_compatbility_info":' "$1" >/dev/null; then
# DSM 7 drive db files start with {"disk_compatbility_info":
dbtype=7
Expand Down Expand Up @@ -1132,7 +1143,8 @@ editdb7(){

elif [[ $1 == "empty" ]]; then # db file only contains {}
#if sed -i "s/{}/{\"$hdmodel\":{$fwstrng${default}}/" "$2"; then # empty
if sed -i "s/{}/{\"${hdmodel//\//\\/}\":{$fwstrng${default}}/" "$2"; then # empty
#if sed -i "s/{}/{\"${hdmodel//\//\\/}\":{$fwstrng${default}}/" "$2"; then # empty
if sed -i "s/{}/{\"${hdmodel//\//\\/}\":{$fwstrng${default}/" "$2"; then # empty
echo -e "Added ${Yellow}$hdmodel${Off} to ${Cyan}$(basename -- "$2")${Off}"
editcount "$2"
else
Expand Down Expand Up @@ -1170,6 +1182,7 @@ updatedb(){
default="$default":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true,
default="$default"\"smart_test_ignore\":false,\"smart_attr_ignore\":false}]}}}

# Synology misspelt compatibility as compatbility
if grep '"disk_compatbility_info":{}' "$2" >/dev/null; then
# Replace "disk_compatbility_info":{} with
# "disk_compatbility_info":{"WD40PURX-64GVNY0":{"80.00A80":{ ... }}},"default":{ ... }}}}
Expand Down Expand Up @@ -1645,7 +1658,7 @@ if [[ ${model:0:3} == "dva" ]]; then
fi

# Optionally set mem_max_mb to the amount of installed memory
if [[ $dsm -gt "6" ]]; then # DSM 6 as has no /proc/meminfo
if [[ $dsm -gt "6" ]]; then # DSM 6 as has no dmidecode
if [[ $ram == "yes" ]] && [[ -f /usr/sbin/dmidecode ]]; then
# Get total amount of installed memory
#IFS=$'\n' read -r -d '' -a array < <(dmidecode -t memory | grep "[Ss]ize") # GitHub issue #86, 87
Expand Down

0 comments on commit f999e8a

Please sign in to comment.