Skip to content

Getting termux-tools ready for apt 3.0.0 #165

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
chore(scripts/termux-info): support deb822 sources format
  • Loading branch information
TomJo2000 committed Apr 27, 2025
commit b26d819868b1609abd9d8cbbb3dff6bac6ba053c
40 changes: 16 additions & 24 deletions scripts/termux-info.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,22 @@ updates() {
}

repo_subscriptions_apt() {
local main_sources
main_sources=$(grep -E '^[[:space:]]*deb[[:space:]]' "@TERMUX_PREFIX@/etc/apt/sources.list")

if [ -n "$main_sources" ]; then
echo "# sources.list"
echo "$main_sources"
fi

if [ -d "@TERMUX_PREFIX@/etc/apt/sources.list.d" ]; then
local filename repo_package supl_sources
while read -r filename; do
repo_package=$(dpkg -S "$filename" 2>/dev/null | cut -d : -f 1)
supl_sources=$(grep -E '^[[:space:]]*deb[[:space:]]' "$filename")

if [ -n "$supl_sources" ]; then
if [ -n "$repo_package" ]; then
echo "# $repo_package (sources.list.d/$(basename "$filename"))"
else
echo "# sources.list.d/$(basename "$filename")"
fi
echo "$supl_sources"
fi
done < <(find "@TERMUX_PREFIX@/etc/apt/sources.list.d" -maxdepth 1 ! -type d)
fi
local apt_dir='@TERMUX_PREFIX@/etc/apt'

local filename source_entry repo_package sources_type
for filename in $apt_dir/sources.list{,.d/*}; do
[[ -f "$filename" ]] || continue
case "$filename" in
*.sources) sources_type="deb822";;
*.list) sources_type="legacy";;
*) continue;; # Not a valid source type, skip
esac
source_entry="$(<"$filename")"
repo_package=$(dpkg -S "$filename" 2>/dev/null | cut -d : -f 1)

echo "# ${repo_package:+"$repo_package ("}${filename/${apt_dir}\/}${repo_package:+")"} [${sources_type}]"
echo "$source_entry"
done
}

repo_subscriptions_pacman() {
Expand Down