Tree file management strategy and file backups #3

Merged
jutty merged 13 commits from file-copy into main 2024-09-03 17:14:39 +02:00
4 changed files with 24 additions and 1 deletions
Showing only changes of commit 91c4f6be4c - Show all commits

View file

@ -6,4 +6,5 @@ check() {
log debug "collected bkp files:\n$bkp_files"
scan_packages
merge_base "$base_files"
}

View file

@ -15,7 +15,7 @@ scan_directory() {
done
fi
echo "$files"
printf "%b" "$files"
}
scan_packages() {

20
src/file/merge_base.sh Normal file
View file

@ -0,0 +1,20 @@
merge_base() {
local base_files="$1"
local strategy=
for file in $base_files; do
log debug "[merge-base] Processing $file"
local absolute_path="$(echo "$file" | sed 's/^base//')"
log debug "[merge-base] Absolute path: $absolute_path"
local config_path="$CONFIG_ROOT/$file"
log debug "[merge-base] Config path: $config_path"
if diff "$absolute_path" "$config_path" > /dev/null; then
log debug "[merge-base] Files match"
else
log debug "[merge-base] Files differ"
strategy="$(ask "Configuration and system files differ" "Overwrite system,Overwrite config,Show difference")"
log debug "[merge-base] Chosen strategy: $strategy"
fi
done
}

View file

@ -9,3 +9,5 @@
. "$TORI_ROOT/src/package/validate_input_packages.sh"
. "$TORI_ROOT/src/package/package_conflict_input_parser.sh"
. "$TORI_ROOT/src/package/update_package_cache.sh"
. "$TORI_ROOT/src/file/merge_base.sh"