Allow multiple strategies on editor resolution
This commit is contained in:
parent
00d1fa3ff0
commit
7868149bbf
3 changed files with 20 additions and 18 deletions
|
@ -17,7 +17,8 @@ package_conflict_input_parser() {
|
|||
|
||||
$EDITOR "$input"
|
||||
|
||||
choices="$(cat "$input" | grep -v '^#' | grep '.')" > "$input_choices"
|
||||
choices="$(cat "$input" | grep -v '^#' | grep '.')"
|
||||
echo "$choices" > "$input_choices"
|
||||
|
||||
# validation
|
||||
while read -r action package; do
|
||||
|
@ -35,25 +36,27 @@ package_conflict_input_parser() {
|
|||
elif [ "$action" = skip ] || [ "$action" = s ]; then
|
||||
log debug "[package_conflict_input_parser] Skipped: $package"
|
||||
else
|
||||
log user "Invalid action provided: $action"
|
||||
log user "Invalid action provided for $package: $action"
|
||||
fi
|
||||
done < "$input_choices"
|
||||
|
||||
# actual system or configuration change
|
||||
echo "$choices" | while read -r action package; do
|
||||
if [ "$action" = install ] || [ "$action" = i ]; then
|
||||
if [ -n "$packages_to_install" ]; then
|
||||
package_manager install "$packages_to_install"
|
||||
elif [ "$action" = uninstall ] || [ "$action" = u ]; then
|
||||
debug info "Calling package manager to uninstall $packages_to_uninstall"
|
||||
package_manager uninstall "$packages_to_uninstall"
|
||||
elif [ "$action" = add ] || [ "$action" = a ]; then
|
||||
track_packages "$package"
|
||||
elif [ "$action" = remove ] || [ "$action" = r ]; then
|
||||
untrack_packages "$package"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ -n "$packages_to_uninstall" ]; then
|
||||
package_manager uninstall "$packages_to_uninstall"
|
||||
fi
|
||||
|
||||
if [ -n "$packages_to_track" ]; then
|
||||
track_packages "$packages_to_track"
|
||||
fi
|
||||
|
||||
if [ -n "$packages_to_untrack" ]; then
|
||||
untrack_packages "$packages_to_untrack"
|
||||
fi
|
||||
}
|
||||
|
||||
help_text_generator() {
|
||||
local conflict_type="$1"
|
||||
|
|
|
@ -9,10 +9,10 @@ track_packages() {
|
|||
untrack_packages() {
|
||||
local packages="$1"
|
||||
|
||||
log debug "[untrack_packages] Removing packages: $packages"
|
||||
log info "[untrack_packages] Removing packages: $packages"
|
||||
|
||||
echo "$packages" | xargs | sed 's/ /\n/g' | while read -r package; do
|
||||
sed -i '' "/^[[:space:]]*$package[[:space:]]*$/d" "$CONFIG_ROOT/packages"
|
||||
log debug "[untrack_packages] Executed removal for $package with exit code $?"
|
||||
log info "[untrack_packages] Executed removal for $package with exit code $?"
|
||||
done
|
||||
}
|
||||
|
|
1
tori
1
tori
|
@ -69,7 +69,6 @@ check_core_paths() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
[ -n "$DEBUG" ] && echo "TORI_ROOT: $TORI_ROOT"
|
||||
}
|
||||
|
||||
main "$1" "$2"
|
||||
|
|
Loading…
Reference in a new issue