Compare commits
5 commits
45e299cc90
...
e95eefe666
Author | SHA1 | Date | |
---|---|---|---|
e95eefe666 | |||
cae379cbcb | |||
aa3b2fc876 | |||
f1361bbad2 | |||
6e18c205e9 |
6 changed files with 45 additions and 6 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
0.4.1 2024-07-14: Fixes "Cancel" option not exiting on package resolution
|
||||||
|
Fixes whitespace preventing package list matches on "remove all"
|
||||||
|
0.4.0 2024-07-14: "Add/remove all from configuration" resolution strategy
|
||||||
0.3.1 2024-07-13: Refactor, new docs page, make cache refresh lazier
|
0.3.1 2024-07-13: Refactor, new docs page, make cache refresh lazier
|
||||||
0.3.0 2024-07-11: "Enter packages to install/uninstall" resolution strategy
|
0.3.0 2024-07-11: "Enter packages to install/uninstall" resolution strategy
|
||||||
0.2.1 2024-07-10: Rename package_resolution.sh, document package conflicts
|
0.2.1 2024-07-10: Rename package_resolution.sh, document package conflicts
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
|
|
||||||
. "$TORI_ROOT/src/package/package_manager.sh"
|
. "$TORI_ROOT/src/package/package_manager.sh"
|
||||||
. "$TORI_ROOT/src/package/package_conflict_resolution.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/validate_input_packages.sh"
|
||||||
. "$TORI_ROOT/src/package/update_package_cache.sh"
|
. "$TORI_ROOT/src/package/update_package_cache.sh"
|
||||||
|
|
|
@ -38,6 +38,7 @@ not_on_configuration_dialog() {
|
||||||
|
|
||||||
if [ "$strategy" = 6 ]; then
|
if [ "$strategy" = 6 ]; then
|
||||||
log debug "[resolve_packages] User choice: Cancel or empty"
|
log debug "[resolve_packages] User choice: Cancel or empty"
|
||||||
|
return 0
|
||||||
elif [ "$strategy" = 1 ]; then
|
elif [ "$strategy" = 1 ]; then
|
||||||
package_manager uninstall "$conflicted_packages"
|
package_manager uninstall "$conflicted_packages"
|
||||||
elif [ "$strategy" = 2 ]; then
|
elif [ "$strategy" = 2 ]; then
|
||||||
|
@ -45,13 +46,23 @@ not_on_configuration_dialog() {
|
||||||
log debug "Input: input_packages = $input_packages"
|
log debug "Input: input_packages = $input_packages"
|
||||||
if validate_input_packages "$input_packages"; then
|
if validate_input_packages "$input_packages"; then
|
||||||
package_manager uninstall "$input_packages"
|
package_manager uninstall "$input_packages"
|
||||||
else
|
fi
|
||||||
not_on_configuration_dialog "$conflicted_packages"
|
elif [ "$strategy" = 3 ]; then
|
||||||
|
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"
|
||||||
|
if validate_input_packages "$input_packages"; then
|
||||||
|
track_packages "$input_packages"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log debug "[resolve_packages] Unexpected input: $strategy"
|
log debug "[resolve_packages] Unexpected input: $strategy"
|
||||||
not_on_configuration_dialog "$conflicted_packages"
|
not_on_configuration_dialog "$conflicted_packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check
|
||||||
}
|
}
|
||||||
|
|
||||||
not_installed_dialog() {
|
not_installed_dialog() {
|
||||||
|
@ -71,6 +82,7 @@ not_installed_dialog() {
|
||||||
|
|
||||||
if [ "$strategy" = 6 ]; then
|
if [ "$strategy" = 6 ]; then
|
||||||
log debug "[resolve_packages] User choice: Cancel or empty"
|
log debug "[resolve_packages] User choice: Cancel or empty"
|
||||||
|
return 0
|
||||||
elif [ "$strategy" = 1 ]; then
|
elif [ "$strategy" = 1 ]; then
|
||||||
package_manager install "$conflicted_packages"
|
package_manager install "$conflicted_packages"
|
||||||
elif [ "$strategy" = 2 ]; then
|
elif [ "$strategy" = 2 ]; then
|
||||||
|
@ -78,11 +90,17 @@ not_installed_dialog() {
|
||||||
log debug "Input: input_packages = $input_packages"
|
log debug "Input: input_packages = $input_packages"
|
||||||
if validate_input_packages "$input_packages"; then
|
if validate_input_packages "$input_packages"; then
|
||||||
package_manager install "$input_packages"
|
package_manager install "$input_packages"
|
||||||
else
|
|
||||||
not_on_configuration_dialog "$conflicted_packages"
|
|
||||||
fi
|
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
|
else
|
||||||
log debug "[resolve_packages] Unexpected input: $strategy"
|
log debug "[resolve_packages] Unexpected input: $strategy"
|
||||||
not_installed_dialog "$conflicted_packages"
|
not_installed_dialog "$conflicted_packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package_manager() {
|
package_manager() {
|
||||||
local command="$1"
|
local command="$1"
|
||||||
local output
|
|
||||||
|
|
||||||
local manager
|
local manager
|
||||||
local authorizer="sudo"
|
local authorizer="sudo"
|
||||||
|
|
18
src/package/package_tracking.sh
Normal file
18
src/package/package_tracking.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
track_packages() {
|
||||||
|
local packages="$1"
|
||||||
|
|
||||||
|
echo "$packages" | xargs | sed 's/ /\n/g' | while read -r package; do
|
||||||
|
echo "$package" >> "$CONFIG_ROOT/packages"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
untrack_packages() {
|
||||||
|
local packages="$1"
|
||||||
|
|
||||||
|
log debug "[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 $?"
|
||||||
|
done
|
||||||
|
}
|
2
tori
2
tori
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# paths
|
# paths
|
||||||
VERSION="0.3.1 2024-07-13"
|
VERSION="0.4.1 2024-07-14"
|
||||||
TORI_ROOT="$HOME/.local/share/tori"
|
TORI_ROOT="$HOME/.local/share/tori"
|
||||||
CONFIG_ROOT="$HOME/.config/tori"
|
CONFIG_ROOT="$HOME/.config/tori"
|
||||||
TMP_DIR="/tmp/tori"
|
TMP_DIR="/tmp/tori"
|
||||||
|
|
Loading…
Reference in a new issue