quickfix: fix old files deletion

advise users to run cleandestinations
This commit is contained in:
Vincent Riquer 2026-02-15 05:20:25 +01:00 committed by ScriptFanix
parent 72f0c1aed8
commit bfad061264
3 changed files with 16 additions and 7 deletions

6
atom
View File

@ -224,8 +224,8 @@ do
do
removeFileId=${line%%::AtOM:SQL:Sep::*}
rest=${line#*::AtOM:SQL:Sep::}
removeFileDestName=${line%%::AtOM:SQL:Sep::*}
rest=${line#*::AtOM:SQL:Sep::}
removeFileDestName=${rest%%::AtOM:SQL:Sep::*}
rest=${rest#*::AtOM:SQL:Sep::}
removefile[$removeFileId]="${destinationpath["$removeFileDestName"]}/${rest%%::AtOM:SQL:Sep::*}"
read -u4 -r -d $'\0' line
done
@ -239,7 +239,7 @@ do
filename=${removefile[id]}
if [ -n "$filename" ]
then
if rm -f "$filename"
if rm "$filename"
then
Delete destination_files <<<"id = $id"
(( ++deleted ))

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
currentdbversion=7
currentdbversion=8
checkDatabaseVersion() {
local dbversion
if dbversion=$(Select atom version <<<"\"1\" = 1")
@ -15,9 +15,9 @@ checkDatabaseVersion() {
dbversion=$(Select atom version <<<"\"1\" = 1")
done
else
echo "Database schema version $dbversion is higher than
that of this version of AtOM
($currentdbversion). Bailing out." >&2
echo "Database schema version $dbversion is" \
"higher thanthat of this version of" \
"AtOM ($currentdbversion). Bailing out." >&2
exit $EDBVERSION
fi
else

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
upgradedatabase_6_7() {
echo "Upgrading database to version 8... (backup is $database.bak_v7)"
cp "$database" "$database.bak_v7"
echo 'Deletion of old files was failing. Users of previous versions (YOU!) are strongly advised to run cleandestinations with the "-r" flag.'
read -p "Press Enter to continue..."
Update atom version 8 <<<"1 = 1"
}