Browse Source

Update syno_hdd_db.sh

v3.1.59
pull/123/head
Dave Russell 3 years ago
committed by GitHub
parent
commit
811ebc3d86
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      syno_hdd_db.sh

32
syno_hdd_db.sh

@ -30,6 +30,7 @@
# DONE
# Added enabling E10M20-T1, M2D20 and M2D18 for DS1821+, DS1621+ and DS1520+.
# Added enabling M2D18 for RS822RP+, RS822+, RS1221RP+ and RS1221+ with older DSM version.
#
# Fixed enabling E10M20-T1, M2D20 and M2D18 cards in models that don't officially support them.
#
@ -37,6 +38,8 @@
# - If last memory socket was empty an invalid unit of bytes could be used. Issue #106
# - When dmidecode returned MB for one ram module and GB for another ram module. Issue #107
#
# Fixed bug displaying the max memory setting if total installed memory was less than the max memory. Issue #107
#
#
# Minor bug fix for checking amount of installed memory.
#
@ -971,14 +974,12 @@ backupdb(){
for i in "${!db1list[@]}"; do
backupdb "${db1list[i]}" ||{
ding
echo -e "${Error}ERROR 5${Off} Failed to backup $(basename -- "${db1list[i]}")!"
exit 5
}
done
for i in "${!db2list[@]}"; do
backupdb "${db2list[i]}" ||{
ding
echo -e "${Error}ERROR 5${Off} Failed to backup $(basename -- "${db2list[i]}")!"
exit 5 # maybe don't exit for .db.new file
}
done
@ -1153,6 +1154,8 @@ done
# DS1821+, DS1621+ and DS1520+ also need edited device tree blob file
# /etc.defaults/model.dtb
# RS822RP+, RS822+, RS1221RP+ and RS1221+ with DSM older than 7.2 need
# device tree blob file from DSM 7.2 to support M2D18
enable_card(){
# $1 is the file
@ -1170,7 +1173,7 @@ enable_card(){
if set_section_key_value "$1" "$2" "$modelname" yes; then
echo -e "Enabled ${Yellow}$3${Off} for ${Cyan}$modelname${Off}" >&2
else
echo -e "${Error}ERROR 5${Off} Failed to enable $3 for ${modelname}!" >&2
echo -e "${Error}ERROR 9${Off} Failed to enable $3 for ${modelname}!" >&2
fi
else
echo -e "${Yellow}$3${Off} already enabled for ${Cyan}$modelname${Off}" >&2
@ -1182,9 +1185,10 @@ check_modeldtb(){
# $1 is E10M20-T1 or M2D20 or M2D18 or M2D17
if [[ -f /etc.defaults/model.dtb ]]; then
if ! grep --text "$1" /etc.defaults/model.dtb >/dev/null; then
if [[ $modelname == "DS1821+" ]] ||\
[[ $modelname == "DS1621+" ]] ||\
[[ $modelname == "DS1520+" ]];
if [[ $modelname == "DS1821+" ]] || [[ $modelname == "DS1621+" ]] ||\
[[ $modelname == "DS1520+" ]] || [[ $modelname == "RS822RP+" ]] ||\
[[ $modelname == "RS822+" ]] || [[ $modelname == "RS1221RP+" ]] ||\
[[ $modelname == "RS1221+" ]];
then
echo "" >&2
if [[ -f ./dtb/${modelname}_model.dtb ]]; then
@ -1376,6 +1380,7 @@ if [[ $dsm -gt "6" ]]; then # DSM 6 as has no /proc/meminfo
fi
# Set mem_max_mb to the amount of installed memory
setting="$(get_key_value $synoinfo mem_max_mb)"
settingbak="$(get_key_value ${synoinfo}.bak mem_max_mb)" # GitHub issue #107
if [[ $ramtotal =~ ^[0-9]+$ ]]; then # Check $ramtotal is numeric
if [[ $ramtotal -gt "$setting" ]]; then
synosetkeyvalue "$synoinfo" mem_max_mb "$ramtotal"
@ -1388,6 +1393,21 @@ if [[ $dsm -gt "6" ]]; then # DSM 6 as has no /proc/meminfo
else
echo -e "\n${Error}ERROR${Off} Failed to change max memory!"
fi
elif [[ $setting -gt "$ramtotal" ]] && [[ $setting -gt "$settingbak" ]]; # GitHub issue #107
then
# Fix setting is greater than both ramtotal and default in syninfo.conf.bak
synosetkeyvalue "$synoinfo" mem_max_mb "$settingbak"
# Check we restored mem_max_mb
setting="$(get_key_value $synoinfo mem_max_mb)"
if [[ $settingbak == "$setting" ]]; then
#echo -e "\nSet max memory to $ramtotal MB."
ramgb=$((ramtotal / 1024))
echo -e "\nRestored max memory to $ramtotal GB."
else
echo -e "\n${Error}ERROR${Off} Failed to restore max memory!"
fi
elif [[ $ramtotal == "$setting" ]]; then
#echo -e "\nMax memory already set to $ramtotal MB."
ramgb=$((ramtotal / 1024))

Loading…
Cancel
Save