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
if echo "$package" | grep -q "$invalid_characters_pattern"; then
log user "Invalid package: $package (contains invalid characters)"
return 1
fi
if grep -qw "$package" "$PACKAGE_CACHE"; then
log debug "Found in package cache: $package"
else
log user "Invalid package: $package (not found in package cache)"
return 1
fi
done
if echo "$package" | grep -q "$invalid_characters_pattern"; then
log user "Invalid package: $package (contains invalid characters)"
return 1
fi
update_package_cache
if grep -qw "$package" "$PACKAGE_CACHE"; then
log debug "Found in package cache: $package"
else
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
prepare_directories
update_package_cache
# entry point