diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 34998f2..a650005 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -27,9 +27,10 @@ # Now warns if script is located on an M.2 volume. -scriptver="v3.3.74" +scriptver="v3.3.75" script=Synology_HDD_db repo="007revad/Synology_HDD_db" +scriptname=syno_hdd_db # Check BASH variable is bash if [ ! "$(basename "$BASH")" = bash ]; then @@ -296,9 +297,9 @@ echo "Running from: ${scriptpath}/$scriptfile" # Warn if script located on M.2 drive scriptvol=$(echo "$scriptpath" | cut -d"/" -f2) vg=$(lvdisplay | grep /volume_"${scriptvol#volume}" | cut -d"/" -f3) -md=$(pvdisplay | grep -B 1 "$vg" | grep /dev/ | cut -d"/" -f3) +md=$(pvdisplay | grep -B 1 -E '[ ]'"$vg" | grep /dev/ | cut -d"/" -f3) if cat /proc/mdstat | grep "$md" | grep nvme >/dev/null; then - echo "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" + echo -e "${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" fi @@ -381,7 +382,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | fi # Copy new script sh file to script location - if ! cp -p "/tmp/$script-$shorttag/syno_hdd_db.sh" "${scriptpath}/${scriptfile}"; + if ! cp -p "/tmp/$script-$shorttag/${scriptname}.sh" "${scriptpath}/${scriptfile}"; then copyerr=1 echo -e "${Error}ERROR${Off} Failed to copy"\ @@ -410,10 +411,12 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | fi fi - # Copy new CHANGES.txt file + # Copy new CHANGES.txt file to script location (if script on a volume) if [[ $scriptpath =~ /volume* ]]; then # Copy new CHANGES.txt file to script location - if ! cp -p "/tmp/$script-$shorttag/CHANGES.txt" "$scriptpath"; then + if ! cp -p "/tmp/$script-$shorttag/CHANGES.txt"\ + "${scriptpath}/${scriptname}_CHANGES.txt"; + then if [[ $autoupdate != "yes" ]]; then copyerr=1; fi echo -e "${Error}ERROR${Off} Failed to copy"\ "$script-$shorttag/CHANGES.txt to:\n $scriptpath" @@ -424,7 +427,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | echo -e "${Error}ERROR${Off} Failed to set permissions on:" echo "$scriptpath/CHANGES.txt" fi - changestxt=", changes.txt" + changestxt=" and changes.txt" fi fi @@ -433,7 +436,7 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | # Notify of success (if there were no errors) if [[ $copyerr != 1 ]] && [[ $permerr != 1 ]]; then - echo -e "\n$tag$changestxt$vids_txt downloaded to: ${scriptpath}\n" + echo -e "\n$tag ${scriptfile}$vids_txt$changestxt downloaded to: ${scriptpath}\n" syslog_set info "$script successfully updated to $tag" # Reload script