Skip to content

Commit

Permalink
api: `purge_packages" don't autoremove on updates (#2622)
Browse files Browse the repository at this point in the history
* api: `purge_packages" don't autoremove on updates

* single brackets

---------

Co-authored-by: Botspot <[email protected]>
  • Loading branch information
theofficialgman and Botspot authored Jul 19, 2024
1 parent 94cae53 commit 5f95b7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -733,10 +733,17 @@ purge_packages() { #Allow dependencies of the $app app to be autoremoved.
echo "These packages were: $(package_dependencies "$package_name")"

status "Purging the $package_name package..."

apt_lock_wait
local output="$(sudo -E apt purge -y "$package_name" --autoremove 2>&1 | less_apt | tee /dev/stderr)"
status "Apt finished."

if [ "$script_input" == "update" ]; then
# skip --autoremove for faster updates. this prevents dummy deb dependencies from needing to be uninstalled and reinstalled on updates
apt_lock_wait
local output="$(sudo -E apt purge -y "$package_name" 2>&1 | less_apt | tee /dev/stderr)"
status "Apt finished."
else
apt_lock_wait
local output="$(sudo -E apt purge -y "$package_name" --autoremove 2>&1 | less_apt | tee /dev/stderr)"
status "Apt finished."
fi

errors="$(echo "$output" | grep '^[(E)|(Err]:')"
if [ ! -z "$errors" ];then
Expand Down
4 changes: 2 additions & 2 deletions manage
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,9 @@ elif [ "$1" == 'install' ] || [ "$1" == 'uninstall' ];then
echo
cd $HOME
if [ "$3" == "update" ]; then
script_input="update"
export script_input="update"
else
script_input=""
export script_input=""
fi
#always overwrite DEBIAN_FRONTEND with gnome
#dialog and readline are not functional due to the logfile pipe
Expand Down

0 comments on commit 5f95b7d

Please sign in to comment.