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

View File

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