Skip to content

Commit 26318c6

Browse files
authored
Merge pull request #13 from draphy/draphy/dro-64-test-draphyos-and-optimize
fix: [DRO-64] Uninstall is not properly removing packages
2 parents 564b3bc + ad6a223 commit 26318c6

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

install.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ save_package_state() {
211211
print_step "Saving current package state..."
212212
local pkg_state_file="$HOME/.draphyOS-packages-before"
213213

214-
# Save list of currently installed packages (just package names, no versions)
215-
dnf list installed 2>/dev/null | tail -n +2 | awk '{print $1}' | cut -d'.' -f1 | sort -u > "$pkg_state_file"
214+
# Use rpm -qa for reliable package listing (works across DNF4/DNF5)
215+
# Output just package names without version/arch
216+
rpm -qa --qf '%{NAME}\n' 2>/dev/null | sort -u > "$pkg_state_file"
216217

217-
if [ -f "$pkg_state_file" ]; then
218+
if [ -f "$pkg_state_file" ] && [ -s "$pkg_state_file" ]; then
218219
local count
219220
count=$(wc -l < "$pkg_state_file")
220221
print_success "Package state saved ($count packages)"

uninstall.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ remove_packages() {
221221
if [[ "$response" =~ ^[Yy]$ ]]; then
222222
print_step "Calculating packages to remove..."
223223

224-
# Get current installed packages
224+
# Get current installed packages (using rpm for consistency with install)
225225
local current_pkgs
226226
current_pkgs=$(mktemp)
227-
dnf list installed 2>/dev/null | tail -n +2 | awk '{print $1}' | cut -d'.' -f1 | sort -u > "$current_pkgs"
227+
rpm -qa --qf '%{NAME}\n' 2>/dev/null | sort -u > "$current_pkgs"
228228

229229
# Find packages that were added (in current but not in before)
230230
local pkgs_to_remove

0 commit comments

Comments
 (0)