From 30ed9a2b90ad78c1cb92ce959d404a71d28bd137 Mon Sep 17 00:00:00 2001 From: Dennis ten Hoove Date: Thu, 3 Oct 2024 08:23:09 +0200 Subject: [PATCH] [arkdep] Code cleanup --- arkdep | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arkdep b/arkdep index d9de0fb..f6b9f2f 100755 --- a/arkdep +++ b/arkdep @@ -724,11 +724,13 @@ diff () { declare removed=() declare new=() - # Process new_pkgs list to generate update diff + # Find updated packages for pkg in "${new_pkgs[@]}"; do # Split package name and package versions in to list declare spaced=($pkg) + # Find new packages, if a package from the new image is not in the + # package list of the current version it is new if [[ ! "${old_pkgs[@]}" =~ "${spaced[0]}" ]]; then new+=("${spaced[0]}") continue @@ -740,13 +742,12 @@ diff () { declare old_spaced=($old_pkg) # Find matchings packages, compare versions + # If versions do not match they have been updated/changed/downgraded if [[ ${spaced[0]} == ${old_spaced[0]} ]]; then if [[ ${spaced[1]} != ${old_spaced[1]} ]]; then - #printf "DIFF ${spaced[1]} >> ${old_spaced[1]}\n" changed+=("${spaced[0]}") old_ver+=("${old_spaced[1]}") new_ver+=("${spaced[1]}") - break fi fi @@ -757,6 +758,8 @@ diff () { for old_pkg in "${old_pkgs[@]}"; do declare old_spaced=($old_pkg) + # Compare all packages from new image to current package version, + # current package is not in the new_pkgs list it has been removed if [[ ! "${new_pkgs[@]}" =~ "${old_spaced[0]}" ]]; then removed+=("${old_spaced[0]}") fi