Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api: `purge_packages" don't autoremove on updates #2622

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api has #!/bin/bash which guarantees bash (or equivalent implementation) execution

the use of double brackets is common in the api script. Even though there is no wildcard pattern matching being done (which would require double brackets) I see no reason why not to just use double brackets exclusively

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will admit it is a very unimportant design preference of mine, but the way I learned bash gradually through online searches, double brackets mean regex.
Whenever I see double brackets I'm expecting to see regex, and when it's not there I end up re-reading the expression multiple times to check if I am missing any * characters.

Because you brought it up, I will try to drop the habit, but no promises on a timeline for that. :)

# 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