Skip to content

Commit

Permalink
Merge pull request #26 from 007revad/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
007revad authored Mar 22, 2023
2 parents 52190de + 49a9a95 commit bb0beaf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
v2.1.19
v1.2.20
- Added a timeouts when checking for newer script version in case github is down or slow.
- Fixed change log (v1.2.19 and v1.2.18 were listed as v2.2.19 and v2.2.19).

v1.2.19
- Minor change to check new version code.

v2.2.18
v1.2.18
- Minor shell output formatting fix.

v1.2.17
Expand Down
16 changes: 12 additions & 4 deletions syno_hdd_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
# It's also parsed and checked and probably in some cases it could be more critical to patch that one instead.

# DONE
# Added a timeouts when checking for newer script version in case github is down or slow.
#
# Added option to disable incompatible memory notifications.
#
# Now finds your expansion units' model numbers and adds your drives to their db files.
Expand Down Expand Up @@ -84,7 +86,7 @@
# Optionally disable "support_disk_compatibility".


scriptver="v1.2.19"
scriptver="v1.2.20"
script=Synology_HDD_db
repo="007revad/Synology_HDD_db"

Expand Down Expand Up @@ -204,7 +206,6 @@ productversion=$(get_key_value /etc.defaults/VERSION productversion)
buildphase=$(get_key_value /etc.defaults/VERSION buildphase)
if [[ $buildphase == GM ]]; then buildphase=""; fi
echo "$model DSM $productversion $buildphase"
echo ""


# Convert model to lower case
Expand All @@ -213,16 +214,22 @@ model=${model,,}
# Check for dodgy characters after model number
if [[ $model =~ 'pv10-j'$ ]]; then # GitHub issue #10
model=${model%??????}+ # replace last 6 chars with +
echo "Using model: $model"
elif [[ $model =~ '-j'$ ]]; then # GitHub issue #2
model=${model%??} # remove last 2 chars
echo "Using model: $model"
fi

echo "" # To keep output readable


#------------------------------------------------------------------------------
# Check latest release with GitHub API

get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
# Curl timeout options:
# https://unix.stackexchange.com/questions/94604/does-curl-have-a-timeout
curl --silent -m 10 --connect-timeout 5 "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
Expand Down Expand Up @@ -252,7 +259,8 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" |
echo -e "${Cyan}Do you want to download $tag now?${Off} {y/n]"
read -r -t 30 reply
if [[ ${reply,,} == "y" ]]; then
if ! curl -LJO "https://github.com/$repo/archive/refs/tags/$tag.tar.gz"; then
if ! curl -LJO -m 30 --connect-timeout 5 "https://github.com/$repo/archive/refs/tags/$tag.tar.gz";
then
echo -e "${Error}ERROR ${Off} Failed to download $script-$shorttag.tar.gz!"
else
if [[ -f $HOME/$script-$shorttag.tar.gz ]]; then
Expand Down

0 comments on commit bb0beaf

Please sign in to comment.