From 1bb7031647cc4d67bc0464466e691d53cbc7fb35 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Wed, 16 Apr 2025 20:54:35 +0200 Subject: [PATCH] feat: improve checking for restricted packages robustness --- scripts/pacman_wrapper.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/pacman_wrapper.sh b/scripts/pacman_wrapper.sh index 3aa8f2c..5a11c77 100755 --- a/scripts/pacman_wrapper.sh +++ b/scripts/pacman_wrapper.sh @@ -55,15 +55,19 @@ function display_operation() { # Function to check if user is trying to install specific packages that require confirmation function check_for_steam() { # List of packages that require confirmation - local restricted_packages=("steam" "freetube-bin" "seamonkey-bin" "seamonkey" "min-browser-bin" "min-browser" "beaker-browser" "catalyst-browser-bin" "hamsket" "min" "vieb-bin" "yt-dlp" "yt-dlp" "yt-dlp-git" "stremio" "stremio-git") + local restricted_packages=("steam" "freetube-bin" "freetube" "seamonkey-bin" "seamonkey" "min-browser-bin" "min-browser" "beaker-browser" "catalyst-browser-bin" "hamsket" "min" "vieb-bin" "yt-dlp" "yt-dlp-git" "stremio" "stremio-git") # Check if the command is an installation command if [[ "$1" == "-S" || "$1" == "-Sy" || "$1" == "-Syu" || "$1" == "-Syyu" || "$1" == "-U" ]]; then # Check all arguments for arg in "$@"; do + # Strip repository prefix if present (like extra/ or community/) + local package_name="${arg##*/}" + # Check if argument matches any restricted package for package in "${restricted_packages[@]}"; do - if [[ "$arg" == "$package" || "$arg" == *"/$package-"* || "$arg" == *"/$package/"* ]]; then + if [[ "$arg" == "$package" || "$arg" == *"/$package-"* || "$arg" == *"/$package/"* || + "$arg" == *"/$package" || "$package_name" == "$package" ]]; then return 0 # Restricted package found fi done