it hopefuully works now

This commit is contained in:
Michael Rodin 2023-09-02 21:38:47 +02:00
parent 062bddbeec
commit 0435efe615

View file

@ -23,7 +23,7 @@ recursive_backup() {
if [[ ${k///} == $k ]]; then filepath="."; else filepath=${k%/*}; fi # if file in root of dir, change the path to not crash everything ,else get filepath
draw_progress $(($progress)) "$k" "$action"
#remotehash="$(cat $hashtemp | grep -n "$k")" # old databese
sqlcommand="SELECT hash FROM files WHERE backpath=\"${k}\""
sqlcommand="SELECT hash FROM files WHERE backpath=\"${k}\";"
remotehash="""$(sqlite3 $hashtemp "$sqlcommand")""" # get hash from database
if [[ -z $remotehash ]]; then entryexists=false; else entryexists=true; fi # if file entry (and hash) exists, save as bool
localhash="$(md5sum "$k")" # hash of local version of file
@ -64,7 +64,7 @@ backup() { # backup 1:<file> 2:<remotedir>
else
if [[ "$enctype" == "gpg" ]]; then encdata="$RECIPIENT_ID"
else encdata=""; fi
sqlcommand="INSERT INTO files(backpath,localroot,hash,backupenc,encdata) VALUES(\'${2}\',\'$(pwd)\',\'$localhash\',\'${enctype}\',\'${encdata}\')"
sqlcommand="INSERT INTO files(backpath,localroot,hash,backupenc,encdata) VALUES(\"${k}\",\"$(pwd)\",\"$localhash\",\"${enctype}\",\"${encdata}\");"
sqlite3 $hashtemp "$sqlcommand"
fi
}