From 92a238150bbc870ac88edbbc2d1bf8c5d5170245 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:58:11 +1000 Subject: [PATCH 01/13] Update syno_enable_eunit.sh --- syno_enable_eunit.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/syno_enable_eunit.sh b/syno_enable_eunit.sh index 686be13..2680e3a 100644 --- a/syno_enable_eunit.sh +++ b/syno_enable_eunit.sh @@ -12,7 +12,7 @@ # sudo -i /volume1/scripts/syno_enable_eunit.sh #----------------------------------------------------------------------------------- -scriptver="v2.1.12" +scriptver="v2.1.13" script=Synology_enable_eunit repo="007revad/Synology_enable_eunit" scriptname=syno_enable_eunit @@ -431,6 +431,9 @@ if which syno_slot_mapping >/dev/null; then echo -e "${Cyan}None${Off}" fi echo "" +else + echo -e "${Error}ERROR${Off} Unsupported Synology NAS model. No syno_slot_mapping command!" + exit 1 # No syno_slot_mapping file fi @@ -451,6 +454,9 @@ if [[ -f /etc.defaults/model.dtb ]]; then # Is device tree model dtb2_file="/etc/model${hwrev}.dtb" #dts_file="/etc.defaults/model${hwrev}.dts" dts_file="/tmp/model${hwrev}.dts" +else + echo -e "${Error}ERROR${Off} Unsupported Synology NAS model. No model.dtb file!" + exit 1 # No model.dtb file fi synoinfo="/etc.defaults/synoinfo.conf" From eef600e992a6463e79a380be18eaa8b022b87ea3 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:59:50 +1000 Subject: [PATCH 02/13] Update CHANGES.txt --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index f5a19f3..7f974a1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +v2.1.13 +- Added checks to prevent running on unsupported Synology NAS model. + - Needs syno_slot_mapping command and /et/model.dtb file. + v2.1.12 - Bug fix for false "Failed to delete tmp files" log entries when script updates itself. - Bug first appeared in v1.0.6 From 45316fefd39c5f0797501ed065141b5539838ce2 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:08:29 +1000 Subject: [PATCH 03/13] Update CHANGES.txt --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 7f974a1..4ae6bf3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,6 @@ v2.1.13 - Added checks to prevent running on unsupported Synology NAS model. - - Needs syno_slot_mapping command and /et/model.dtb file. + - Needs syno_slot_mapping command and /etc/model.dtb file. v2.1.12 - Bug fix for false "Failed to delete tmp files" log entries when script updates itself. From 133cef695edc933309a666e708f80ed2e588000e Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:36:17 +1000 Subject: [PATCH 04/13] Update README.md --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a807cb..361b95a 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ [![committers.top badge](https://user-badge.committers.top/australia/007revad.svg)](https://user-badge.committers.top/australia/007revad) ### Description -Enable unsupported Synology eSATA Expansion Unit models +Enable unsupported Synology eSATA and InfiniBand Expansion Unit models This script will enable a choice of DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an eSATA port. +This script will enable a choice of DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an InfiniBand port. + You can enable as many different expansion unit models as you want. If you have 2 of the same expansion unit model you only need to enable it once for both expansion units to be enabled in DSM. @@ -21,7 +23,7 @@ If you have 2 of the same expansion unit model you only need to enable it once f ## Supported Models -This script will work for the following Synology NAS models: +This script will work for eSATA expansion units with the following Synology NAS models: | Model | Works | Confirmed | |---------|-------|-----------| @@ -40,6 +42,14 @@ This script will work for the following Synology NAS models: - The DiskStation models above already have DX517 enabled, and RX418 partially enabled. - The RackStation models above already have RX418 enabled, and DX517 partially enabled. +This script will work for InfiniBand expansion units with the following Synology NAS models: + +| Model | Works | Confirmed | +|---------|-------|-----------| +| RS2421+ | yes | | +| RS2421RP+ | yes | | +| RS2821RP+ | yes | | + ## eSATA expansion unit speeds | Model | eSATA Speed | Notes | From bdca0e0ffd4c1fe48e5b9f451c351572904dfa52 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:46:09 +1000 Subject: [PATCH 05/13] Update README.md --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 361b95a..0b31f49 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ ### Description Enable unsupported Synology eSATA and InfiniBand Expansion Unit models -This script will enable a choice of DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an eSATA port. - -This script will enable a choice of DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an InfiniBand port. +This script will enable a choice of: +- DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an eSATA port. +- RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 on Synology NAS that have an InfiniBand port. You can enable as many different expansion unit models as you want. @@ -21,12 +21,13 @@ If you have 2 of the same expansion unit model you only need to enable it once f > Do ***NOT*** span a storage pool between the NAS and Expansion Unit. After a DSM update the Expansion Unit will be unsupported until you run this script again, which will be hard to do if your only storage pool is offline. Also do ***NOT*** store this script on a volume in the expansion unit. -## Supported Models +## Supported NAS Models This script will work for eSATA expansion units with the following Synology NAS models: | Model | Works | Confirmed | |---------|-------|-----------| +| DS2422+ | yes | | | DS1823xs+ | yes | | | DS1821+ | yes | DX513, DX213, RX418 | | DS1621+ | yes | | @@ -39,8 +40,8 @@ This script will work for eSATA expansion units with the following Synology NAS | RS1221+, RS1221RP+ | yes | DX517 | | RS822+, RS822RP+ | yes | | -- The DiskStation models above already have DX517 enabled, and RX418 partially enabled. -- The RackStation models above already have RX418 enabled, and DX517 partially enabled. +- The DiskStation models above already have DX517 enabled. +- The RackStation models above already have RX418 enabled. This script will work for InfiniBand expansion units with the following Synology NAS models: @@ -50,6 +51,8 @@ This script will work for InfiniBand expansion units with the following Synology | RS2421RP+ | yes | | | RS2821RP+ | yes | | +- The RackStation models above already have RX1217RP and RX1217 enabled. + ## eSATA expansion unit speeds | Model | eSATA Speed | Notes | From 9f6a093d1ba7224b3507b151771413e661695a31 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:48:22 +1000 Subject: [PATCH 06/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b31f49..2f99e0c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ### Description Enable unsupported Synology eSATA and InfiniBand Expansion Unit models -This script will enable a choice of: +This script will allow enabling: - DX517, DX513, DX213, DX510, RX418, RX415 or RX410 on Synology NAS that have an eSATA port. - RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 on Synology NAS that have an InfiniBand port. From 4d9b69f021b0c8fdc0b9e03fa7613b4cfe6a44ac Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:56:25 +1000 Subject: [PATCH 07/13] Update CHANGES.txt --- CHANGES.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 4ae6bf3..0d6398f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +v2.2.14 +- Added support for InfiniBand expansion units for RS2421+, RS2421RP+ and RS2821RP+ NAS. + - Supports RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 expansion units. +- Removed editing synoinfo.conf as it only "support_ew_20_eunit" only relates to extended warranty. + v2.1.13 - Added checks to prevent running on unsupported Synology NAS model. - Needs syno_slot_mapping command and /etc/model.dtb file. From 4e58b37646129a42d461aa065d0d52eefa18d4d8 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 15:06:48 +1000 Subject: [PATCH 08/13] Update syno_enable_eunit.sh v2.2.14 - Added support for InfiniBand expansion units for RS2421+, RS2421RP+ and RS2821RP+ NAS. - Supports RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 expansion units. - Removed editing synoinfo.conf as it only "support_ew_20_eunit" only relates to extended warranty. --- syno_enable_eunit.sh | 226 ++++++++++++++++++++++++++++++++----------- 1 file changed, 172 insertions(+), 54 deletions(-) diff --git a/syno_enable_eunit.sh b/syno_enable_eunit.sh index 2680e3a..28358d0 100644 --- a/syno_enable_eunit.sh +++ b/syno_enable_eunit.sh @@ -12,7 +12,7 @@ # sudo -i /volume1/scripts/syno_enable_eunit.sh #----------------------------------------------------------------------------------- -scriptver="v2.1.13" +scriptver="v2.2.14" script=Synology_enable_eunit repo="007revad/Synology_enable_eunit" scriptname=syno_enable_eunit @@ -48,8 +48,9 @@ Options: -r, --restore Restore from backups to undo changes --unit=EUNIT Automatically enable specified expansion unit Only needed when script is scheduled - EUNIT is dx517, dx513, dx213, dx510, rx418, - rx415 or rx410 + EUNIT is dx517, dx513, dx213, dx510, rx418, rx415, + rx410, rx1217rp, rx1217, rx1214r, rx1214, rxX1211rp, + rx1211, dx1215ii, dx1215 or dx1211 -e, --email Disable colored text in output scheduler emails --autoupdate=AGE Auto update script (useful when script is scheduled) AGE is how many days old a release must be before @@ -72,10 +73,9 @@ EOF } -# Save options used +# Save options used for getopts args=("$@") - autoupdate="" # Check for flags with getopt @@ -105,8 +105,14 @@ if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -l \ break ;; --unit) # Specify eunit to enable for task scheduler - if [[ ${2,,} =~ ^(d|r)x[0-9]+$ ]]; then - unit="${2^^}" + if [[ ${2,,} =~ ^(d|r)x[0-9]+(rp|ii)?$ ]]; then + if [[ ${2:(-2)} == "rp" ]]; then + # Convert to upper case except rp at end + unit="$(b=${2:0:-2} && echo -n "${b^^}")rp" + else + # Convert to upper case + unit="${2^^}" + fi else echo -e "Invalid argument '$2'\n" exit 2 # Invalid argument @@ -664,24 +670,24 @@ check_modeldtb(){ } check_enabled(){ - # /etc.defaults/synoinfo.conf - setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) - IFS=',' read -r -a eunits_array <<< "$setting" - for e in "${eunits_array[@]}"; do - echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo}${Off}" - done - echo "" - - # /etc/synoinfo.conf - setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) - IFS=',' read -r -a eunits_array2 <<< "$setting2" - for e in "${eunits_array2[@]}"; do -# if [[ ${eunits_array[*]} =~ "$e" ]]; then - if [[ ${eunits_array[*]} =~ $e ]]; then - echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo2}${Off}" - fi - done - echo "" +# synoinfo.conf support_ew_20_eunit related to extended warranty +# # /etc.defaults/synoinfo.conf +# setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) +# IFS=',' read -r -a eunits_array <<< "$setting" +# for e in "${eunits_array[@]}"; do +# echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo}${Off}" +# done +# echo "" +# +# # /etc/synoinfo.conf +# setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) +# IFS=',' read -r -a eunits_array2 <<< "$setting2" +# for e in "${eunits_array2[@]}"; do +# if [[ ${eunits_array[*]} =~ $e ]]; then +# echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo2}${Off}" +# fi +# done +# echo "" for e in "${eunits_array[@]}"; do check_modeldtb "${e#Synology-}" @@ -697,15 +703,16 @@ fi show_enabled(){ - # /etc.defaults/synoinfo.conf - setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) - IFS=',' read -r -a eunits_array <<< "$setting" - # /etc/synoinfo.conf - setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) - IFS=',' read -r -a eunits_array2 <<< "$setting2" +# synoinfo.conf support_ew_20_eunit related to extended warranty +# # /etc.defaults/synoinfo.conf +# setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) +# IFS=',' read -r -a eunits_array <<< "$setting" +# # /etc/synoinfo.conf +# setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) +# IFS=',' read -r -a eunits_array2 <<< "$setting2" + for e in "${eunits_array[@]}"; do count="1" -# if [[ ${eunits_array2[*]} =~ "$e" ]]; then if [[ ${eunits_array2[*]} =~ $e ]]; then count=$((count +1)) fi @@ -760,6 +767,8 @@ backupdb(){ } edit_synoinfo(){ +# synoinfo.conf support_ew_20_eunit related to extended warranty + # $1 is the eunit model if [[ -n $1 ]]; then # Check if already enabled in synoinfo.conf @@ -907,6 +916,112 @@ elif [[ $1 == RX418 ]] || [[ $1 == RX415 ]] || [[ $1 == RX410 ]]; then }; EORX4bay +elif [[ ${_12bays[*]} =~ $1 ]]; then + cat >> "$2" <; + pmp_link = <0x00>; + }; + }; + + pmp_slot@2 { + + libata { + EMID = <0x00>; + pmp_link = <0x01>; + }; + }; + + pmp_slot@3 { + + libata { + EMID = <0x00>; + pmp_link = <0x02>; + }; + }; + + pmp_slot@4 { + + libata { + EMID = <0x01>; + pmp_link = <0x00>; + }; + }; + + pmp_slot@5 { + + libata { + EMID = <0x01>; + pmp_link = <0x01>; + }; + }; + + pmp_slot@6 { + + libata { + EMID = <0x01>; + pmp_link = <0x02>; + }; + }; + + pmp_slot@7 { + + libata { + EMID = <0x02>; + pmp_link = <0x00>; + }; + }; + + pmp_slot@8 { + + libata { + EMID = <0x02>; + pmp_link = <0x01>; + }; + }; + + pmp_slot@9 { + + libata { + EMID = <0x02>; + pmp_link = <0x02>; + }; + }; + + pmp_slot@10 { + + libata { + EMID = <0x03>; + pmp_link = <0x00>; + }; + }; + + pmp_slot@11 { + + libata { + EMID = <0x03>; + pmp_link = <0x01>; + }; + }; + + pmp_slot@12 { + + libata { + EMID = <0x03>; + pmp_link = <0x02>; + }; + }; + }; +}; +EORX12bay + fi } @@ -1019,38 +1134,33 @@ show_enabled enable_eunit(){ case "$choice" in - DX517) - edit_synoinfo "$choice" - eboxs=("$choice") && edit_modeldtb - return - ;; - DX513) - edit_synoinfo "$choice" + DX517|DX513|DX510) + # synoinfo.conf support_ew_20_eunit related to extended warranty + #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; DX213) - edit_synoinfo "$choice" - eboxs=("$choice") && edit_modeldtb - return - ;; - DX510) - edit_synoinfo "$choice" + # synoinfo.conf support_ew_20_eunit related to extended warranty + #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; - RX418) - edit_synoinfo "$choice" + RX418|RX415|RX410) + # synoinfo.conf support_ew_20_eunit related to extended warranty + #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; - RX415) - edit_synoinfo "$choice" + RX1217rp|RX1217|RX1214rp|RX1214|RX1211rp|RX1211) + # synoinfo.conf support_ew_20_eunit related to extended warranty + #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; - RX410) - edit_synoinfo "$choice" + DX1215II|DX1215|DX1211) + # synoinfo.conf support_ew_20_eunit related to extended warranty + #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; @@ -1071,11 +1181,19 @@ enable_eunit(){ esac } -eunits=("Check" "DX517" "DX513" "DX213" "DX510" "RX418" "RX415" "RX410" "Restore" "Quit") +_12bays=("RX1217rp" "RX1217" "RX1214rp" "RX1214" "RX1211rp" "RX1211" \ +"DX1215II" "DX1215" "DX1211") + +eunits=("Check" \ +"DX517" "DX513" "DX213" "DX510" "RX418" "RX415" "RX410" \ +"RX1217rp" "RX1217" "RX1214rp" "RX1214" "RX1211rp" "RX1211" \ +"DX1215II" "DX1215" "DX1211" \ +"Restore" "Quit") + if [[ -n $unit ]]; then # Expansion Unit supplied as argument - if [[ ${eunits[*]} =~ "${unit^^}" ]]; then - choice="${unit^^}" + if [[ ${eunits[*]} =~ ${unit} ]]; then + choice="${unit}" echo -e "$choice selected\n" enable_eunit else From 436bd7bac097d9d587cd3d1b19ab01c075a15526 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 17:50:24 +1000 Subject: [PATCH 09/13] Update CHANGES.txt --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0d6398f..3ee89f3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,4 @@ -v2.2.14 +v3.0.14 - Added support for InfiniBand expansion units for RS2421+, RS2421RP+ and RS2821RP+ NAS. - Supports RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 expansion units. - Removed editing synoinfo.conf as it only "support_ew_20_eunit" only relates to extended warranty. From f963b2f705bd7012b3b649f9a488c29d30165a77 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:04:04 +1000 Subject: [PATCH 10/13] Update syno_enable_eunit.sh v3.0.14 - Added support for InfiniBand expansion units for RS2421+, RS2421RP+ and RS2821RP+ NAS. - Supports RX1217RP, RX1217, RX1214RP, RX1214, RX1211RP, RX1211, DX1215II, DX1215 or DX1211 expansion units. - Removed editing synoinfo.conf as it only "support_ew_20_eunit" only relates to extended warranty. --- syno_enable_eunit.sh | 168 +++++++------------------------------------ 1 file changed, 25 insertions(+), 143 deletions(-) diff --git a/syno_enable_eunit.sh b/syno_enable_eunit.sh index 28358d0..770c1b2 100644 --- a/syno_enable_eunit.sh +++ b/syno_enable_eunit.sh @@ -12,7 +12,7 @@ # sudo -i /volume1/scripts/syno_enable_eunit.sh #----------------------------------------------------------------------------------- -scriptver="v2.2.14" +scriptver="v3.0.14" script=Synology_enable_eunit repo="007revad/Synology_enable_eunit" scriptname=syno_enable_eunit @@ -25,7 +25,7 @@ if [ ! "$(basename "$BASH")" = bash ]; then fi # Check script is running on a Synology NAS -if ! /usr/bin/uname -a | grep -i synology >/dev/null; then +if ! /usr/bin/uname -a | grep -q -i synology; then echo "This script is NOT running on a Synology NAS!" echo "Copy the script to a folder on the Synology" echo "and run it from there." @@ -277,7 +277,7 @@ echo -e "Running from: ${scriptpath}/$scriptfile\n" scriptvol=$(echo "$scriptpath" | cut -d"/" -f2) vg=$(lvdisplay | grep /volume_"${scriptvol#volume}" | cut -d"/" -f3) md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3) -if grep "$md" /proc/mdstat | grep nvme >/dev/null; then +if grep "$md" /proc/mdstat | grep -q nvme; then echo -e "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" fi @@ -436,7 +436,7 @@ if which syno_slot_mapping >/dev/null; then else echo -e "${Cyan}None${Off}" fi - echo "" + #echo "" else echo -e "${Error}ERROR${Off} Unsupported Synology NAS model. No syno_slot_mapping command!" exit 1 # No syno_slot_mapping file @@ -522,9 +522,7 @@ restore_orig(){ if [[ -f ${synoinfo}.bak ]]; then setting="$(/usr/syno/bin/synogetkeyvalue "${synoinfo}.bak" support_ew_20_eunit)" setting2="$(/usr/syno/bin/synogetkeyvalue "${synoinfo}" support_ew_20_eunit)" - if [[ $setting == "$setting2" ]]; then - echo -e "${Cyan}OK${Off} ${synoinfo}" - else + if [[ $setting != "$setting2" ]]; then if /usr/syno/bin/synosetkeyvalue "$synoinfo" support_ew_20_eunit "$setting"; then /usr/syno/bin/synosetkeyvalue "$synoinfo2" support_ew_20_eunit "$setting" echo -e "Restored ${synoinfo}" @@ -611,127 +609,45 @@ fi #---------------------------------------------------------- # Check currently enabled expansion units -check_key_value(){ - # $1 is path/file - # $2 is key - setting="$(/usr/syno/bin/synogetkeyvalue "$1" "$2")" - if [[ -f $1 ]]; then - if [[ -n $2 ]]; then - echo -e "${Yellow}$2${Off} = $setting" >&2 - else - echo -e "Key name not specified!" >&2 - fi - else - echo -e "File not found: $1" >&2 - fi -} +supported_eunits=("DX517" "DX513" "DX213" "DX510" "RX418" "RX415" "RX410" \ +"RX1217rp" "RX1217" "RX1214rp" "RX1214" "RX1211rp" "RX1211" \ +"DX1215II" "DX1215" "DX1211") -check_section_key_value(){ - # $1 is path/file - # $2 is section - # $3 is key - # $4 is description - setting="$(/usr/syno/bin/get_section_key_value "$1" "$2" "$3")" - if [[ -f $1 ]]; then - if [[ -n $2 ]]; then - if [[ -n $3 ]]; then - if [[ $setting == "yes" ]]; then - echo -e "${Cyan}$4${Off} is enabled for ${Yellow}$3${Off}" >&2 - else - echo -e "${Cyan}$4${Off} is ${Cyan}not${Off} enabled for ${Yellow}$3${Off}" >&2 - fi - else - echo -e "Key name not specified!" >&2 - fi +check_modeldtb(){ + # $1 is DX517 or RX418 etc + if [[ -f "${dtb2_file}" ]]; then + if grep -q --text "$1" "${dtb2_file}"; then + echo -e "${Cyan}$1${Off} is enabled in ${Yellow}${dtb2_file}${Off}" >& 2 else - echo -e "Section name not specified!" >&2 + echo -e "${Cyan}$1${Off} is ${Cyan}not${Off} enabled in ${Yellow}${dtb2_file}${Off}" >& 2 fi - else - echo -e "File not found: $1" >&2 fi -} - -check_modeldtb(){ - # $1 is DX517 or RX418 etc if [[ -f "${dtb_file}" ]]; then - if grep --text "$1" "${dtb_file}" >/dev/null; then + if grep -q --text "$1" "${dtb_file}"; then echo -e "${Cyan}$1${Off} is enabled in ${Yellow}${dtb_file}${Off}" >& 2 else echo -e "${Cyan}$1${Off} is ${Cyan}not${Off} enabled in ${Yellow}${dtb_file}${Off}" >& 2 fi fi - if [[ -f "${dtb2_file}" ]]; then - if grep --text "$1" "${dtb2_file}" >/dev/null; then - echo -e "${Cyan}$1${Off} is enabled in ${Yellow}${dtb2_file}${Off}" >& 2 - else - echo -e "${Cyan}$1${Off} is ${Cyan}not${Off} enabled in ${Yellow}${dtb2_file}${Off}" >& 2 - fi - fi } check_enabled(){ -# synoinfo.conf support_ew_20_eunit related to extended warranty -# # /etc.defaults/synoinfo.conf -# setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) -# IFS=',' read -r -a eunits_array <<< "$setting" -# for e in "${eunits_array[@]}"; do -# echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo}${Off}" -# done -# echo "" -# -# # /etc/synoinfo.conf -# setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) -# IFS=',' read -r -a eunits_array2 <<< "$setting2" -# for e in "${eunits_array2[@]}"; do -# if [[ ${eunits_array[*]} =~ $e ]]; then -# echo -e "${Cyan}${e#Synology-}${Off} is enabled in ${Yellow}${synoinfo2}${Off}" -# fi -# done -# echo "" - - for e in "${eunits_array[@]}"; do - check_modeldtb "${e#Synology-}" + echo "" + for e in "${supported_eunits[@]}"; do + if grep -q --text "$e" "${dtb_file}"; then + check_modeldtb "${e#Synology-}" + fi done echo "" } if [[ $check == "yes" ]]; then - echo "" + #echo "" check_enabled exit fi -show_enabled(){ -# synoinfo.conf support_ew_20_eunit related to extended warranty -# # /etc.defaults/synoinfo.conf -# setting=$(/usr/syno/bin/synogetkeyvalue "$synoinfo" support_ew_20_eunit) -# IFS=',' read -r -a eunits_array <<< "$setting" -# # /etc/synoinfo.conf -# setting2=$(/usr/syno/bin/synogetkeyvalue "$synoinfo2" support_ew_20_eunit) -# IFS=',' read -r -a eunits_array2 <<< "$setting2" - - for e in "${eunits_array[@]}"; do - count="1" - if [[ ${eunits_array2[*]} =~ $e ]]; then - count=$((count +1)) - fi - if grep --text "${e#Synology-}" "${dtb_file}" >/dev/null; then - count=$((count +1)) - fi - if grep --text "${e#Synology-}" "${dtb2_file}" >/dev/null; then - count=$((count +1)) - fi - if [[ $count == "4" ]]; then - echo -e "${Cyan}${e#Synology-}${Off} is enabled" - else - echo -e "${Cyan}${e#Synology-}${Off} ${Yellow}partially${Off} enabled" - fi - done - echo "" -} - - #------------------------------------------------------------------------------ # Enable unsupported Synology expansion units @@ -766,30 +682,6 @@ backupdb(){ return 0 } -edit_synoinfo(){ -# synoinfo.conf support_ew_20_eunit related to extended warranty - - # $1 is the eunit model - if [[ -n $1 ]]; then - # Check if already enabled in synoinfo.conf - # support_ew_20_eunit="Synology-DX517,Synology-RX418" - setting=$(synogetkeyvalue "$synoinfo" support_ew_20_eunit) - if [[ $setting != *"$1"* ]]; then - #backupdb "$synoinfo" long || exit 1 # debug - backupdb "$synoinfo" || exit 1 # Failed to backup file - newsetting="${setting},Synology-${1}" - if synosetkeyvalue "$synoinfo" support_ew_20_eunit "$newsetting"; then - synosetkeyvalue "$synoinfo2" support_ew_20_eunit "$newsetting" - echo -e "Enabled ${Cyan}$1${Off} in ${Yellow}synoinfo.conf${Off}" >&2 - else - echo -e "${Error}ERROR 9${Off} Failed to enable $1 in synoinfo.conf!" >&2 - fi - else - echo -e "${Cyan}$1${Off} already enabled in ${Yellow}synoinfo.conf${Off}" >&2 - fi - fi -} - dts_ebox(){ # $1 is the ebox model # $2 is the dts file @@ -1102,7 +994,7 @@ edit_modeldtb(){ # Edit model.dts for c in "${eboxs[@]}"; do # Edit model.dts if needed - if ! grep "$c" "$dtb_file" >/dev/null; then + if ! grep -q "$c" "$dtb_file"; then dts_ebox "$c" "$dts_file" echo -e "Added ${Cyan}$c${Off} to ${Yellow}model${hwrev}.dtb${Off}" >&2 reboot=yes @@ -1130,37 +1022,27 @@ edit_modeldtb(){ # Select expansion unit to enable # Show currently enabled eunit(s) -show_enabled +check_enabled enable_eunit(){ case "$choice" in DX517|DX513|DX510) - # synoinfo.conf support_ew_20_eunit related to extended warranty - #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; DX213) - # synoinfo.conf support_ew_20_eunit related to extended warranty - #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; RX418|RX415|RX410) - # synoinfo.conf support_ew_20_eunit related to extended warranty - #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; RX1217rp|RX1217|RX1214rp|RX1214|RX1211rp|RX1211) - # synoinfo.conf support_ew_20_eunit related to extended warranty - #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; DX1215II|DX1215|DX1211) - # synoinfo.conf support_ew_20_eunit related to extended warranty - #edit_synoinfo "$choice" eboxs=("$choice") && edit_modeldtb return ;; @@ -1184,8 +1066,7 @@ enable_eunit(){ _12bays=("RX1217rp" "RX1217" "RX1214rp" "RX1214" "RX1211rp" "RX1211" \ "DX1215II" "DX1215" "DX1211") -eunits=("Check" \ -"DX517" "DX513" "DX213" "DX510" "RX418" "RX415" "RX410" \ +eunits=("DX517" "DX513" "DX213" "DX510" "RX418" "RX415" "RX410" \ "RX1217rp" "RX1217" "RX1214rp" "RX1214" "RX1211rp" "RX1211" \ "DX1215II" "DX1215" "DX1211" \ "Restore" "Quit") @@ -1205,6 +1086,7 @@ else select choice in "${eunits[@]}"; do echo -e "You selected $choice \n" enable_eunit + break done fi #echo "" From 2d519725efc03d3f3ab966ed0b98d5fc0f855022 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:09:15 +1000 Subject: [PATCH 11/13] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f99e0c..d5d235b 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,9 @@ sudo -s /volume1/scripts/syno_enable_eunit.sh -r, --restore Restore from backups to undo changes --unit=EUNIT Automatically enable specified expansion unit Only needed when script is scheduled - EUNIT is dx517, dx513, dx213, dx510, rx418, rx415 or rx410 + EUNIT is dx517, dx513, dx213, dx510, rx418, rx415, + rx410, rx1217rp, rx1217, rx1214r, rx1214, rxX1211rp, + rx1211, dx1215ii, dx1215 or dx1211 -e, --email Disable colored text in output scheduler emails --autoupdate=AGE Auto update script (useful when script is scheduled) AGE is how many days old a release must be before From d7b8478d847284d0a0f3842458a2d1d7b7d3424b Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:26:30 +1000 Subject: [PATCH 12/13] Update README.md --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d5d235b..ac0eb33 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ If you have 2 of the same expansion unit model you only need to enable it once f ## Supported NAS Models +### Models with eSATA expansion ports + This script will work for eSATA expansion units with the following Synology NAS models: | Model | Works | Confirmed | @@ -43,17 +45,18 @@ This script will work for eSATA expansion units with the following Synology NAS - The DiskStation models above already have DX517 enabled. - The RackStation models above already have RX418 enabled. +### Models with InfiniBand expansion ports + This script will work for InfiniBand expansion units with the following Synology NAS models: | Model | Works | Confirmed | |---------|-------|-----------| -| RS2421+ | yes | | -| RS2421RP+ | yes | | +| RS2421+, RS2421RP+ | yes | | | RS2821RP+ | yes | | - The RackStation models above already have RX1217RP and RX1217 enabled. -## eSATA expansion unit speeds +### eSATA expansion unit speeds | Model | eSATA Speed | Notes | |-------|-------------|-------| @@ -67,6 +70,17 @@ This script will work for InfiniBand expansion units with the following Synology | DX510 | 1.5 Gbps | 150 MB/s | | RX410 | 1.5 Gbps | 150 MB/s | +### InfiniBand expansion unit speeds + +| Model | InfiniBand Speed | Notes | +|-------|-------------|-------| +| RX1217, RX1217RP | 4 x 6 Gbps | 4 x 600 MB/s | +| DX1215II, DX1215 | 4 x 6 Gbps | 4 x 600 MB/s | +| | | +| RX1214, RX1214RP | 4 x 3 Gbps | 4 x 300 MB/s | +| | | +| RX1211, RX1211RP | 4 x 1.5 Gbps | 4 x 150 MB/s | +| DX1211 | 4 x 1.5 Gbps | 4 x 150 MB/s | ## Download the script From 01136d27197c1e8c807c7eb11fc7cfcb8ec5a87b Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sat, 17 Aug 2024 18:32:16 +1000 Subject: [PATCH 13/13] Update README.md --- README.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ac0eb33..cf4cd5b 100644 --- a/README.md +++ b/README.md @@ -45,18 +45,7 @@ This script will work for eSATA expansion units with the following Synology NAS - The DiskStation models above already have DX517 enabled. - The RackStation models above already have RX418 enabled. -### Models with InfiniBand expansion ports - -This script will work for InfiniBand expansion units with the following Synology NAS models: - -| Model | Works | Confirmed | -|---------|-------|-----------| -| RS2421+, RS2421RP+ | yes | | -| RS2821RP+ | yes | | - -- The RackStation models above already have RX1217RP and RX1217 enabled. - -### eSATA expansion unit speeds +#### eSATA expansion unit speeds | Model | eSATA Speed | Notes | |-------|-------------|-------| @@ -70,17 +59,27 @@ This script will work for InfiniBand expansion units with the following Synology | DX510 | 1.5 Gbps | 150 MB/s | | RX410 | 1.5 Gbps | 150 MB/s | -### InfiniBand expansion unit speeds +### Models with InfiniBand expansion ports + +This script will work for InfiniBand expansion units with the following Synology NAS models: + +| Model | Works | Confirmed | +|---------|-------|-----------| +| RS2421+, RS2421RP+ | yes | | +| RS2821RP+ | yes | | + +- The RackStation models above already have RX1217RP and RX1217 enabled. + +#### InfiniBand expansion unit speeds | Model | InfiniBand Speed | Notes | |-------|-------------|-------| | RX1217, RX1217RP | 4 x 6 Gbps | 4 x 600 MB/s | | DX1215II, DX1215 | 4 x 6 Gbps | 4 x 600 MB/s | +| RX1214, RX1214RP | 4 x 6 Gbps | 4 x 600 MB/s | | | | -| RX1214, RX1214RP | 4 x 3 Gbps | 4 x 300 MB/s | -| | | -| RX1211, RX1211RP | 4 x 1.5 Gbps | 4 x 150 MB/s | -| DX1211 | 4 x 1.5 Gbps | 4 x 150 MB/s | +| RX1211, RX1211RP | 4 x 3 Gbps | 4 x 300 MB/s | +| DX1211 | 4 x 3 Gbps | 4 x 300 MB/s | ## Download the script