Update cache only when needed

This commit is contained in:
Juno Takano 2024-07-12 08:28:21 -03:00
parent 5b31e8f60f
commit 7769565a21
2 changed files with 14 additions and 12 deletions

View file

@ -8,15 +8,18 @@ validate_input_packages() {
echo "$package_list" | xargs | sed 's/ /\n/g' | while read -r package; do echo "$package_list" | xargs | sed 's/ /\n/g' | while read -r package; do
if echo "$package" | grep -q "$invalid_characters_pattern"; then if echo "$package" | grep -q "$invalid_characters_pattern"; then
log user "Invalid package: $package (contains invalid characters)" log user "Invalid package: $package (contains invalid characters)"
return 1 return 1
fi fi
if grep -qw "$package" "$PACKAGE_CACHE"; then
log debug "Found in package cache: $package" update_package_cache
else
log user "Invalid package: $package (not found in package cache)" if grep -qw "$package" "$PACKAGE_CACHE"; then
return 1 log debug "Found in package cache: $package"
fi else
done log user "Invalid package: $package (not found in package cache)"
return 1
fi
done
} }

1
tori
View file

@ -34,7 +34,6 @@ main() {
# startup checks # startup checks
prepare_directories prepare_directories
update_package_cache
# entry point # entry point