From ab5c4e38f08abdde4fe4fa5716ef6e8b9deaf5a1 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:18:50 +1100 Subject: [PATCH 1/9] Update syno_hdd_db.sh Formatting fix --- syno_hdd_db.sh | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 060707d..3ded120 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -25,25 +25,9 @@ # - syno_hdd_vendor.txt needs to be in the same folder as syno_hdd_db.sh # # Now warns if script is located on an M.2 volume. -# -# -# Updated so E10M20-T1, M2D20, M2D18 and M2D17 now work in models that use devicetree -# and are using DSM 7.2 Update 2 or 3, 7.2.1, 7.2.1 Update 1, 2 or 3. -# -# Now edits model.dtb instead of downloading a pre-edited version. -# -# Fix for Unknown vendor causing "Unsupported firmware version" warning. Issue #161 -# -# Now supports NVMe drives that show as Unknown brand in storage manager: Issue #161 -# - ADATA, Corsair, Gigabyte, HS/MAXIO, MSI, Netac, Phison, PNY -# - SK Hynix, Solidigm, SPCC/Lexar, TEAMGROUP, UMIS, ZHITAI -# -# Fixed bug where memory was shown in MB but with GB unit. -# -# Bug fixes and improvements to --restore option. -scriptver="v3.3.70" +scriptver="v3.3.71" script=Synology_HDD_db repo="007revad/Synology_HDD_db" @@ -1776,6 +1760,7 @@ if [[ -f "$strgmgr" ]]; then if grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then # Backup storage_panel.js" strgmgrver="$(synopkg version StorageManager)" + echo "" if [[ ! -f "${1}.$strgmgrver" ]]; then if cp -p "$strgmgr" "${strgmgr}.$strgmgrver"; then echo -e "Backed up $(basename -- "$strgmgr")" @@ -1788,12 +1773,12 @@ if [[ -f "$strgmgr" ]]; then sed -i 's/},{isConditionInvalid:0/dev/null; then - echo "Enabled creating pool on drives in M.2 adaptor card." + echo -e "Enabled creating pool on drives in M.2 adaptor card." else echo -e "${Error}ERROR${Off} Failed to enable creating pool on drives in M.2 adaptor card!" fi else - echo "Creating pool in UI on drives in M.2 adaptor card already enabled." + echo -e "\nCreating pool in UI on drives in M.2 adaptor card already enabled." fi fi fi @@ -1853,6 +1838,4 @@ if [[ $dsm -eq "6" ]] || [[ $rebootmsg == "yes" ]]; then echo -e "\nYou may need to ${Cyan}reboot the Synology${Off} to see the changes." fi - exit - From bfce6e644eaf3d64e4a43411a52aea64eb1fa6ff Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:09:28 +1100 Subject: [PATCH 2/9] Update syno_hdd_db.sh Bugfix for backing up storage_panel --- syno_hdd_db.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 3ded120..7e34804 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -1761,7 +1761,7 @@ if [[ -f "$strgmgr" ]]; then # Backup storage_panel.js" strgmgrver="$(synopkg version StorageManager)" echo "" - if [[ ! -f "${1}.$strgmgrver" ]]; then + if [[ ! -f "${strgmgr}.$strgmgrver" ]]; then if cp -p "$strgmgr" "${strgmgr}.$strgmgrver"; then echo -e "Backed up $(basename -- "$strgmgr")" else From 9a57ea47f762ae5cb530e34ff2ffdd635bbdc5f8 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:23:45 +1100 Subject: [PATCH 3/9] Update CHANGES.txt v3.3.71 - Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index f3d3ae0..23691b5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +v3.3.71 +- Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. +- Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. + v3.3.70 - Now enables creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards: - E10M20-T1, M2D20, M2D18 and M2D17. From 084b83b18bf1249895f00adf6543315f074ac1d4 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:25:44 +1100 Subject: [PATCH 4/9] Update syno_hdd_db.sh v3.3.71 - Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. --- syno_hdd_db.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 7e34804..4bd703e 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -388,6 +388,27 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | syslog_set warn "$script failed to copy $tag to script location" fi + # Copy new syno_hdd_vendor_ids.txt file + vidstxt="syno_hdd_vendor_ids.txt" + if [[ $scriptpath =~ /volume* ]]; then + if [[ ! -f "$scriptpath/$vidstxt" ]]; then # Don't overwrite file + # Copy new syno_hdd_vendor_ids.txt file to script location + if ! cp -p "/tmp/$script-$shorttag/$vidstxt" "$scriptpath"; then + if [[ $autoupdate != "yes" ]]; then copyerr=1; fi + echo -e "${Error}ERROR${Off} Failed to copy"\ + "$script-$shorttag/$vidstxt to:\n $scriptpath" + else + # Set permissions on CHANGES.txt + if ! chmod 664 "$scriptpath/$vidstxt"; then + if [[ $autoupdate != "yes" ]]; then permerr=1; fi + echo -e "${Error}ERROR${Off} Failed to set permissions on:" + echo "$scriptpath/$vidstxt" + fi + vids_txt=" and syno_hdd_vendor_ids.txt" + fi + fi + fi + # Copy new CHANGES.txt file if [[ $scriptpath =~ /volume* ]]; then # Copy new CHANGES.txt file to script location @@ -411,7 +432,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | # Notify of success (if there were no errors) if [[ $copyerr != 1 ]] && [[ $permerr != 1 ]]; then - echo -e "\n$tag$changestxt downloaded to: ${scriptpath}\n" + echo -e "\n$tag$changestxt$vids_txt downloaded to: ${scriptpath}\n" syslog_set info "$script successfully updated to $tag" # Reload script From d26553b77a046b8f720e4de8077a314e73808471 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:28:31 +1100 Subject: [PATCH 5/9] Update syno_hdd_db.sh v3.3.71 - Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. --- syno_hdd_db.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 4bd703e..b743012 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -398,8 +398,8 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | echo -e "${Error}ERROR${Off} Failed to copy"\ "$script-$shorttag/$vidstxt to:\n $scriptpath" else - # Set permissions on CHANGES.txt - if ! chmod 664 "$scriptpath/$vidstxt"; then + # Set permissions on syno_hdd_vendor_ids.txt + if ! chmod 755 "$scriptpath/$vidstxt"; then if [[ $autoupdate != "yes" ]]; then permerr=1; fi echo -e "${Error}ERROR${Off} Failed to set permissions on:" echo "$scriptpath/$vidstxt" From 7a35bfca9167fec197d34b43cd91105495df5c76 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:31:20 +1100 Subject: [PATCH 6/9] Update syno_hdd_db.sh v3.3.71 - Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. --- syno_hdd_db.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index b743012..5525201 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -404,7 +404,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | echo -e "${Error}ERROR${Off} Failed to set permissions on:" echo "$scriptpath/$vidstxt" fi - vids_txt=" and syno_hdd_vendor_ids.txt" + vids_txt=", syno_hdd_vendor_ids.txt" fi fi fi @@ -423,7 +423,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | echo -e "${Error}ERROR${Off} Failed to set permissions on:" echo "$scriptpath/CHANGES.txt" fi - changestxt=" and changes.txt" + changestxt=", changes.txt" fi fi From c415d5f40053f09314e6454d44135f00c22b54dd Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:33:52 +1100 Subject: [PATCH 7/9] Update CHANGES.txt --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 23691b5..da3c45f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,5 @@ v3.3.71 -- Bug fix for enablings creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. +- Bug fix for enabling creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. v3.3.70 From 77e372287f6c2ec9edb126a96dffdcda9ee995f9 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:36:47 +1100 Subject: [PATCH 8/9] Update syno_hdd_db.sh Bug fix for checking if script located on NVMe drive. --- syno_hdd_db.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 5525201..6ba9913 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -295,8 +295,9 @@ echo "Running from: ${scriptpath}/$scriptfile" # Warn if script located on M.2 drive scriptvol=$(echo "$scriptpath" | cut -d"/" -f2) -result="$(lsblk | grep -B 4 /"$scriptvol" | grep nvme)" -if [[ -n $result ]]; then +vg=$(lvdisplay | grep /volume_"${volume#volume}" | cut -d"/" -f3) +md=$(pvdisplay | grep -B 1 "$vg" | grep /dev/ | cut -d"/" -f3) +if cat /proc/mdstat | grep "$md" | grep nvme >/dev/null; then echo "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" fi From 0bc9d7739d838c19b67f393625eb4f244f45cff5 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:37:05 +1100 Subject: [PATCH 9/9] Update CHANGES.txt --- CHANGES.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.txt b/CHANGES.txt index da3c45f..a6f3d23 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,7 @@ v3.3.71 - Bug fix for enabling creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards. - Bug fix for not copying syno_hdd_db_vendors.txt to script location when script updates itself. +- Bug fix for checking if script located on NVMe drive. v3.3.70 - Now enables creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards: