diff --git a/install.sh b/install.sh index 187365f..80445f4 100755 --- a/install.sh +++ b/install.sh @@ -211,10 +211,11 @@ save_package_state() { print_step "Saving current package state..." local pkg_state_file="$HOME/.draphyOS-packages-before" - # Save list of currently installed packages (just package names, no versions) - dnf list installed 2>/dev/null | tail -n +2 | awk '{print $1}' | cut -d'.' -f1 | sort -u > "$pkg_state_file" + # Use rpm -qa for reliable package listing (works across DNF4/DNF5) + # Output just package names without version/arch + rpm -qa --qf '%{NAME}\n' 2>/dev/null | sort -u > "$pkg_state_file" - if [ -f "$pkg_state_file" ]; then + if [ -f "$pkg_state_file" ] && [ -s "$pkg_state_file" ]; then local count count=$(wc -l < "$pkg_state_file") print_success "Package state saved ($count packages)" diff --git a/uninstall.sh b/uninstall.sh index 2ebcc36..53f3dcb 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -221,10 +221,10 @@ remove_packages() { if [[ "$response" =~ ^[Yy]$ ]]; then print_step "Calculating packages to remove..." - # Get current installed packages + # Get current installed packages (using rpm for consistency with install) local current_pkgs current_pkgs=$(mktemp) - dnf list installed 2>/dev/null | tail -n +2 | awk '{print $1}' | cut -d'.' -f1 | sort -u > "$current_pkgs" + rpm -qa --qf '%{NAME}\n' 2>/dev/null | sort -u > "$current_pkgs" # Find packages that were added (in current but not in before) local pkgs_to_remove