Browse Source

Update syno_hdd_db.sh

pull/48/head
007revad 3 years ago
committed by GitHub
parent
commit
bcbe11b3bd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      syno_hdd_db.sh

17
syno_hdd_db.sh

@ -230,7 +230,7 @@ smallfixnumber=$(get_key_value /etc.defaults/VERSION smallfixnumber)
# Show DSM full version and model # Show DSM full version and model
if [[ $buildphase == GM ]]; then buildphase=""; fi if [[ $buildphase == GM ]]; then buildphase=""; fi
if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi
echo -e "$model DSM $productversion-$buildnumber$smallfix $buildphase\n" echo "$model DSM $productversion-$buildnumber$smallfix $buildphase"
# Convert model to lower case # Convert model to lower case
@ -239,13 +239,13 @@ model=${model,,}
# Check for dodgy characters after model number # Check for dodgy characters after model number
if [[ $model =~ 'pv10-j'$ ]]; then # GitHub issue #10 if [[ $model =~ 'pv10-j'$ ]]; then # GitHub issue #10
model=${model%??????}+ # replace last 6 chars with + model=${model%??????}+ # replace last 6 chars with +
echo "Using model: $model" echo -e "\nUsing model: $model"
elif [[ $model =~ '-j'$ ]]; then # GitHub issue #2 elif [[ $model =~ '-j'$ ]]; then # GitHub issue #2
model=${model%??} # remove last 2 chars model=${model%??} # remove last 2 chars
echo "Using model: $model" echo -e "\nUsing model: $model"
fi fi
echo "" # To keep output readable #echo "" # To keep output readable
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -280,7 +280,7 @@ scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
if ! printf "%s\n%s\n" "$tag" "$scriptver" | if ! printf "%s\n%s\n" "$tag" "$scriptver" |
sort --check --version-sort &> /dev/null ; then sort --check --version-sort &> /dev/null ; then
echo -e "${Cyan}There is a newer version of this script available.${Off}" echo -e "\n${Cyan}There is a newer version of this script available.${Off}"
echo -e "Current version: ${scriptver}\nLatest version: $tag" echo -e "Current version: ${scriptver}\nLatest version: $tag"
if [[ -f $scriptpath/$script-$shorttag.tar.gz ]]; then if [[ -f $scriptpath/$script-$shorttag.tar.gz ]]; then
# They have the latest version tar.gz downloaded but are using older version # They have the latest version tar.gz downloaded but are using older version
@ -501,9 +501,9 @@ fi
# Check hdds array isn't empty # Check hdds array isn't empty
if [[ ${#hdds[@]} -eq "0" ]]; then if [[ ${#hdds[@]} -eq "0" ]]; then
echo -e "${Error}ERROR${Off} No drives found!" && exit 2 echo -e "\n${Error}ERROR${Off} No drives found!" && exit 2
else else
echo "HDD/SSD models found: ${#hdds[@]}" echo -e "\nHDD/SSD models found: ${#hdds[@]}"
num="0" num="0"
while [[ $num -lt "${#hdds[@]}" ]]; do while [[ $num -lt "${#hdds[@]}" ]]; do
echo "${hdds[num]}" echo "${hdds[num]}"
@ -962,7 +962,8 @@ if [[ ${showedits,,} == "yes" ]]; then
getdbtype "$db1" getdbtype "$db1"
if [[ $dbtype -gt "6" ]];then if [[ $dbtype -gt "6" ]];then
# Show last 12 lines per drive + 4 # Show last 12 lines per drive + 4
lines=$(((db1Edits *12) +4)) #lines=$(((db1Edits *12) +4)) # without firmware version
lines=$(((db1Edits *21) +4)) # with firmware version
if [[ $db1Edits -gt "0" ]]; then if [[ $db1Edits -gt "0" ]]; then
echo -e "\nChanges to ${Cyan}$(basename -- "$db1")${Off}" echo -e "\nChanges to ${Cyan}$(basename -- "$db1")${Off}"
jq . "$db1" | tail -n "$lines" jq . "$db1" | tail -n "$lines"

Loading…
Cancel
Save