Skip to content

Instantly share code, notes, and snippets.

@realyukii
Last active August 8, 2024 14:14

Revisions

  1. realyukii revised this gist Aug 8, 2024. No changes.
  2. realyukii revised this gist Aug 8, 2024. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions meta_pkg.sh
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,10 @@ search_meta_packages() {
    echo "Searching for meta-packages..."
    for pkg in $(pacman -Qq); do
    # Check if the package has dependencies but no installed files
    files=$(pacman -Ql $pkg | grep -v ":$") # List package files, ignore header
    depends=$(pacman -Qi $pkg | grep "Depends On" | cut -d ":" -f2-)
    files=$(pacman -Ql $pkg) # List package files

    if [[ -z "$files" && ! -z "$depends" ]]; then
    # if no contain any file, then it must be a meta package.
    if [[ -z "$files" ]]; then
    echo "Meta-package found: $pkg"
    fi
    done
  3. realyukii revised this gist Aug 8, 2024. No changes.
  4. realyukii revised this gist Aug 8, 2024. No changes.
  5. realyukii created this gist Aug 8, 2024.
    19 changes: 19 additions & 0 deletions meta_pkg.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/bash

    # Script to search for meta-packages in the local system

    # Function to search for meta-packages
    search_meta_packages() {
    echo "Searching for meta-packages..."
    for pkg in $(pacman -Qq); do
    # Check if the package has dependencies but no installed files
    files=$(pacman -Ql $pkg | grep -v ":$") # List package files, ignore header
    depends=$(pacman -Qi $pkg | grep "Depends On" | cut -d ":" -f2-)

    if [[ -z "$files" && ! -z "$depends" ]]; then
    echo "Meta-package found: $pkg"
    fi
    done
    }

    search_meta_packages