#!/bin/bash # shellcheck disable=SC2034 DESCRIPTION="hampackremove removes what HamPack installed and leaves CoreDesktop working" IMAGE=installed TIER="pr" scenario() { local recorded kept pkg recorded="$(vm_value 'cat ~/.local/state/HamPack/installed-packages 2> /dev/null || true')" # It asks to confirm, then (with nothing more on stdin) says no to anything else run_in_vm hampackremove 'printf "y\n" | TERM=dumb ~/.local/bin/hampackremove' assert_status 0 assert_output "HamPack has been removed." assert_vm "HamPack's clone, state and apps are gone" ' ! test -e ~/.local/share/siblings/HamPack && ! test -e ~/.local/state/HamPack && ! test -e ~/.local/bin/direwolf && ! test -e ~/.local/bin/dump1090 && ! test -e ~/.local/bin/POTACAT.AppImage && ! test -e ~/.local/bin/hampackremove' refute_vm "graywolf's service is gone" 'systemctl cat graywolf' # Each package HamPack installed is gone, unless something else needs it kept="$(sed -n 's/^Kept because other software needs them: //p' <<< "$OUTPUT")" for pkg in $recorded; do if vm_exec "pacman -Qq $(q "$pkg")" > /dev/null 2>&1; then [[ " $kept " == *" $pkg "* ]] || fail "$pkg is still installed, and wasn't reported as kept" fi done echo "ok: HamPack's packages are gone, but for those kept: ${kept:-none}" health CoreDesktop cd_update assert_status 0 health CoreDesktop }