Browse Source

Merge pull request #401 from 007revad/main

sync from main
pull/402/head
Dave Russell 1 year ago
committed by GitHub
parent
commit
b5a3b0b2d5
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 43
      syno_hdd_db.sh
  2. 49
      syno_hdd_vendor_ids.txt

43
syno_hdd_db.sh

@ -197,9 +197,25 @@ else
fi fi
PS4func() {
local lineno="$1"
local i f=''
local c="\033[0;36m" y="\033[0;33m" n="\033[0m"
local d=$((${#FUNCNAME[@]}-2))
if [[ $lineno == 1 ]]
then lineno=0
fi
for ((i=d; i>0; i--))
do printf -v f "%s%s()" "$f" "${FUNCNAME[i]}"
done
printf "$y%s:%04d$c%s$n " "${BASH_SOURCE[1]##*/}" "$lineno" "$f"
}
if [[ $debug == "yes" ]]; then if [[ $debug == "yes" ]]; then
set -x PS4='\r$(PS4func $LINENO)'
export PS4='`[[ $? == 0 ]] || echo "\e[1;31;40m($?)\e[m\n "`:.$LINENO:' set -o xtrace
fi fi
@ -362,11 +378,24 @@ 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) get_script_vol() {
vg=$(lvdisplay | grep /volume_"${scriptvol#volume}" | cut -d"/" -f3) local script_root vol_num vg_name
md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3) script_root="${scriptpath#/*}"
# shellcheck disable=SC2002 # Don't warn about "Useless cat" script_root="${script_root%%/*}"
if cat /proc/mdstat | grep "$md" | grep -q nvme; then if [[ $script_root =~ ^volume ]]
then
vol_num="${script_root:6}"
vg_name=$(lvs --noheadings --select=lv_name="volume_$vol_num" --options=vg_name)
vg_name="${vg_name// }"
vol_name=$(pvs --noheadings --select=vg_name="$vg_name" --options=pv_name)
vol_name="${vol_name// }"
else
vol_name=$(df --output=source "/$script_root" |sed 1d)
fi
}
get_script_vol # sets $vol_name to /dev/whatever
if grep -qE "^${vol_name#/dev/} .+ nvme" /proc/mdstat
then
echo -e "\n${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" echo -e "\n${Yellow}WARNING${Off} Don't store this script on an NVMe volume!"
fi fi

49
syno_hdd_vendor_ids.txt

@ -1,25 +1,24 @@
# You can add your drive's vendor id and vendor name here. # You can add your drive's vendor id and vendor name here.
# #
# Only edit this file if the script warns you about a missing vendor id. # Only edit this file if the script warns you about a missing vendor id.
0x025e="Solidigm" 0x025e="Solidigm"
0x05dc="Lexar" 0x05dc="Lexar"
0x0ed1="aigo" 0x0ed1="aigo"
0x10ec="TEAMGROUP" 0x10ec="TEAMGROUP"
0x137e="Patriot" 0x137e="Patriot"
0x1458="Gigabyte" 0x1458="Gigabyte"
0x1462="MSI" 0x1462="MSI"
0x196e="PNY" 0x196e="PNY"
0x1987="Phison" 0x1987="Phison"
0x1b1c="Corsair" 0x1b1c="Corsair"
0x1bdc="Apacer" 0x1bdc="Apacer"
0x1c5c="SK Hynix" 0x1c5c="SK Hynix"
0x1cc4="UMIS" 0x1cc4="UMIS"
0x1cfa="Corsair" 0x1cfa="Corsair"
0x1d79="Transcend" 0x1d79="Transcend"
0x1dbe="ADATA" 0x1dbe="ADATA"
0x1e0f="KIOXIA" 0x1e0f="KIOXIA"
0x1e49="ZHITAI" 0x1e49="ZHITAI"
0x1e4b="FIKWOT" 0x1e4b="FIKWOT"
0x1f40="Netac" 0x1f40="Netac"

Loading…
Cancel
Save