Scaffold file comparison structure
This commit is contained in:
parent
21b5f8ff2d
commit
91c4f6be4c
4 changed files with 24 additions and 1 deletions
|
@ -6,4 +6,5 @@ check() {
|
||||||
log debug "collected bkp files:\n$bkp_files"
|
log debug "collected bkp files:\n$bkp_files"
|
||||||
|
|
||||||
scan_packages
|
scan_packages
|
||||||
|
merge_base "$base_files"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ scan_directory() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$files"
|
printf "%b" "$files"
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_packages() {
|
scan_packages() {
|
||||||
|
|
20
src/file/merge_base.sh
Normal file
20
src/file/merge_base.sh
Normal 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
|
||||||
|
}
|
|
@ -9,3 +9,5 @@
|
||||||
. "$TORI_ROOT/src/package/validate_input_packages.sh"
|
. "$TORI_ROOT/src/package/validate_input_packages.sh"
|
||||||
. "$TORI_ROOT/src/package/package_conflict_input_parser.sh"
|
. "$TORI_ROOT/src/package/package_conflict_input_parser.sh"
|
||||||
. "$TORI_ROOT/src/package/update_package_cache.sh"
|
. "$TORI_ROOT/src/package/update_package_cache.sh"
|
||||||
|
|
||||||
|
. "$TORI_ROOT/src/file/merge_base.sh"
|
||||||
|
|
Loading…
Reference in a new issue