-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added APT package info when generating "Report Issue" text
This will now take a few more seconds due to "apt update" command being run.
- Loading branch information
1 parent
e5c5174
commit 6293f5f
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
|
||
subscribed_repositories() { | ||
local main_sources | ||
main_sources=$(grep -P '^\s*deb\s' "@TERMUX_PREFIX@/etc/apt/sources.list") | ||
|
||
if [ -n "$main_sources" ]; then | ||
echo "#### sources.list" | ||
echo "\`$main_sources\`" | ||
fi | ||
|
||
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 -P '^\s*deb\s' "$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) | ||
} | ||
|
||
updatable_packages() { | ||
local updatable | ||
|
||
if [ "$(id -u)" = "0" ]; then | ||
echo "Running as root. Cannot check updatable packages." | ||
else | ||
apt update >/dev/null 2>&1 | ||
updatable=$(apt list --upgradable 2>/dev/null | tail -n +2) | ||
|
||
if [ -z "$updatable" ];then | ||
echo "All packages up to date" | ||
else | ||
echo "\`$updatable\`" | ||
fi | ||
fi | ||
} | ||
|
||
output=" | ||
### Subscribed Repositories | ||
$(subscribed_repositories) | ||
## | ||
### Updatable Packages | ||
$(updatable_packages) | ||
## | ||
" | ||
|
||
echo "$output" |