Implement "Add/remove all from configuration" package conflict resolution strategy #1
4 changed files with 30 additions and 1 deletions
|
@ -5,5 +5,6 @@
|
|||
|
||||
. "$TORI_ROOT/src/package/package_manager.sh"
|
||||
. "$TORI_ROOT/src/package/package_conflict_resolution.sh"
|
||||
. "$TORI_ROOT/src/package/package_tracking.sh"
|
||||
. "$TORI_ROOT/src/package/validate_input_packages.sh"
|
||||
. "$TORI_ROOT/src/package/update_package_cache.sh"
|
||||
|
|
|
@ -48,6 +48,12 @@ not_on_configuration_dialog() {
|
|||
else
|
||||
not_on_configuration_dialog "$conflicted_packages"
|
||||
fi
|
||||
elif [ "$strategy" = 3 ]; then
|
||||
track_packages "$conflicted_packages"
|
||||
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"
|
||||
else
|
||||
log debug "[resolve_packages] Unexpected input: $strategy"
|
||||
not_on_configuration_dialog "$conflicted_packages"
|
||||
|
@ -81,6 +87,12 @@ not_installed_dialog() {
|
|||
else
|
||||
not_on_configuration_dialog "$conflicted_packages"
|
||||
fi
|
||||
elif [ "$strategy" = 3 ]; then
|
||||
untrack_packages "$conflicted_packages"
|
||||
elif [ "$strategy" = 4 ]; then
|
||||
read -r -p "Enter space-separated packages to remove from the configuation: " input_packages
|
||||
log debug "Input: input_packages = $input_packages"
|
||||
untrack_packages "$input_packages"
|
||||
else
|
||||
log debug "[resolve_packages] Unexpected input: $strategy"
|
||||
not_installed_dialog "$conflicted_packages"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package_manager() {
|
||||
local command="$1"
|
||||
local output
|
||||
|
||||
local manager
|
||||
local authorizer="sudo"
|
||||
|
|
17
src/package/package_tracking.sh
Normal file
17
src/package/package_tracking.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
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
|
||||
}
|
||||
|
||||
untrack_packages() {
|
||||
local packages="$1"
|
||||
|
||||
echo "$packages" | xargs | sed 's/ /\n/g' | while read -r package; do
|
||||
sed -i '' "/^$package$/d" "$CONFIG_ROOT/packages"
|
||||
done
|
||||
}
|
Loading…
Reference in a new issue