Implement "Add/remove all from configuration" package conflict resolution strategy #1

Merged
jutty merged 5 commits from all-in-configuration-strategy into main 2024-07-14 12:27:51 +02:00
2 changed files with 10 additions and 8 deletions
Showing only changes of commit f1361bbad2 - Show all commits

View file

@ -45,19 +45,23 @@ not_on_configuration_dialog() {
log debug "Input: input_packages = $input_packages"
if validate_input_packages "$input_packages"; then
package_manager uninstall "$input_packages"
else
not_on_configuration_dialog "$conflicted_packages"
fi
elif [ "$strategy" = 3 ]; then
track_packages "$conflicted_packages"
if validate_input_packages "$conflicted_packages"; then
track_packages "$conflicted_packages"
fi
elif [ "$strategy" = 4 ]; then
read -r -p "Enter space-separated packages to add to the configuation: " input_packages
log debug "Input: input_packages = $input_packages"
track_packages "$input_packages"
if validate_input_packages "$input_packages"; then
track_packages "$input_packages"
fi
else
log debug "[resolve_packages] Unexpected input: $strategy"
not_on_configuration_dialog "$conflicted_packages"
fi
check
}
not_installed_dialog() {
@ -84,8 +88,6 @@ not_installed_dialog() {
log debug "Input: input_packages = $input_packages"
if validate_input_packages "$input_packages"; then
package_manager install "$input_packages"
else
not_on_configuration_dialog "$conflicted_packages"
fi
elif [ "$strategy" = 3 ]; then
untrack_packages "$conflicted_packages"
@ -97,4 +99,6 @@ not_installed_dialog() {
log debug "[resolve_packages] Unexpected input: $strategy"
not_installed_dialog "$conflicted_packages"
fi
check
}

View file

@ -1,8 +1,6 @@
track_packages() {
local packages="$1"
validate_input_packages "$packages"
echo "$packages" | xargs | sed 's/ /\n/g' | while read -r package; do
echo "$package" >> "$CONFIG_ROOT/packages"
done