#!/bin/bash

# File containing the list of packages
PACKAGE_LIST="packages.txt"

# Check if the package list file exists
if [ ! -f "$PACKAGE_LIST" ]; then
  echo "Package list file '$PACKAGE_LIST' not found!"
  exit 1
fi

# Loop through each package in the list
while read -r package; do
  # Skip empty lines or comments in the file
  if [ -z "$package" ] || [[ "$package" == \#* ]]; then
    continue
  fi

  echo "----------------------------------"
  echo "Attempting to install package: $package"

  # Simulate the installation using --assumeno (dry-run)
  install_output=$(dnf install --assumeno "$package" 2>&1)

  # Display the output of the simulated installation
  echo "$install_output"

  echo "----------------------------------"
done < "$PACKAGE_LIST"

echo "Script execution completed."

Updated: