Browse Source

Merge pull request #179 from 007revad/develop

Develop
pull/205/head v3.3.70
Dave Russell 2 years ago
committed by GitHub
parent
commit
83768509d6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      CHANGES.txt
  2. 100
      syno_hdd_db.sh
  3. 20
      syno_hdd_vendor_ids.txt

8
CHANGES.txt

@ -1,3 +1,11 @@
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
- Added new vendor ids for Apacer, aigo, Lexar and Transcend NVMe drives.
- Now includes syno_hdd_vendor.txt so users can add their NVMe drive's vendor id.
- 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.
v3.2.69 v3.2.69
- Added KIOXIA vendor id. - Added KIOXIA vendor id.
- Bug fix for wrong version number, which caused an update loop. - Bug fix for wrong version number, which caused an update loop.

100
syno_hdd_db.sh

@ -16,6 +16,17 @@
#-------------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# CHANGES # CHANGES
# Now enables creating storage pools in Storage Manager for M.2 drives in PCIe adaptor cards.
# - E10M20-T1, M2D20, M2D18 and M2D17
#
# Added new vendor ids for Apacer, aigo, Lexar and Transcend NVMe drives.
#
# Now includes syno_hdd_vendor.txt so users can add their NVMe drive's vendor id.
# - 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 # 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. # and are using DSM 7.2 Update 2 or 3, 7.2.1, 7.2.1 Update 1, 2 or 3.
# #
@ -32,7 +43,7 @@
# Bug fixes and improvements to --restore option. # Bug fixes and improvements to --restore option.
scriptver="v3.2.69" scriptver="v3.3.70"
script=Synology_HDD_db script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
@ -298,6 +309,14 @@ echo "Running from: ${scriptpath}/$scriptfile"
#echo "scriptver: $scriptver" # debug #echo "scriptver: $scriptver" # debug
# 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
echo "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!"
fi
cleanup_tmp(){ cleanup_tmp(){
cleanup_err= cleanup_err=
@ -459,6 +478,9 @@ adapter_cards="/usr/syno/etc.defaults/adapter_cards.conf"
adapter_cards2="/usr/syno/etc/adapter_cards.conf" adapter_cards2="/usr/syno/etc/adapter_cards.conf"
dbpath=/var/lib/disk-compatibility/ dbpath=/var/lib/disk-compatibility/
synoinfo="/etc.defaults/synoinfo.conf" synoinfo="/etc.defaults/synoinfo.conf"
strgmgr="/var/packages/StorageManager/target/ui/storage_panel.js"
vidfile="/usr/syno/etc.defaults/pci_vendor_ids.conf"
vidfile2="/usr/syno/etc/pci_vendor_ids.conf"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -536,9 +558,21 @@ if [[ $restore == "yes" ]]; then
fi fi
fi fi
# Restore .db files from backups # Restore storage_panel.js from backup
strgmgrver="$(synopkg version StorageManager)"
if [[ -f "${strgmgr}.$strgmgrver" ]]; then
if cp -p "${strgmgr}.$strgmgrver" "$strgmgr"; then
echo "Restored $(basename -- "$strgmgr")"
else
restoreerr=1
echo -e "${Error}ERROR${Off} Failed to restore $(basename -- "$strgmgr")!\n"
fi
else
echo "No backup of $(basename -- "$strgmgr") found."
fi
echo "" echo ""
# /var/lib/disk-compatibility # Restore .db files from backups
for f in "${!dbbakfiles[@]}"; do for f in "${!dbbakfiles[@]}"; do
replaceme="${dbbakfiles[f]%.bak}" # Remove .bak replaceme="${dbbakfiles[f]%.bak}" # Remove .bak
if cp -p "${dbbakfiles[f]}" "$replaceme"; then if cp -p "${dbbakfiles[f]}" "$replaceme"; then
@ -608,9 +642,26 @@ vendor_from_id(){
0x1e49) vendor=ZHITAI ;; 0x1e49) vendor=ZHITAI ;;
0x1e4b) vendor=HS/MAXIO ;; # 2 brands with same vid 0x1e4b) vendor=HS/MAXIO ;; # 2 brands with same vid
0x1f40) vendor=Netac ;; 0x1f40) vendor=Netac ;;
0x1bdc) vendor=Apacer;;
0x0ed1) vendor=aigo ;;
0x05dc) vendor=Lexar ;;
0x1d79) vendor=Transcend;;
*) *)
echo -e "\n${Error}WARNING{OFF} No vendor found for id $1" >&2 # Get vendor from syno_hdd_vendor.txt
echo -e "Contact 007revad to get your drive added.\n" >&2 vidlist="$scriptpath/syno_hdd_vendor.txt"
if [[ -r "$vidlist" ]]; then
val=$(synogetkeyvalue "$vidlist" "$1")
if synogetkeyvalue "$vidlist" "$1"; then
vendor="$val"
else
echo -e "\n${Yellow}WARNING{OFF} No vendor found for vid $1" >&2
echo -e "You can add your drive's vendor to: "
echo "$vidlist"
fi
else
echo -e "\n${Error}ERROR{OFF} $vidlist not found!" >&2
fi
;; ;;
esac esac
} }
@ -618,6 +669,8 @@ vendor_from_id(){
set_vendor(){ set_vendor(){
# Add missing vendors to /usr/syno/etc.defaults/pci_vendor_ids.conf # Add missing vendors to /usr/syno/etc.defaults/pci_vendor_ids.conf
if [[ $vendor ]]; then if [[ $vendor ]]; then
# DS1817+, DS1517+, RS1219+, RS818+ don't have pci_vendor_ids.conf
if [[ "$vidfile" ]]; then
if ! grep "$vid" "$vidfile" >/dev/null; then if ! grep "$vid" "$vidfile" >/dev/null; then
synosetkeyvalue "$vidfile" "${vid,,}" "$vendor" synosetkeyvalue "$vidfile" "${vid,,}" "$vendor"
val=$(synogetkeyvalue "$vidfile" "${vid,,}") val=$(synogetkeyvalue "$vidfile" "${vid,,}")
@ -631,6 +684,7 @@ set_vendor(){
synosetkeyvalue "$vidfile2" "${vid,,}" "$vendor" synosetkeyvalue "$vidfile2" "${vid,,}" "$vendor"
fi fi
fi fi
fi
} }
get_vid(){ get_vid(){
@ -646,9 +700,6 @@ get_vid(){
fi fi
} }
vidfile="/usr/syno/etc.defaults/pci_vendor_ids.conf"
vidfile2="/usr/syno/etc/pci_vendor_ids.conf"
fixdrivemodel(){ fixdrivemodel(){
# Remove " 00Y" from end of Samsung/Lenovo SSDs # Github issue #13 # Remove " 00Y" from end of Samsung/Lenovo SSDs # Github issue #13
if [[ $1 =~ MZ.*' 00Y' ]]; then if [[ $1 =~ MZ.*' 00Y' ]]; then
@ -1311,7 +1362,7 @@ install_binfile(){
# install_binfile <file> <file-url> <destination> <chmod> <bundled-path> <hash> # install_binfile <file> <file-url> <destination> <chmod> <bundled-path> <hash>
# example: # example:
# file_url="https://raw.githubusercontent.com/${repo}/main/bin/dtc" # file_url="https://raw.githubusercontent.com/${repo}/main/bin/dtc"
# install_binfile dtc "$file_url" /usr/bin/bc a+x bin/dtc # install_binfile dtc "$file_url" /usr/bin/dtc a+x bin/dtc
if [[ -f "${scriptpath}/$5" ]]; then if [[ -f "${scriptpath}/$5" ]]; then
binfile="${scriptpath}/$5" binfile="${scriptpath}/$5"
@ -1717,6 +1768,37 @@ if [[ $wdda == "no" ]]; then
fi fi
# Enabled creating pool on drives in M.2 adaptor card
if [[ -f "$strgmgr" ]]; then
# StorageManager package is installed
if [[ ${#m2cards[@]} -gt "0" ]]; then
if grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then
# Backup storage_panel.js"
strgmgrver="$(synopkg version StorageManager)"
if [[ ! -f "${1}.$strgmgrver" ]]; then
if cp -p "$strgmgr" "${strgmgr}.$strgmgrver"; then
echo -e "Backed up $(basename -- "$strgmgr")"
else
echo -e "${Error}ERROR${Off} Failed to backup $(basename -- "$strgmgr")!"
fi
fi
sed -i 's/notSupportM2Pool_addOnCard:this.T("disk_info","disk_reason_m2_add_on_card"),//g' "$strgmgr"
sed -i 's/},{isConditionInvalid:0<this.pciSlot,invalidReason:"notSupportM2Pool_addOnCard"//g' "$strgmgr"
# Check if we edited file
if ! grep 'notSupportM2Pool_addOnCard' "$strgmgr" >/dev/null; then
echo "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."
fi
fi
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Finished # Finished

20
syno_hdd_vendor_ids.txt

@ -0,0 +1,20 @@
# You can add your drive's vendor id and vendor name here
0x1dbe="ADATA"
0x0ed1="aigo"
0x1bdc="Apacer"
0x1b1c="Corsair"
0x1cfa="Corsair"
0x1458="Gigabyte"
0x1e0f="KIOXIA"
0x05dc="Lexar"
0x1462="MSI"
0x1f40="Netac"
0x1987="Phison"
0x196e="PNY"
0x1c5c="SK Hynix"
0x025e="Solidigm"
0x10ec="TEAMGROUP"
0x1d79="Transcend"
0x1cc4="UMIS"
0x1e49="ZHITAI"
Loading…
Cancel
Save