Skip to content

Commit

Permalink
api: remove_repofile_if_unused set default to not in use
Browse files Browse the repository at this point in the history
also don't pipe output to null anymore as the function does not output anything by default
  • Loading branch information
theofficialgman committed Feb 25, 2024
1 parent 145f788 commit 83ee5cd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions api
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ remove_repofile_if_unused() { #Given a sources.list.d file, delete it if nothing
[ -z "$file" ] && error "remove_repo_if_unused: no sources.list.d file specified!"
#return now if the list file does not exist
[ -f "$file" ] || return 0

#set default to not in use
local in_use=0

if [ "${file##*.}" == "list" ]; then
# determine what uri, suite, and components are in a file
Expand All @@ -291,14 +294,14 @@ remove_repofile_if_unused() { #Given a sources.list.d file, delete it if nothing
local IFS=' '
if [ -z "$components" ]; then
debug "$uri $suite"
if anything_installed_from_uri_suite_component "$uri" "$suite" >/dev/null;then
if anything_installed_from_uri_suite_component "$uri" "$suite";then
in_use=1
break 1
fi
else
for component in $components ;do
debug "$uri $suite $component"
if anything_installed_from_uri_suite_component "$uri" "$suite" "$component" >/dev/null;then
if anything_installed_from_uri_suite_component "$uri" "$suite" "$component";then
in_use=1
break 2
fi
Expand Down Expand Up @@ -335,14 +338,14 @@ remove_repofile_if_unused() { #Given a sources.list.d file, delete it if nothing
for suite in $suites ;do
if [ -z "$components" ]; then
debug "$uri $suite"
if anything_installed_from_uri_suite_component "$uri" "$suite" >/dev/null;then
if anything_installed_from_uri_suite_component "$uri" "$suite";then
in_use=1
break 2
fi
else
for component in $components ;do
debug "$uri $suite $component"
if anything_installed_from_uri_suite_component "$uri" "$suite" "$component" >/dev/null;then
if anything_installed_from_uri_suite_component "$uri" "$suite" "$component";then
in_use=1
break 3
fi
Expand Down

0 comments on commit 83ee5cd

Please sign in to comment.