From d23ca4eb48064adb74e13038a6c8fbc45b30c08c Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:44:39 +1100 Subject: [PATCH 1/2] Update syno_hdd_db.sh - Fix Invalid json format syslog output #270 --- syno_hdd_db.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index e8f1e1a..02afe31 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -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 @@ -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 @@ -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 @@ -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 @@ -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":{ ... }}}} @@ -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 From 63518c6c04ab66ceaadf29cf94d1f7fd21ffbc2d Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Mon, 1 Apr 2024 05:45:09 +1100 Subject: [PATCH 2/2] Update CHANGES.txt --- CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index c7cf3ff..4af6356 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +v3.4.87 +- Fix Invalid json format syslog output #270 + v3.4.86 - Hard coded /usr/syno/bin/ for Synology commands (to prevent $PATH issues). #249