strip version and ignore not found packages

This commit is contained in:
nnduc
2026-03-31 23:37:21 +07:00
parent d4a387d888
commit f1532c0b2e
2 changed files with 85 additions and 73 deletions

View File

@@ -20,4 +20,16 @@ if [[ ${#packages[@]} -eq 0 ]]; then
fi
echo "Installing ${#packages[@]} packages..."
sudo pacman -S --needed "${packages[@]}"
skipped=()
for pkg in "${packages[@]}"; do
if pacman -Si "$pkg" &>/dev/null || pacman -Sg "$pkg" &>/dev/null; then
sudo pacman -S --needed --noconfirm "$pkg"
else
echo "Skipping '$pkg': not found in repositories"
skipped+=("$pkg")
fi
done
if [[ ${#skipped[@]} -gt 0 ]]; then
echo "Skipped ${#skipped[@]} package(s): ${skipped[*]}"
fi