Add dpkg-info: shows pkg info in a nice, colourful, human-readable way
Marcel Partap authored 3 years ago
Axel Beckert committed 1 year, 10 months ago
29 | 29 |
sensible-utils,
|
30 | 30 |
whiptail | dialog | zenity
|
31 | 31 |
Suggests: apt-file,
|
|
32 |
ccze,
|
|
33 |
debsums,
|
32 | 34 |
konqueror,
|
33 | 35 |
lsb-release,
|
34 | 36 |
lsof,
|
85 | 85 |
2017-2018 Axel Beckert <abe@debian.org>
|
86 | 86 |
2018 Jakub Wilk <jwilk@jwilk.net>
|
87 | 87 |
License: GPL-2+
|
|
88 |
|
|
89 |
Files: dpkg-info
|
|
90 |
Copyright: 2020 Marcel Partap <mpartap@gmx.net>
|
|
91 |
License: GPL-3+
|
88 | 92 |
|
89 | 93 |
Files: find-dbgsym-packages.pod find-dbgsym-packages-templates/*
|
90 | 94 |
Copyright: 2017 Axel Beckert <abe@debian.org>
|
|
0 |
#!/bin/bash
|
|
1 |
# convenience script to show information about debian
|
|
2 |
# packages in a nice, colourful, human-readable way
|
|
3 |
|
|
4 |
{ type dpkg-query && type apt-cache; } >/dev/null || { echo "this mechanism needs dpkg and apt. You even on debian?"; exit 1; }
|
|
5 |
{ type ccze && type sed && type du && type less; } >/dev/null || { echo "this mechanism needs ccze, sed, coreutils and less."; exit 1; }
|
|
6 |
|
|
7 |
dpkg-info()
|
|
8 |
{
|
|
9 |
for pkg in ${@};
|
|
10 |
do
|
|
11 |
{
|
|
12 |
{
|
|
13 |
apt-cache policy ${pkg} 2>&1 && echo
|
|
14 |
dpkg-query -s ${pkg} 2>/dev/null && echo
|
|
15 |
} | ccze -A -o nolookups && {
|
|
16 |
IFS=${IFS/ /}
|
|
17 |
list=($(dpkg -L ${pkg} 3>/dev/null | sed "s|^[^/]*||"|tail --lines=+2)) &&
|
|
18 |
[ ${#list[*]} -gt 0 ] &&
|
|
19 |
for item in ${list[@]};
|
|
20 |
do
|
|
21 |
{
|
|
22 |
[ -L "${item}" ] && [ ! -d $(realpath "${item}" 2>/dev/null) ] &&
|
|
23 |
links=("${links[@]}" "${item}") ||
|
|
24 |
[ -f "${item}" ] &&
|
|
25 |
files=("${files[@]}" "${item}") ||
|
|
26 |
dirs=("${dirs[@]}" "${item}")
|
|
27 |
}
|
|
28 |
done
|
|
29 |
[ ${#files[@]} -gt 0 ] &&
|
|
30 |
echo -ne "package ${pkg} contains:\t " &&
|
|
31 |
{ echo -n "$(LANG=C du -hc ${files[@]} | sed -nr "s/(.*)\s+total/\1iB/p") in ${#files[@]} $(ngettext 'file' 'files' ${#files[@]})" &&
|
|
32 |
{ [ ${#links[@]} -eq 0 ] || echo -n " and ${#links[@]} $(ngettext 'symbolic link' 'symbolic links' ${#links[@]})"; } &&
|
|
33 |
echo " within ${#dirs[@]} $(ngettext 'directory' 'directories' ${#dirs[@]})"; } | ccze -A -o nolookups && echo &&
|
|
34 |
ls --color=always -lahd --time-style=+" %^a %F %R" "${list[@]}"
|
|
35 |
debsums -s ${pkg}
|
|
36 |
} 2>&1
|
|
37 |
echo
|
|
38 |
{
|
|
39 |
apt-cache show ${pkg}
|
|
40 |
apt-cache showsrc ${pkg}
|
|
41 |
} | ccze -A -o nolookups
|
|
42 |
} | less -SRiM~ --shift 1 -PM"debian package info\: ${pkg}, ?ltlines %lt-%lb?L/%L.:byte %bB?s/%s. .?e(END)"
|
|
43 |
done
|
|
44 |
}
|
|
45 |
|
|
46 |
dpkg-info ${@}
|