Browse Source

Merge pull request #186 from 007revad/develop

Develop
pull/205/head
Dave Russell 2 years ago
committed by GitHub
parent
commit
c28a88e7be
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGES.txt
  2. 57
      syno_hdd_db.sh

5
CHANGES.txt

@ -1,3 +1,8 @@
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 v3.3.70
- Now enables creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards: - Now enables creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards:
- E10M20-T1, M2D20, M2D18 and M2D17. - E10M20-T1, M2D20, M2D18 and M2D17.

57
syno_hdd_db.sh

@ -25,25 +25,9 @@
# - syno_hdd_vendor.txt needs to be in the same folder as syno_hdd_db.sh # - 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. # 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 script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
@ -311,8 +295,9 @@ echo "Running from: ${scriptpath}/$scriptfile"
# Warn if script located on M.2 drive # Warn if script located on M.2 drive
scriptvol=$(echo "$scriptpath" | cut -d"/" -f2) scriptvol=$(echo "$scriptpath" | cut -d"/" -f2)
result="$(lsblk | grep -B 4 /"$scriptvol" | grep nvme)" vg=$(lvdisplay | grep /volume_"${volume#volume}" | cut -d"/" -f3)
if [[ -n $result ]]; then 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!" echo "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!"
fi fi
@ -404,6 +389,27 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" |
syslog_set warn "$script failed to copy $tag to script location" syslog_set warn "$script failed to copy $tag to script location"
fi 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 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"
fi
vids_txt=", syno_hdd_vendor_ids.txt"
fi
fi
fi
# Copy new CHANGES.txt file # Copy new CHANGES.txt file
if [[ $scriptpath =~ /volume* ]]; then if [[ $scriptpath =~ /volume* ]]; then
# Copy new CHANGES.txt file to script location # Copy new CHANGES.txt file to script location
@ -418,7 +424,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" |
echo -e "${Error}ERROR${Off} Failed to set permissions on:" echo -e "${Error}ERROR${Off} Failed to set permissions on:"
echo "$scriptpath/CHANGES.txt" echo "$scriptpath/CHANGES.txt"
fi fi
changestxt=" and changes.txt" changestxt=", changes.txt"
fi fi
fi fi
@ -427,7 +433,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" |
# Notify of success (if there were no errors) # Notify of success (if there were no errors)
if [[ $copyerr != 1 ]] && [[ $permerr != 1 ]]; then 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" syslog_set info "$script successfully updated to $tag"
# Reload script # Reload script
@ -1776,7 +1782,8 @@ if [[ -f "$strgmgr" ]]; then
if grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then if grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then
# Backup storage_panel.js" # Backup storage_panel.js"
strgmgrver="$(synopkg version StorageManager)" strgmgrver="$(synopkg version StorageManager)"
if [[ ! -f "${1}.$strgmgrver" ]]; then echo ""
if [[ ! -f "${strgmgr}.$strgmgrver" ]]; then
if cp -p "$strgmgr" "${strgmgr}.$strgmgrver"; then if cp -p "$strgmgr" "${strgmgr}.$strgmgrver"; then
echo -e "Backed up $(basename -- "$strgmgr")" echo -e "Backed up $(basename -- "$strgmgr")"
else else
@ -1788,12 +1795,12 @@ if [[ -f "$strgmgr" ]]; then
sed -i 's/},{isConditionInvalid:0<this.pciSlot,invalidReason:"notSupportM2Pool_addOnCard"//g' "$strgmgr" sed -i 's/},{isConditionInvalid:0<this.pciSlot,invalidReason:"notSupportM2Pool_addOnCard"//g' "$strgmgr"
# Check if we edited file # Check if we edited file
if ! grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then if ! grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/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 else
echo -e "${Error}ERROR${Off} Failed to enable creating pool on drives in M.2 adaptor card!" echo -e "${Error}ERROR${Off} Failed to enable creating pool on drives in M.2 adaptor card!"
fi fi
else 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 fi
fi fi
@ -1853,6 +1860,4 @@ if [[ $dsm -eq "6" ]] || [[ $rebootmsg == "yes" ]]; then
echo -e "\nYou may need to ${Cyan}reboot the Synology${Off} to see the changes." echo -e "\nYou may need to ${Cyan}reboot the Synology${Off} to see the changes."
fi fi
exit exit

Loading…
Cancel
Save