Convert explicit deps to non-explicit on update

Check if dependencies were previously explicitly installed and set them
to implicit so they can be orphaned if no longer required by the new
meta packages which declare dependencies
This commit is contained in:
Makrennel
2024-06-02 02:53:26 +01:00
parent 4f884f5fdc
commit a5a475c4ee
2 changed files with 94 additions and 0 deletions
+15
View File
@@ -92,6 +92,21 @@ if (( ${#pkglist[@]} != 0 )); then
fi
fi
# Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages
remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf
readarray -t old_deps_list < ./cache/old_deps_stripped.conf
pacman -Qeq > ./cache/pacman_explicit_packages
readarray -t explicitly_installed < ./cache/pacman_explicit_packages
[ "$ask" = "true" ] && read -p "Attempt to set previously explicitly installed deps as implicit [Y/n]? " convert_explicit
convert_explicit=${convert_explicit:-y}
if [ "$convert_explicit" != "${convert_explicit#[Yy]}" ]; then
echo "Attempting to set previously explicitly installed deps as implicit..."
for i in "${explicitly_installed[@]}"; do for j in "${old_deps_list[@]}"; do
[ "$i" = "$j" ] && $AUR_HELPER -D --asdeps "$i"
done; done
fi
# Install core dependencies from the meta-packages
metapkgs=(arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,microtex,portal,python,screencapture,widgets})
if $ask; then