From 7be9e99b58ee50762fa553cf60455c16c1557200 Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:52:57 +1100 Subject: [PATCH 1/4] Update CHANGES.txt --- CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 2d49648..7ea3d09 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +v1.2.26 +- Added -ff option to pvcreate to prevent issues. + v1.2.25 - Minor bug fix. From 2de44fbae62dc608f24a635596fd4a08138e7bd0 Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Sun, 26 Mar 2023 07:55:23 +1100 Subject: [PATCH 2/4] Update CHANGES.txt --- CHANGES.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 7ea3d09..2d49648 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,3 @@ -v1.2.26 -- Added -ff option to pvcreate to prevent issues. - v1.2.25 - Minor bug fix. From a943707d3eb20ee91019441b18021eb77bd0da04 Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:17:56 +1100 Subject: [PATCH 3/4] Update syno_hdd_db.sh --- syno_hdd_db.sh | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 5c027d0..8ebbec4 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -31,7 +31,8 @@ # DONE # Changed to show if no M.2 cards were found, if M.2 drives were found. # -# Changed latest version check to download to /tmp and extract files to the script's location. +# Changed latest version check to download to /tmp and extract files to the script's location, +# replacing the existing .sh and readme.txt files. # # Added a timeouts when checking for newer script version in case github is down or slow. # @@ -89,7 +90,7 @@ # Optionally disable "support_disk_compatibility". -scriptver="v1.2.25" +scriptver="v1.2.26" script=Synology_HDD_db repo="007revad/Synology_HDD_db" @@ -121,10 +122,10 @@ Options: -f, --force Force DSM to not check drive compatibility -r, --ram Disable memory compatibility checking -h, --help Show this help message - -v, --version Show the version + -v, --version Show the script version EOF -exit 0 + exit 0 } @@ -134,13 +135,13 @@ $script $scriptver - by 007revad See https://github.com/$repo EOF -exit 0 + exit 0 } # Check for flags with getopt if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -a \ - -l showedits,noupdate,m2,force,ram,help,version -- "$@")"; then + -l showedits,noupdate,m2,force,ram,help,version,debug -- "$@")"; then eval set -- "$options" while true; do case "${1,,}" in @@ -165,6 +166,9 @@ if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -a \ -v|--version) # Show script version scriptversion ;; + --debug) # Show and log debug info + debug=yes + ;; --) shift break @@ -201,14 +205,15 @@ model=$(cat /proc/sys/kernel/syno_hw_version) # Show script version +#echo -e "$script $scriptver\ngithub.com/$repo\n" echo "$script $scriptver" -#echo "github.com/$repo" -# Show NAS info +# Show DSM full version productversion=$(get_key_value /etc.defaults/VERSION productversion) buildphase=$(get_key_value /etc.defaults/VERSION buildphase) +buildnumber=$(get_key_value /etc.defaults/VERSION buildnumber) if [[ $buildphase == GM ]]; then buildphase=""; fi -echo "$model DSM $productversion $buildphase" +echo "$model DSM $productversion-$buildnumber $buildphase" # Convert model to lower case @@ -255,7 +260,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | echo "https://github.com/$repo/releases/latest" sleep 10 else - echo -e "${Cyan}Do you want to download $tag now?${Off} {y/n]" + echo -e "${Cyan}Do you want to download $tag now?${Off} [y/n]" read -r -t 30 reply if [[ ${reply,,} == "y" ]]; then if cd /tmp; then @@ -267,19 +272,32 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | else if [[ -f /tmp/$script-$shorttag.tar.gz ]]; then # Extract tar file to script location - if ! tar -xf "/tmp/$script-$shorttag.tar.gz" -C "$scriptpath"; + if ! tar -xf "/tmp/$script-$shorttag.tar.gz" -C "/tmp"; then echo -e "${Error}ERROR ${Off} Failed to"\ "extract $script-$shorttag.tar.gz!" else + # Copy new files to script location + cp "/tmp/$script-$shorttag/CHANGES.txt" "$scriptpath" + cp "/tmp/$script-$shorttag/"*.sh "$scriptpath" + + # Delete downloaded .tar.gz file if ! rm "/tmp/$script-$shorttag.tar.gz"; then + delerr=1 echo -e "${Error}ERROR ${Off} Failed to delete"\ - "downloaded $script-$shorttag.tar.gz!" - else + "download /tmp/$script-$shorttag.tar.gz!" + fi + # Delete extracted tmp files + if ! rm -r "/tmp/$script-$shorttag"; then + delerr=1 + echo -e "${Error}ERROR ${Off} Failed to delete"\ + "download /tmp/$script-$shorttag!" + fi + if [[ $delerr != 1 ]]; then echo -e "\n$tag and changes.txt downloaded to:"\ "$scriptpath" echo -e "${Cyan}Do you want to stop this script"\ - "so you can run the new one?${Off} {y/n]" + "so you can run the new one?${Off} [y/n]" read -r reply if [[ ${reply,,} == "y" ]]; then exit; fi fi From 2c0295bce6323384b31b43920d14fe9aed252a7c Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:31:03 +1100 Subject: [PATCH 4/4] Update CHANGES.txt --- CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 2d49648..76ae8d4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +v1.2.26 +- Changed 'latest version check' to download and extract to /tmp then copy only the syno_hdd_db.sh and readme.txt files to the currrently running script's location. +- Minor tweaks to the shell output. + v1.2.25 - Minor bug fix.