Compare commits

...

2 Commits

Author SHA1 Message Date
007revad ceea30c7f0 v3.6.129 2 weeks ago
007revad aba32f6796 v3.6.128 2 weeks ago
  1. 6
      CHANGES.txt
  2. 30
      syno_hdd_db.sh

6
CHANGES.txt

@ -1,3 +1,9 @@
v3.6.129
- Bug fix for backing up expansion unit db files (introduced in v3.6.126).
v3.6.128
- Bug fix for trying to backup "*_v7.db.version" instead of "*_v7.version".
v3.6.127 v3.6.127
- Bug fix for trying to backup "*_v7.db.version" instead of "*_v7.version". - Bug fix for trying to backup "*_v7.db.version" instead of "*_v7.version".
- Bug fix for 6 TB drives having '"size_gb": 6001' in db files instead of '"size_gb": 6000'. - Bug fix for 6 TB drives having '"size_gb": 6001' in db files instead of '"size_gb": 6000'.

30
syno_hdd_db.sh

@ -29,7 +29,7 @@
# /var/packages/StorageManager/target/ui/storage_panel.js # /var/packages/StorageManager/target/ui/storage_panel.js
scriptver="v3.6.127" scriptver="v3.6.129"
script=Synology_HDD_db script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
scriptname=syno_hdd_db scriptname=syno_hdd_db
@ -1362,23 +1362,13 @@ fi
# Check databases and add our drives if needed # Check databases and add our drives if needed
# Host db files # Host db files
#db1list=($(find "$dbpath" -maxdepth 1 -name "*_host*.db"))
#db2list=($(find "$dbpath" -maxdepth 1 -name "*_host*.db.new"))
#db1list=($(find "$dbpath" -maxdepth 1 -regextype posix-extended\
# -iregex ".*_host(_v7)?.db"))
#db2list=($(find "$dbpath" -maxdepth 1 -regextype posix-extended\
# -iregex ".*_host(_v7)?.db.new"))
readarray -t db1list < <(find "$dbpath" -maxdepth 1 -name "*_host*.db" | sort) readarray -t db1list < <(find "$dbpath" -maxdepth 1 -name "*_host*.db" | sort)
readarray -t db2list < <(find "$dbpath" -maxdepth 1 -name "*_host*.db.new" | sort) readarray -t db2list < <(find "$dbpath" -maxdepth 1 -name "*_host*.db.new" | sort)
# Expansion Unit db files # Expansion Unit db files
for i in "${!eunits[@]}"; do for i in "${eunits[@]}"; do
#eunitdb1list+=($(find "$dbpath" -maxdepth 1 -name "${eunits[i],,}*.db")) readarray -t -O "${#eunitdb1list[@]}" eunitdb1list < <(find "$dbpath" -maxdepth 1 -name "${i,,}*.db" | sort)
eunitdb1list+=("$(find "$dbpath" -maxdepth 1 -regextype posix-extended\ readarray -t -O "${#eunitdb2list[@]}" eunitdb2list < <(find "$dbpath" -maxdepth 1 -name "${i,,}*.db.new" | sort)
-iregex ".*${eunits[i],,}(_v7)?.db")")
#eunitdb2list+=($(find "$dbpath" -maxdepth 1 -name "${eunits[i],,}*.db.new"))
eunitdb2list+=("$(find "$dbpath" -maxdepth 1 -regextype posix-extended\
-iregex ".*${eunits[i],,}(_v7)?.db.new")")
done done
# M.2 Card db files # M.2 Card db files
@ -1436,7 +1426,9 @@ backupdb(){
echo -e "Backed up ${fname}" >&2 echo -e "Backed up ${fname}" >&2
if [[ "${1##*.}" == "db" ]]; then if [[ "${1##*.}" == "db" ]]; then
# Backup db version file as well # Backup db version file as well
cp -p "$1.version" "$1.bakver" if [[ -f "${1%.db}.version" ]]; then
cp -p "${1%.db}.version" "${1%.db}.bakver"
fi
fi fi
else else
echo -e "${Error}ERROR 5${Off} Failed to backup ${fname}!" >&2 echo -e "${Error}ERROR 5${Off} Failed to backup ${fname}!" >&2
@ -1446,7 +1438,9 @@ backupdb(){
# Only .db files have version files # Only .db files have version files
if [[ ! -f "${1%.db}.bakver" ]]; then if [[ ! -f "${1%.db}.bakver" ]]; then
# Existing backup has no .bakver file, create one # Existing backup has no .bakver file, create one
cp -p "${1%.db}.version" "${1%.db}.bakver" if [[ -f "${1%.db}.version" ]]; then
cp -p "${1%.db}.version" "${1%.db}.bakver"
fi
fi fi
bakversion=$(cat "${1%.db}.bakver" 2>/dev/null) bakversion=$(cat "${1%.db}.bakver" 2>/dev/null)
newversion=$(cat "${1%.db}.version" 2>/dev/null) newversion=$(cat "${1%.db}.version" 2>/dev/null)
@ -1455,7 +1449,9 @@ backupdb(){
if cp -p "$1" "$1.bak"; then if cp -p "$1" "$1.bak"; then
echo -e "Backed up ${fname}" >&2 echo -e "Backed up ${fname}" >&2
# Update db version backup as well # Update db version backup as well
cp -p "${1%.db}.version" "${1%.db}.bakver" if [[ -f "${1%.db}.version" ]]; then
cp -p "${1%.db}.version" "${1%.db}.bakver"
fi
else else
echo -e "${Error}ERROR 5${Off} Failed to backup ${fname}!" >&2 echo -e "${Error}ERROR 5${Off} Failed to backup ${fname}!" >&2
return 1 return 1

Loading…
Cancel
Save