Skip to content

Commit

Permalink
Merge pull request #10 from 007revad/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
007revad authored Nov 17, 2024
2 parents 1a7261f + 129b7b4 commit a91cb92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v1.2.9
- Bug fix for skipping some drives in models that use sda, sdb etc. Issue #9

v1.2.8
- Enabled support for USB HDDs and SSD drives (skips USB flash drives).

Expand Down
19 changes: 16 additions & 3 deletions syno_smart_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# https://www.disktuna.com/seagate-raw-smart-attributes-to-error-convertertest/#102465319
#------------------------------------------------------------------------------

scriptver="v1.2.8"
scriptver="v1.2.9"
script=Synology_SMART_info
repo="007revad/Synology_SMART_info"

Expand Down Expand Up @@ -460,14 +460,27 @@ not_flash_drive(){
fi
}

is_usb(){
# $1 is /dev/sda or /sys/block/sda etc
if realpath /sys/block/"$(basename "$1")" | grep -q usb; then
return 0
else
return 1
fi
}

# Add drives to drives array
for d in /sys/block/*; do
# $d is /sys/block/sata1 etc
case "$(basename -- "${d}")" in
sd*|hd*)
if [[ $d =~ [hs]d[a-z][a-z]?$ ]]; then
if not_flash_drive "$d"; then
drives+=("$(basename -- "${d}")")
if is_usb "$d"; then # Add USB drives except flash drives
if not_flash_drive "$d"; then
drives+=("$(basename -- "${d}")")
fi
else
drives+=("$(basename -- "${d}")") # Add all other drives
fi
fi
;;
Expand Down

0 comments on commit a91cb92

Please sign in to comment.