Codebase list debian-goodies / d4335bb
Imported Debian version 0.24 Javier Fernandez-Sanguino 11 years ago
21 changed file(s) with 1472 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
00 #!/bin/sh -e
11
2 # Set the locale so we can control apt-get errors properly
3 LC_ALL=C
4
5 usage()
6 {
7 echo "Usage: `basename $0` [--help] package"
8 }
9
10 if [ $# -eq 0 ] ; then
11 usage
12 exit 1
13 fi
14
15 case $1 in
16 "-h") usage; exit 0;;
17 "--help") usage; exit 0;;
18 -*) echo "Unknown option $1"; usage; exit 1;;
19 esac
20
21 # First check if apt-get is sane enough before proceeding
22 apt-get -q2 --print-uris --reinstall install "dpkg" 2>/dev/null >/dev/null
23 if [ $? -ne 0 ] ; then
24 echo "ERROR: There was an error calling apt-get. Check that the database is in a consistent state and try again"
25 exit 1
26 fi
27
228 for pkgspec in $*; do
3 version=$(apt-get -q2 -s --reinstall install "$pkgspec" | grep ^Inst | sed -ne '$s/^.*\[\(.*\)\].*$/\1/p')
4 echo "($pkgspec -> $version)"
5 aptdata=$(apt-get -q2 --print-uris --reinstall install "$pkgspec" | tail -1)
29 apt-get -q2 --print-uris --reinstall install "$pkgspec" 2>/dev/null >/dev/null
30 if [ $? -ne 0 ] ; then
31 echo "ERROR: There is no '$pkgspec' package. Sorry."
32 continue
33 fi
34 # This provides only one version, but it's better than the apt-get
35 # call which will not work in packages not available locally
36 apt-cache show "$pkgspec" 2>/dev/null | grep ^Ver |
37 while read version; do
38 version=`echo $version | sed -ne '$s/^.*: \(.*\).*$/\1/p'`
39 echo "($pkgspec -> $version)"
40 done
41 aptdata=$(apt-get -q2 --print-uris --reinstall install "$pkgspec" 2>/dev/null | tail -1)
42 if [ -z "$aptdata" ] ; then
43 echo "ERROR: No APT data returned for '$pkgspec'. Sorry."
44 echo "This is probably because the package is in the local apt cache"
45 echo "Tip: Use 'aptitude download'"
46 continue
47 fi
648 url=$(echo "$aptdata" | sed -e "s/^'\([^']*\)'.*$/\1/")
749 file=$(echo "$aptdata" | sed -e "s/^'[^']*' \([^ ]*\).*$/\1/")
8 curl "$url" > "$file"
50 if [ -z "$url" ] ; then
51 echo "ERROR: Cound not obtain an URL for $pkgspec"
52 else
53 echo "Downloading $pkgspec from $url"
54 curl "$url" > "$file"
55 fi
956 done
0 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
1 .\"
2 .\" Standard preamble:
3 .\" ========================================================================
4 .de Sh \" Subsection heading
5 .br
6 .if t .Sp
7 .ne 5
8 .PP
9 \fB\\$1\fR
10 .PP
11 ..
12 .de Sp \" Vertical space (when we can't use .PP)
13 .if t .sp .5v
14 .if n .sp
15 ..
16 .de Vb \" Begin verbatim text
17 .ft CW
18 .nf
19 .ne \\$1
20 ..
21 .de Ve \" End verbatim text
22 .ft R
23 .fi
24 ..
25 .\" Set up some character translations and predefined strings. \*(-- will
26 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
27 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
28 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
29 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
30 .\" nothing in troff, for use with C<>.
31 .tr \(*W-
32 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
33 .ie n \{\
34 . ds -- \(*W-
35 . ds PI pi
36 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
37 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
38 . ds L" ""
39 . ds R" ""
40 . ds C` ""
41 . ds C' ""
42 'br\}
43 .el\{\
44 . ds -- \|\(em\|
45 . ds PI \(*p
46 . ds L" ``
47 . ds R" ''
48 'br\}
49 .\"
50 .\" If the F register is turned on, we'll generate index entries on stderr for
51 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
52 .\" entries marked with X<> in POD. Of course, you'll have to process the
53 .\" output yourself in some meaningful fashion.
54 .if \nF \{\
55 . de IX
56 . tm Index:\\$1\t\\n%\t"\\$2"
57 ..
58 . nr % 0
59 . rr F
60 .\}
61 .\"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .hy 0
65 .if n .na
66 .\"
67 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
68 .\" Fear. Run. Save yourself. No user-serviceable parts.
69 . \" fudge factors for nroff and troff
70 .if n \{\
71 . ds #H 0
72 . ds #V .8m
73 . ds #F .3m
74 . ds #[ \f1
75 . ds #] \fP
76 .\}
77 .if t \{\
78 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
79 . ds #V .6m
80 . ds #F 0
81 . ds #[ \&
82 . ds #] \&
83 .\}
84 . \" simple accents for nroff and troff
85 .if n \{\
86 . ds ' \&
87 . ds ` \&
88 . ds ^ \&
89 . ds , \&
90 . ds ~ ~
91 . ds /
92 .\}
93 .if t \{\
94 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
95 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
96 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
97 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
98 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
99 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
100 .\}
101 . \" troff and (daisy-wheel) nroff accents
102 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
103 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
104 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
105 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
106 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
107 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
108 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
109 .ds ae a\h'-(\w'a'u*4/10)'e
110 .ds Ae A\h'-(\w'A'u*4/10)'E
111 . \" corrections for vroff
112 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
113 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
114 . \" for low resolution devices (crt and lpr)
115 .if \n(.H>23 .if \n(.V>19 \
116 \{\
117 . ds : e
118 . ds 8 ss
119 . ds o a
120 . ds d- d\h'-1'\(ga
121 . ds D- D\h'-1'\(hy
122 . ds th \o'bp'
123 . ds Th \o'LP'
124 . ds ae ae
125 . ds Ae AE
126 .\}
127 .rm #[ #] #H #V #F C
128 .\" ========================================================================
129 .\"
130 .IX Title "DEBGET 1"
131 .TH DEBGET 1 "2006-07-24" "perl v5.8.8" "Debian-goodies documentation"
132 .SH "NAME"
133 debget \- Fetch a .deb for a package in APT's database
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBdebget\fR \fIpackage\fR [\fIpackage\fR ...]
137 .SH "DESCRIPTION"
138 .IX Header "DESCRIPTION"
139 \&\fBdebget\fR fetches a .deb for one or more packages from an Debian mirror.
140 It uses \fIapt\-get\fR\|(1) to find out the \s-1URL\s0 so it will download the same version
141 from the same server as \fIapt-get\fR would do. The .deb will be downloaded with
142 \&\fIcurl\fR\|(1) and stored in your current working directory.
143 .SH "KNOWN BUGS"
144 .IX Header "KNOWN BUGS"
145 \&\fBdebget\fR will not work for packages that are available in \fIapt-get\fR's cache.
146 If you need that functionality please use the .\fIdownload\fR option in
147 \&\fIaptitude\fR.
148 .SH "AUTHOR"
149 .IX Header "AUTHOR"
150 Matt Zimmerman <mdz@debian.org>
151 .PP
152 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
153 .SH "COPYRIGHT AND LICENCE"
154 .IX Header "COPYRIGHT AND LICENCE"
155 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
156 .PP
157 This program is free software; you can redistribute it and/or modify
158 it under the terms of the \s-1GNU\s0 General Public License as published by
159 the Free Software Foundation; either version 2, or (at your option)
160 any later version.
161 .PP
162 On Debian systems, a copy of the \s-1GNU\s0 General Public License may be
163 found in /usr/share/common\-licenses/GPL.
164 .SH "SEE ALSO"
165 .IX Header "SEE ALSO"
166 \&\fIapt\-get\fR\|(1), \fIcurl\fR\|(1)
1212 from the same server as I<apt-get> would do. The .deb will be downloaded with
1313 curl(1) and stored in your current working directory.
1414
15 =head1 KNOWN BUGS
16
17 B<debget> will not work for packages that are available in I<apt-get>'s cache.
18 If you need that functionality please use the .I<download> option in
19 I<aptitude>.
20
1521 =head1 AUTHOR
1622
1723 Matt Zimmerman <mdz@debian.org>
1824
19 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
25 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
2026
2127 =head1 COPYRIGHT AND LICENCE
2228
0 debian-goodies (0.24) unstable; urgency=low
1
2 * Taking up this package as new maintainer, after talking with Matt
3 on private mail.
4 * Fix Frank Lichtenheld's mail in all manpages (Closes: #249818)
5 * Changes to debget:
6 - debget --help (or -h) now works as expected. Introduce usage
7 in the tool to warn on errors when calling it (Closes: #251353)
8 - Any other options are rejected (as they would be passed on to apt)
9 - Additional error checking in debget to prevent it from going ahead
10 when something goes wrong, this includes checking first if the
11 apt-get dependencies are right and that the package the user asked
12 us to retrieve exists (Closes: #283401)
13 - Use apt-cache instead of apt-get to get the version as
14 'apt-get -q2 -s --reinstall install' requires, for some reason,
15 super cower powers. This makes it possible to download packages
16 without satisfying dependencies (Closes: #369494)
17 - Document the fact that downloading packages from the package cache
18 is not supported both in the manpage and in the program's output
19 (Closes: #224857)
20 * Fix manpage dglob typos as well as the header of the documentation
21 generated by pod2man (Closes #228302, #305802)
22 * Have debman use bash as a shell (Closes: #369762)
23 * Set LC_NUMERIC to 'C' in dpigs as suggested by Bill Allombert (Closes:
24 #368227)
25 * Move checkrestart to /usr/sbin (Closes: #329723)
26 * Have dglob exit with a '1' exit status if no packages match the globbing
27 pattern (Closes: #292585)
28 * Make popbugs properly extract the file provided by the user instead of
29 /var/log/popularity-contest, if requested to (Closes: #263471)
30 * Fix typo in popbugs.1 manpage (AUTOR -> AUTHOR)
31 * Include which-pkg-broke Python script contributed by Bill Gribble and
32 wrote its associated manpage (Closes: #231470)
33 * Include network-test shell script contributed by myself and
34 wrote its associated manpage (Closes: #307694)
35 * Use debhelper compatibility version 4
36
37 -- Javier Fernandez-Sanguino Pen~a <jfs@computer.org> Sun, 23 Jul 2006 21:42:54 +0200
38
039 debian-goodies (0.23) unstable; urgency=low
140
241 * Man page for popbugs from Jochen Voss <voss@debian.org> (Closes:
00 Source: debian-goodies
11 Section: utils
22 Priority: optional
3 Maintainer: Matt Zimmerman <mdz@debian.org>
3 Maintainer: Javier Fernandez-Sanguino Pen~a <jfs@computer.org>
44 Build-Depends-Indep: debhelper (>> 3.0.0)
55 Standards-Version: 3.5.2
66
55 #export DH_VERBOSE=1
66
77 # This is the debhelper compatibility version to use.
8 export DH_COMPAT=3
8 export DH_COMPAT=4
99
1010
1111
1414 build-stamp:
1515 dh_testdir
1616
17 for prog in debget dglob dgrep dpigs; do pod2man $$prog.pod > $$prog.1; done
17 for prog in debget dglob dgrep dpigs; do pod2man -c "Debian-goodies documentation" $$prog.pod > $$prog.1; done
1818
1919 touch build-stamp
2020
3333
3434 # Add here commands to install the package into debian/debian-goodies.
3535 install -d $(CURDIR)/debian/debian-goodies/usr/bin
36 install -m 755 dgrep dglob debget dpigs debman checkrestart popbugs \
36 install -d $(CURDIR)/debian/debian-goodies/usr/sbin
37 install -m 755 dgrep dglob debget dpigs debman popbugs which-pkg-broke \
38 network-test \
3739 $(CURDIR)/debian/debian-goodies/usr/bin
40 install -m 755 checkrestart \
41 $(CURDIR)/debian/debian-goodies/usr/sbin
3842 for grepname in dzgrep degrep dfgrep; do \
3943 ln -s dgrep $(CURDIR)/debian/debian-goodies/usr/bin/$$grepname; \
4044 done
5761 # dh_installmime
5862 # dh_installinit
5963 # dh_installcron
60 dh_installman debget.1 debman.1 dglob.1 dgrep.1 dpigs.1 popbugs.1
64 dh_installman debget.1 debman.1 dglob.1 dgrep.1 dpigs.1 popbugs.1 \
65 which-pkg-broke.1 network-test.1
6166 # dh_installinfo
6267 # dh_undocumented
6368 dh_installchangelogs
0 #! /bin/sh -e
0 #! /bin/bash -e
11
22 # debman - read a man page from an uninstalled Debian package file (.deb)
33
3939 esac
4040 done
4141
42 eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1" \
43 | (eval $expand)
42 # Does the package exist?
43 packages=`eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1"`
44 if [ -z "$packages" ] ; then
45 exit 1
46 fi
47
48 eval $filter /var/lib/dpkg/status | grep-dctrl -PnsPackage $grep_dctrl_options "$1" |
49 (eval $expand)
0 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
1 .\"
2 .\" Standard preamble:
3 .\" ========================================================================
4 .de Sh \" Subsection heading
5 .br
6 .if t .Sp
7 .ne 5
8 .PP
9 \fB\\$1\fR
10 .PP
11 ..
12 .de Sp \" Vertical space (when we can't use .PP)
13 .if t .sp .5v
14 .if n .sp
15 ..
16 .de Vb \" Begin verbatim text
17 .ft CW
18 .nf
19 .ne \\$1
20 ..
21 .de Ve \" End verbatim text
22 .ft R
23 .fi
24 ..
25 .\" Set up some character translations and predefined strings. \*(-- will
26 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
27 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
28 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
29 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
30 .\" nothing in troff, for use with C<>.
31 .tr \(*W-
32 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
33 .ie n \{\
34 . ds -- \(*W-
35 . ds PI pi
36 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
37 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
38 . ds L" ""
39 . ds R" ""
40 . ds C` ""
41 . ds C' ""
42 'br\}
43 .el\{\
44 . ds -- \|\(em\|
45 . ds PI \(*p
46 . ds L" ``
47 . ds R" ''
48 'br\}
49 .\"
50 .\" If the F register is turned on, we'll generate index entries on stderr for
51 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
52 .\" entries marked with X<> in POD. Of course, you'll have to process the
53 .\" output yourself in some meaningful fashion.
54 .if \nF \{\
55 . de IX
56 . tm Index:\\$1\t\\n%\t"\\$2"
57 ..
58 . nr % 0
59 . rr F
60 .\}
61 .\"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .hy 0
65 .if n .na
66 .\"
67 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
68 .\" Fear. Run. Save yourself. No user-serviceable parts.
69 . \" fudge factors for nroff and troff
70 .if n \{\
71 . ds #H 0
72 . ds #V .8m
73 . ds #F .3m
74 . ds #[ \f1
75 . ds #] \fP
76 .\}
77 .if t \{\
78 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
79 . ds #V .6m
80 . ds #F 0
81 . ds #[ \&
82 . ds #] \&
83 .\}
84 . \" simple accents for nroff and troff
85 .if n \{\
86 . ds ' \&
87 . ds ` \&
88 . ds ^ \&
89 . ds , \&
90 . ds ~ ~
91 . ds /
92 .\}
93 .if t \{\
94 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
95 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
96 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
97 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
98 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
99 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
100 .\}
101 . \" troff and (daisy-wheel) nroff accents
102 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
103 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
104 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
105 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
106 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
107 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
108 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
109 .ds ae a\h'-(\w'a'u*4/10)'e
110 .ds Ae A\h'-(\w'A'u*4/10)'E
111 . \" corrections for vroff
112 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
113 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
114 . \" for low resolution devices (crt and lpr)
115 .if \n(.H>23 .if \n(.V>19 \
116 \{\
117 . ds : e
118 . ds 8 ss
119 . ds o a
120 . ds d- d\h'-1'\(ga
121 . ds D- D\h'-1'\(hy
122 . ds th \o'bp'
123 . ds Th \o'LP'
124 . ds ae ae
125 . ds Ae AE
126 .\}
127 .rm #[ #] #H #V #F C
128 .\" ========================================================================
129 .\"
130 .IX Title "DGLOB 1"
131 .TH DGLOB 1 "2006-07-24" "perl v5.8.8" "Debian-goodies documentation"
132 .SH "NAME"
133 dglob \- Expand package names or files matching a pattern
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBdglob\fR [\fB\-a\fR] \fIpattern\fR
137 .PP
138 \&\fBdglob\fR [\fB\-0\fR] \fB\-f\fR \fIpattern\fR
139 .SH "DESCRIPTION"
140 .IX Header "DESCRIPTION"
141 \&\fBdglob\fR lists packages names matching a pattern. It can
142 also list all the files they contain. By default \fBdglobl\fR only searches
143 installed packages; the \fB\-a\fR switch widens the search (see \*(L"\s-1OPTIONS\s0\*(R"). The
144 list is written to stdout, one name per line.
145 .PP
146 \&\fIgrep\-dctrl\fR\|(1) is used to search the list of packages, so you should
147 refer to its documentation for information on how patterns are
148 matched. By default, all packages whose name contains the given
149 string will be matched, but several options are available to modify
150 this behavior (see \*(L"\s-1OPTIONS\s0\*(R").
151 .PP
152 If you use dglob with the \fB\-f\fR option, all files in the matched packages
153 are listed instead of their names. Only existing, plain (i.e. no symlinks,
154 directories or other special ones) files are listed. The filenames are
155 written to stdout, one file per line. You can use the \fB\-0\fR option to
156 get the filenames separated by '\e0' instead of a newline.
157 .SH "OPTIONS"
158 .IX Header "OPTIONS"
159 \&\fBdglob\fR supports the following options:
160 .IP "\fB\-a\fR" 4
161 .IX Item "-a"
162 Search through all available packages, not just installed ones.
163 .IP "\fB\-f\fR" 4
164 .IX Item "-f"
165 List all files in the matched packages. This list only installed (i.e.
166 locally existing) files from installed packages, so using it together
167 with \fB\-a\fR is rather pointless.
168 .IP "\fB\-0\fR" 4
169 .IX Item "-0"
170 When listing files (with \fB\-f\fR) use '\e0' as a separator instead of
171 a newline. When specified without \fB\-f\fR, this options does nothing.
172 .IP "\fB\-r\fR, \fB\-e\fR, \fB\-i\fR, \fB\-X\fR, \fB\-v\fR" 4
173 .IX Item "-r, -e, -i, -X, -v"
174 These options are passed directly to \fIgrep\-dctrl\fR\|(1) to modify how the
175 pattern is matched. See \fIgrep\-dctrl\fR\|(1).
176 .SH "FILES"
177 .IX Header "FILES"
178 .IP "\fI/var/lib/dpkg/status\fR" 4
179 .IX Item "/var/lib/dpkg/status"
180 \&\fIdpkg\fR\|(8) status file, which serves as source for the list of available
181 and installed packages.
182 .SH "AUTHOR"
183 .IX Header "AUTHOR"
184 Matt Zimmerman <mdz@debian.org>
185 .PP
186 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
187 .SH "COPYRIGHT AND LICENCE"
188 .IX Header "COPYRIGHT AND LICENCE"
189 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
190 .PP
191 This program is free software; you can redistribute it and/or modify
192 it under the terms of the \s-1GNU\s0 General Public License as published by
193 the Free Software Foundation; either version 2, or (at your option)
194 any later version.
195 .PP
196 On Debian systems, a copy of the \s-1GNU\s0 General Public License may be
197 found in /usr/share/common\-licenses/GPL.
198 .SH "SEE ALSO"
199 .IX Header "SEE ALSO"
200 \&\fIgrep\-dctrl\fR\|(1), \fIdpkg\fR\|(8)
99
1010 =head1 DESCRIPTION
1111
12 B<dglob> searches for packages whose names match a pattern, and can
13 either output their names, or a list of the files they contain. Per
14 default, only installed packages are matched, unless you use the B<-a>
15 option (see L<"OPTIONS">). The list of packages is written to stdout,
16 one package per line.
12 B<dglob> lists packages names matching a pattern. It can
13 also list all the files they contain. By default B<dglobl> only searches
14 installed packages; the B<-a> switch widens the search (see L<"OPTIONS">). The
15 list is written to stdout, one name per line.
1716
1817 grep-dctrl(1) is used to search the list of packages, so you should
1918 refer to its documentation for information on how patterns are
2928
3029 =head1 OPTIONS
3130
32 B<dglob> suppports the following options:
31 B<dglob> supports the following options:
3332
3433 =over 4
3534
4039 =item B<-f>
4140
4241 List all files in the matched packages. This list only installed (i.e.
43 locallly existing) files from installed packages, so using it together
42 locally existing) files from installed packages, so using it together
4443 with B<-a> is rather pointless.
4544
4645 =item B<-0>
7069
7170 Matt Zimmerman <mdz@debian.org>
7271
73 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
72 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
7473
7574 =head1 COPYRIGHT AND LICENCE
7675
0 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
1 .\"
2 .\" Standard preamble:
3 .\" ========================================================================
4 .de Sh \" Subsection heading
5 .br
6 .if t .Sp
7 .ne 5
8 .PP
9 \fB\\$1\fR
10 .PP
11 ..
12 .de Sp \" Vertical space (when we can't use .PP)
13 .if t .sp .5v
14 .if n .sp
15 ..
16 .de Vb \" Begin verbatim text
17 .ft CW
18 .nf
19 .ne \\$1
20 ..
21 .de Ve \" End verbatim text
22 .ft R
23 .fi
24 ..
25 .\" Set up some character translations and predefined strings. \*(-- will
26 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
27 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
28 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
29 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
30 .\" nothing in troff, for use with C<>.
31 .tr \(*W-
32 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
33 .ie n \{\
34 . ds -- \(*W-
35 . ds PI pi
36 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
37 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
38 . ds L" ""
39 . ds R" ""
40 . ds C` ""
41 . ds C' ""
42 'br\}
43 .el\{\
44 . ds -- \|\(em\|
45 . ds PI \(*p
46 . ds L" ``
47 . ds R" ''
48 'br\}
49 .\"
50 .\" If the F register is turned on, we'll generate index entries on stderr for
51 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
52 .\" entries marked with X<> in POD. Of course, you'll have to process the
53 .\" output yourself in some meaningful fashion.
54 .if \nF \{\
55 . de IX
56 . tm Index:\\$1\t\\n%\t"\\$2"
57 ..
58 . nr % 0
59 . rr F
60 .\}
61 .\"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .hy 0
65 .if n .na
66 .\"
67 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
68 .\" Fear. Run. Save yourself. No user-serviceable parts.
69 . \" fudge factors for nroff and troff
70 .if n \{\
71 . ds #H 0
72 . ds #V .8m
73 . ds #F .3m
74 . ds #[ \f1
75 . ds #] \fP
76 .\}
77 .if t \{\
78 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
79 . ds #V .6m
80 . ds #F 0
81 . ds #[ \&
82 . ds #] \&
83 .\}
84 . \" simple accents for nroff and troff
85 .if n \{\
86 . ds ' \&
87 . ds ` \&
88 . ds ^ \&
89 . ds , \&
90 . ds ~ ~
91 . ds /
92 .\}
93 .if t \{\
94 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
95 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
96 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
97 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
98 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
99 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
100 .\}
101 . \" troff and (daisy-wheel) nroff accents
102 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
103 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
104 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
105 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
106 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
107 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
108 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
109 .ds ae a\h'-(\w'a'u*4/10)'e
110 .ds Ae A\h'-(\w'A'u*4/10)'E
111 . \" corrections for vroff
112 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
113 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
114 . \" for low resolution devices (crt and lpr)
115 .if \n(.H>23 .if \n(.V>19 \
116 \{\
117 . ds : e
118 . ds 8 ss
119 . ds o a
120 . ds d- d\h'-1'\(ga
121 . ds D- D\h'-1'\(hy
122 . ds th \o'bp'
123 . ds Th \o'LP'
124 . ds ae ae
125 . ds Ae AE
126 .\}
127 .rm #[ #] #H #V #F C
128 .\" ========================================================================
129 .\"
130 .IX Title "DGREP 1"
131 .TH DGREP 1 "2006-07-24" "perl v5.8.8" "Debian-goodies documentation"
132 .SH "NAME"
133 dgrep, degrep, dfgrep, dzgrep \-\- grep through files belonging to an installed Debian package
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBdgrep\fR [\fImost grep options\fR] \fIpattern\fR \fIpackage\fR...
137 .PP
138 \&\fBdgrep\fR \fB\-\-help\fR
139 .SH "DESCRIPTION"
140 .IX Header "DESCRIPTION"
141 \&\fBdgrep\fR invokes \fIgrep\fR\|(1) on each file in one or more installed Debian
142 packages.
143 .PP
144 It passes the \fIpackage\fR argument(s) to \fIdglob\fR\|(1) to retrieve a list of files
145 in those packages. You can use \s-1POSIX\s0 regular expressions for the package
146 names.
147 .PP
148 If \fBdgrep\fR is invoked as \fBdegrep\fR, \fBdfgrep\fR or \fBdzgrep\fR then \fIegrep\fR\|(1),
149 \&\fIfgrep\fR\|(1) or \fIzgrep\fR\|(1) is used instead of \fBgrep\fR.
150 .SH "OPTIONS"
151 .IX Header "OPTIONS"
152 \&\fBdgrep\fR supports most of \fIgrep\fR\|(1)'s options. Please refer to your
153 \&\fBgrep\fR documentation (i.e. the manpage or the texinfo manual) for
154 a complete listing. Only a few options are excluded because they do not
155 conform with the intended behaviour, see the list below.
156 .Sh "Options of grep that are not supported by dgrep"
157 .IX Subsection "Options of grep that are not supported by dgrep"
158 .IP "\fB\-r\fR, \fB\-\-recursive\fR, \fB\-d\fR \fIrecurse\fR, \fB\-\-directories\fR=\fIrecurse\fR" 4
159 .IX Item "-r, --recursive, -d recurse, --directories=recurse"
160 .PD 0
161 .IP "\fB\-d\fR \fIread\fR, \fB\-\-directories\fR=\fIread\fR" 4
162 .IX Item "-d read, --directories=read"
163 .PD
164 \&\fBdgrep\fR searches only in the \*(L"normal\*(R" files of a package. It skips all
165 directories and symlinks. Therefor the options of
166 grep that are specific to directories are not supported.
167 .SH "AUTHOR"
168 .IX Header "AUTHOR"
169 Matt Zimmerman <mdz@debian.org>
170 .PP
171 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
172 .SH "COPYRIGHT AND LICENCE"
173 .IX Header "COPYRIGHT AND LICENCE"
174 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
175 .PP
176 This program is free software; you can redistribute it and/or modify
177 it under the terms of the \s-1GNU\s0 General Public License as published by
178 the Free Software Foundation; either version 2, or (at your option)
179 any later version.
180 .PP
181 On Debian systems, a copy of the \s-1GNU\s0 General Public License may be
182 found in /usr/share/common\-licenses/GPL.
183 .SH "SEE ALSO"
184 .IX Header "SEE ALSO"
185 \&\fIgrep\fR\|(1), \fIegrep\fR\|(1), \fIfgrep\fR\|(1), \fIzgrep\fR\|(1), \fIdglob\fR\|(1), \fIregex\fR\|(7), \fIdpkg\fR\|(8)
4444
4545 Matt Zimmerman <mdz@debian.org>
4646
47 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
47 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
4848
4949 =head1 COPYRIGHT AND LICENCE
5050
00 #!/bin/sh
11
22 set -e
3
4 # set locale for sorting
5 LC_NUMERIC=C
6 export LC_NUMERIC
37
48 Usage() {
59 echo "Usage: dpigs [options]"
0 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
1 .\"
2 .\" Standard preamble:
3 .\" ========================================================================
4 .de Sh \" Subsection heading
5 .br
6 .if t .Sp
7 .ne 5
8 .PP
9 \fB\\$1\fR
10 .PP
11 ..
12 .de Sp \" Vertical space (when we can't use .PP)
13 .if t .sp .5v
14 .if n .sp
15 ..
16 .de Vb \" Begin verbatim text
17 .ft CW
18 .nf
19 .ne \\$1
20 ..
21 .de Ve \" End verbatim text
22 .ft R
23 .fi
24 ..
25 .\" Set up some character translations and predefined strings. \*(-- will
26 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
27 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
28 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
29 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
30 .\" nothing in troff, for use with C<>.
31 .tr \(*W-
32 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
33 .ie n \{\
34 . ds -- \(*W-
35 . ds PI pi
36 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
37 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
38 . ds L" ""
39 . ds R" ""
40 . ds C` ""
41 . ds C' ""
42 'br\}
43 .el\{\
44 . ds -- \|\(em\|
45 . ds PI \(*p
46 . ds L" ``
47 . ds R" ''
48 'br\}
49 .\"
50 .\" If the F register is turned on, we'll generate index entries on stderr for
51 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
52 .\" entries marked with X<> in POD. Of course, you'll have to process the
53 .\" output yourself in some meaningful fashion.
54 .if \nF \{\
55 . de IX
56 . tm Index:\\$1\t\\n%\t"\\$2"
57 ..
58 . nr % 0
59 . rr F
60 .\}
61 .\"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .hy 0
65 .if n .na
66 .\"
67 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
68 .\" Fear. Run. Save yourself. No user-serviceable parts.
69 . \" fudge factors for nroff and troff
70 .if n \{\
71 . ds #H 0
72 . ds #V .8m
73 . ds #F .3m
74 . ds #[ \f1
75 . ds #] \fP
76 .\}
77 .if t \{\
78 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
79 . ds #V .6m
80 . ds #F 0
81 . ds #[ \&
82 . ds #] \&
83 .\}
84 . \" simple accents for nroff and troff
85 .if n \{\
86 . ds ' \&
87 . ds ` \&
88 . ds ^ \&
89 . ds , \&
90 . ds ~ ~
91 . ds /
92 .\}
93 .if t \{\
94 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
95 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
96 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
97 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
98 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
99 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
100 .\}
101 . \" troff and (daisy-wheel) nroff accents
102 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
103 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
104 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
105 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
106 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
107 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
108 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
109 .ds ae a\h'-(\w'a'u*4/10)'e
110 .ds Ae A\h'-(\w'A'u*4/10)'E
111 . \" corrections for vroff
112 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
113 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
114 . \" for low resolution devices (crt and lpr)
115 .if \n(.H>23 .if \n(.V>19 \
116 \{\
117 . ds : e
118 . ds 8 ss
119 . ds o a
120 . ds d- d\h'-1'\(ga
121 . ds D- D\h'-1'\(hy
122 . ds th \o'bp'
123 . ds Th \o'LP'
124 . ds ae ae
125 . ds Ae AE
126 .\}
127 .rm #[ #] #H #V #F C
128 .\" ========================================================================
129 .\"
130 .IX Title "DPIGS 1"
131 .TH DPIGS 1 "2006-07-24" "perl v5.8.8" "Debian-goodies documentation"
132 .SH "NAME"
133 dpigs \- Show which installed packages occupy the most space
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 \&\fBdpigs\fR [\fIoptions\fR]
137 .SH "DESCRIPTION"
138 .IX Header "DESCRIPTION"
139 \&\fBdpigs\fR sorts the installed packages by size and outputs the largest
140 ones. Per default dpigs displays the largest 10 packages. You can change
141 this value by using the \fB\-n\fR option (see \*(L"\s-1OPTIONS\s0\*(R"). The information
142 is taken from the dpkg status file with \fIgrep\-status\fR\|(1).
143 .SH "OPTIONS"
144 .IX Header "OPTIONS"
145 .IP "\fB\-h\fR, \fB\-\-help\fR" 4
146 .IX Item "-h, --help"
147 Display some usage information and exit.
148 .IP "\fB\-n\fR, \fB\-\-lines\fR=\fIN\fR" 4
149 .IX Item "-n, --lines=N"
150 Display the N largest packages on the system (default 10).
151 .IP "\fB\-s\fR, \fB\-\-status\fR=\fI\s-1FILE\s0\fR" 4
152 .IX Item "-s, --status=FILE"
153 Use \fI\s-1FILE\s0\fR instead of the default dpkg status file (which is
154 \&\fI/var/lib/dpkg/status\fR currently).
155 .SH "AUTHOR"
156 .IX Header "AUTHOR"
157 Matt Zimmerman <mdz@debian.org>
158 .PP
159 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
160 .SH "COPYRIGHT AND LICENCE"
161 .IX Header "COPYRIGHT AND LICENCE"
162 Copyright (C) 2001 Matt Zimmerman <mdz@debian.org>.
163 .PP
164 This program is free software; you can redistribute it and/or modify
165 it under the terms of the \s-1GNU\s0 General Public License as published by
166 the Free Software Foundation; either version 2, or (at your option)
167 any later version.
168 .PP
169 On Debian systems, a copy of the \s-1GNU\s0 General Public License may be
170 found in /usr/share/common\-licenses/GPL.
171 .SH "SEE ALSO"
172 .IX Header "SEE ALSO"
173 \&\fIdpkg\fR\|(8), \fIgrep\-status\fR\|(1)
3535
3636 Matt Zimmerman <mdz@debian.org>
3737
38 This manpage was written by Frank Lichtenheld <frank@lichtenheld>.
38 This manpage was written by Frank Lichtenheld <frank@lichtenheld.de>.
3939
4040 =head1 COPYRIGHT AND LICENCE
4141
0 #!/bin/sh
1 # Network testing script v 1.3
2 # (c) 2005 Javier Fernandez-Sanguino
3 #
4 # This script will test your system's network configuration using basic
5 # tests and providing both information (INFO messages), warnings (WARN)
6 # and possible errors (ERR messages) by checking:
7 # - Interface status
8 # - Availability of configured routers, including the default route
9 # - Proper host resolution, including DNS checks
10 # - Proper network connectivity, including ICMP and web connections to
11 # a remote web server (the web server used for the tests can be configured,
12 # see below)
13 #
14 # Some of the network tests are described in more detail at
15 # http://ubuntuforums.org/archive/index.php/t-25557.html
16 #
17 # The script does not need special privileges to run as it does not
18 # do any system change. It also will not fix the errors by itself.
19 #
20 # Additional software requirements:
21 # * ip from the iproute package. (could probably be rewrittent to
22 # use ifconfig only or to parse /proc)
23 # * ping from the iputils-ping package or the netkit-ping package.
24 # * nc from the netcat package.
25 #
26 # This program is free software; you can redistribute it and/or modify
27 # it under the terms of the GNU General Public License as published by
28 # the Free Software Foundation; either version 2 of the License, or
29 # (at your option) any later version.
30 #
31 # This program is distributed in the hope that it will be useful,
32 # but WITHOUT ANY WARRANTY; without even the implied warranty of
33 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 # GNU General Public License for more details.
35 #
36 # You should have received a copy of the GNU General Public License
37 # along with this program; if not, write to the Free Software
38 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 #
40 # You can also find a copy of the GNU General Public License at
41 # http://www.gnu.org/licenses/licenses.html#TOCLGPL
42 #
43 # TODO
44 # - Works only on Linux, can this be generalised for other UNIX systems
45 # (probably not unless rewritten in C)
46 # - Does not check for errors properly, use -e and test intensively
47 # so that expected errors are trapped
48 # (specially for tools that are not available, like netcat)
49 # - If the tools are localised to languages != english the script might
50 # break
51 # - Ask 'host' maintainer to implement error codes as done with
52 # dlint
53 # - Should be able to check if DNS server is in the same network, if
54 # it doesn't answer to pings, check ARP in that case.
55 # - DHCP checks?
56 # - Other internal services tests? (LDAP if using pam...)
57 # - Generate summary of errors in the end (pretty report?)
58 # - Check if packets are being dropped by local firewall? (use dmesg
59 # and look for our tests)
60 # - Support wireless interfaces? (use iwconfig)
61 # - Check for more than one web server (have CHECK_HOSTS be a number
62 # of hosts and determine a metric to spout an error) ?
63 # - Use traceroute or tcptraceroute to see if there is network connectivity?
64 # (traceroute is usually blocked by firewalls but tcptraceroute might
65 # be an alternative to using nc)
66 # - Use mii-tool (requires root privileges)
67 # - Use ping -s XXXX to detect invalid MTUs
68 # - Use arpping to detect another host with our same IP address
69 # - Check other TODOs inline in the code
70
71
72 # BEGIN configuration
73 # Configure to your needs, these values will be used when
74 # checking DNS and Internet connectivity
75 # DNS name to resolve.
76 # These are default values which can be overriden by the environment.
77 [ -z "$CHECK_HOST" ] && CHECK_HOST=www.debian.org
78 [ -z "$CHECK_IP_ADRESS" ] && CHECK_IP_ADRESS=194.109.137.218
79 # Web server to check for
80 [ -z "$CHECK_WEB_HOST" ] && CHECK_WEB_HOST=www.debian.org
81 [ -z "$CHECK_WEB_PORT" ] && CHECK_WEB_PORT=80
82 # END configuration
83 export CHECK_HOST CHECK_IP_ADRESS CHECK_WEB_HOST CHECK_WEB_PORT
84
85 PATH=/bin:/sbin:/usr/bin:/usr/sbin
86 LC_ALL=C
87 export PATH LC_ALL
88
89 # Check if all commands we need are available
90 # NOTE: if using nslookup add "nslookup dnsutils"
91 ( echo -e "netstat net-tools\nifconfig net-tools\nping netkit-ping\n\
92 arp net-tools\nip iproute\nhost bind9-host\nmktemp debianutils\nnc netcat" |
93 while read cmd package; do
94 if ! `which $cmd 2>/dev/null >&2`; then
95 echo "$cmd is not available! (please install $package)" >&2
96 exit 1
97 fi
98 done ) || exit 1
99
100
101 # Extract the interface of our default route
102
103 defaultif=`netstat -nr |grep ^0.0.0.0 | awk '{print $8}' | head -1`
104 defaultroutes=`netstat -nr |grep ^0.0.0.0 | wc -l`
105 if [ -z "$defaultif" ] ; then
106 defaultif=none
107 echo "WARN: This system does not have a default route"
108 elif [ "$defaultroutes" -gt 1 ] ; then
109 echo "WARN: This system has more than one default route"
110 else
111 echo "INFO: This system has exactly one default route"
112 fi
113
114
115
116 # Check loopback
117 check_local () {
118 # Is there a loopback interface?
119 if [ -n "`ip link show lo`" ] ; then
120 # OK, can we ping localhost
121 if ! check_host localhost 1; then
122 # Check 127.0.0.1 instead (not everybody uses this IP address however,
123 # although its the one commonly used)
124 if ! check_host 127.0.0.1 1; then
125 echo "ERR: Cannot ping localhost (127.0.0.1), loopback is broken in this system"
126 else
127 echo "ERR: Localhost is not answering but 127.0.0.1, check /etc/hosts and verify localhost points to 127.0.0.1"
128 fi
129 else
130 echo "INFO: Loopback interface is working properly"
131 fi
132
133 else
134 echo "ERR: There is no loopback interface in this system"
135 status=1
136 fi
137 status=0
138 return $status
139 }
140
141 # Check network interfaces
142 check_if () {
143 ifname=$1
144 status=0
145 [ -z "$ifname" ] && return 1
146 # Find IP addresses for $ifname
147 inetaddr=`ip addr show $ifname | grep inet | awk '{print $2}'`
148 if [ -z "$inetaddr" ] ; then
149 echo "WARN: The $ifname interface does not have an IP address assigned"
150 status=1
151 else
152 # TODO: WARN if more than 2 IP addresses?
153 echo $inetaddr | while read ipaddr; do
154 echo "INFO: The $ifname interface has IP address $ipaddr assigned"
155 done
156 fi
157
158 # Lookup TX and RX statistics
159 # TODO: This is done using ifconfig but could use /proc/net/dev for
160 # more readibility or, better, 'netstat -i'
161 txpkts=`ifconfig $ifname | awk '/RX packets/ { print $2 }' |sed 's/.*://'`
162 rxpkts=`ifconfig $ifname | awk '/RX packets/ { print $2 }' |sed 's/.*://'`
163 txerrors=`ifconfig $ifname | awk '/TX packets/ { print $3 }' |sed 's/.*://'`
164 rxerrors=`ifconfig $ifname | awk '/RX packets/ { print $3 }' |sed 's/.*://'`
165 # TODO: Check also frames and collisions, to detect faulty cables
166 # or network devices (cheap hubs)
167 if [ "$txpkts" -eq 0 ] && [ "$rxpkts" -eq 0 ] ; then
168 echo "ERR: The $ifname interface has not tx or rx any packets. Link down?"
169 status=1
170 elif [ "$txpkts" -eq 0 ]; then
171 echo "WARN: The $ifname interface has not transmitted any packets."
172 elif [ "$rxpkts" -eq 0 ] ; then
173 echo "WARN: The $ifname interface has not received any packets."
174 else
175 echo "INFO: The $ifname interface has tx and rx packets."
176 fi
177 # TODO: It should be best if there was a comparison with tx/rx packets.
178 # a few errors are not uncommon if the card has been running for a long
179 # time. It would be better if a relative comparison was done (i.e.
180 # less than 1% ok, more than 20% warning, over 80% major issue, etc.)
181 if [ "$txerrors" -ne 0 ]; then
182 echo "WARN: The $ifname interface has tx errors."
183 fi
184 if [ "$rxerrors" -ne 0 ]; then
185 echo "WARN: The $ifname interface has rx errors."
186 fi
187 return $status
188 }
189
190 check_netif () {
191 status=0
192 ip link show | egrep '^[[:digit:]]' |
193 while read ifnumber ifname status extra; do
194 ifname=`echo $ifname |sed -e 's/:$//'`
195 if [ -z "`echo $status | grep UP\>`" ] ; then
196 if [ "$ifname" = "$defaultif" ] ; then
197 echo "ERR: The $ifname interface that is associated with your defualt route is down!"
198 status=1
199 elif [ "$ifname" = "lo" ] ; then
200 echo "ERR: Your lo inteface is down, this might cause issues with local applications (but not necessarily with network connectivity)"
201 else
202 echo "WARN: The $ifname interface is down"
203 fi
204 else
205 # Check network routes associated with this interface
206 echo "INFO: The $ifname interface is up"
207 check_if $ifname
208 check_netroute $ifname
209 fi
210 done
211 return $status
212 }
213
214 check_netroute () {
215 ifname=$1
216 [ -z "$ifname" ] && return 1
217 netstat -nr | grep "${ifname}$" |
218 while read network gw netmask flags mss window irtt iface; do
219 # For each gw that is not the default one, ping it
220 if [ "$gw" != "0.0.0.0" ] ; then
221 if ! check_router $gw ; then
222 echo "ERR: The default route is not available since the default router is unreachable"
223 fi
224 fi
225 done
226 }
227
228 check_router () {
229 # Checks if a router is up
230 router=$1
231 [ -z "$router" ] && return 1
232 status=0
233 # First ping the router, if it does not answer then check arp tables and
234 # see if we have an arp. We use 5 packets since it is in our local network.
235 ping -n -q -c 5 "$router" >/dev/null 2>&1
236 if [ "$?" -ne 0 ]; then
237 echo "WARN: Router $router does not answer to ICMP pings"
238 # Router does not answer, check arp
239 routerarp=`arp -n | grep "^$router" | grep -v incomplete`
240 if [ -z "$routerarp" ] ; then
241 echo "ERR: We cannot retrieve a MAC address for router $router"
242 status=1
243 fi
244 fi
245 if [ "$status" -eq 0 ] ; then
246 echo "INFO: The router $router is reachable"
247 fi
248 return $status
249 }
250
251 check_host () {
252 # Check if a host is reachable
253 # TODO:
254 # - if the host is in our local network (no route needs to be used) then
255 # check ARP availability
256 # - if the host is not on our local network then check if we have a route
257 # for it
258 host=$1
259 [ -z "$host" ] && return 1
260 # Use 10 packets as we expect this to be outside of our network
261 COUNT=10
262 [ -n "$2" ] && COUNT=$2
263 status=0
264 ping -n -q -c $COUNT "$host" >/dev/null 2>&1
265 if [ "$?" -ne 0 ]; then
266 echo "WARN: Host $host does not answer to ICMP pings"
267 status=1
268 else
269 echo "INFO: Host $host answers to ICMP pings"
270 fi
271 return $status
272 }
273
274 check_dns () {
275 # Check the nameservers defined in /etc/resolv.conf
276 status=1
277 nsfound=0
278 nsok=0
279 tempfile=`mktemp tmptestnet.XXXXXX` || { echo "ERR: Cannot create temporary file! Aborting! " >&2 ; exit 1; }
280 trap " [ -f \"$tempfile\" ] && /bin/rm -f -- \"$tempfile\"" 0 1 2 3 13 15
281 cat /etc/resolv.conf |grep nameserver |
282 awk '/nameserver/ { for (i=2;i<=NF;i++) { print $i ; } }' >$tempfile
283 for nameserver in `cat $tempfile`; do
284 nsfound=$(( $nsfound + 1 ))
285 echo "INFO: This system is configured to use nameserver $nameserver"
286 check_host $nameserver 5
287 if check_ns $nameserver ; then
288 nsok=$(( $nsok +1 ))
289 else
290 status=$?
291 fi
292 done
293 #Could also do:
294 #nsfound=`wc -l $tempfile | awk '{print $1}'`
295 /bin/rm -f -- "$tempfile"
296 trap 0 1 2 3 13 15
297 if [ "$nsfound" -eq 0 ] ; then
298 echo "ERR: The system does not have any nameserver configured"
299 else
300 if [ "$status" -ne 0 ] ; then
301 if [ "$nsfound" -eq 1 ] ; then
302 echo -e "ERR: There is one nameserver configured for this system but it does not work properly"
303 else
304 echo "ERR: There are $nsfound nameservers configured for this system and none of them works properly"
305 fi
306 else
307 if [ "$nsfound" -eq 1 ] ; then
308 echo "INFO: The nameserver configured for this system works properly"
309 else
310 echo "INFO: There are $nsfound nameservers is configured for this system and $nsok are working properly"
311 fi
312 fi
313 fi
314 return $status
315 }
316
317 check_ns () {
318 # Check the nameserver using host
319 # TODO: use nslookup?
320 # nslookup $CHECK_HOST -$nameserver
321 nameserver=$1
322 [ -z "$nameserver" ] && return 1
323 status=1
324 CHECK_RESULT="$CHECK_HOST .* $CHECK_IP_ADDRESS"
325 # Using dnscheck:
326 dnscheck=`host -t A $CHECK_HOST $nameserver 2>&1 | tail -1`
327 if [ -n "`echo $dnscheck |grep NXDOMAIN`" ] ; then
328 echo "ERR: Dns server $nameserver does not resolv properly"
329 elif [ -n "`echo $dnscheck | grep \"timed out\"`" ] ; then
330 echo "ERR: Dns server $nameserver is not available"
331 elif [ -z "`echo $dnscheck | egrep \"$CHECK_RESULT\"`" ] ; then
332 echo "WARN: Dns server $nameserver did not return the expected result for $CHECK_HOST"
333 else
334 echo "INFO: Dns server $nameserver resolved correctly $CHECK_HOST"
335 status=0
336 fi
337
338 # Using dlint
339 # dlint $CHECK_HOST @$nameserver >/dev/null 2>&1
340 # if [ $? -eq 2 ] ; then
341 # echo "ERR: Dns server $nameserver does not resolv properly"
342 # elif [ $? -ne 0 ]; then
343 # echo "ERR: Unexpected error when testing $nameserver"
344 # else
345 # echo "INFO: Dns server $nameserver resolved correctly $CHECK_HOST"
346 # status=0
347 # fi
348
349 return $status
350 }
351
352 check_conn () {
353 # Checks network connectivity
354 if ! check_host $CHECK_WEB_HOST >/dev/null ; then
355 echo "WARN: System does not seem to reach Internet host $CHECK_WEB_HOST through ICMP"
356 else
357 echo "INFO: System can reach Internet host $CHECK_WEB_HOST"
358 fi
359 status=0
360 # Check web access, using nc
361 # TODO:
362 # - this could also implement proxy checks (if the http_proxy environment is
363 # defined?)
364 # - could also check against a valid content copy (otherwise it might be
365 # fooled by transparent proxies)
366 echo -e "HEAD / HTTP/1.0\n\n" |nc -w 20 $CHECK_WEB_HOST $CHECK_WEB_PORT >/dev/null 2>&1
367 if [ $? -ne 0 ] ; then
368 echo "ERR: Cannot access web server at Internet host $CHECK_WEB_HOST"
369 status=1
370 else
371 echo "INFO: System can access web server at Internet host $CHECK_WEB_HOST"
372 fi
373 return $status
374 }
375
376 # TODO: checks could be conditioned, i.e. if there is no proper
377 # interface setup don't bother with DNS and don't do some Inet checks
378 # if DNS is not setup properly
379 check_local || exit 1
380 check_netif || exit 1
381 check_dns || exit 1
382 check_conn || exit 1
383
384 exit 0
385
0 .\" network-test.1 - check the network and test if everything is OK
1 .\" Copyright (C) 2006 Javier Fernandez-Sanguino
2 .\" Everybody is allowed to distribute this manual page,
3 .\" to modify it, and to distribute modifed versions of it.
4 .TH network-test 1 "July 24 2006" "debian\-goodies" "debian\-goodies"
5 .SH NAME
6 network-test \- check the network and test if everything is fine
7 .SH SYNOPSIS
8 .B network-test
9 .SH DESCRIPTION
10 The
11 .B network-test
12 program will test your system's network configuration using basic
13 tests and providing both information (\fBINFO\fP), warnings (\fBWARN\fP)
14 and possible errors (\fBERR\fP) by checking:
15 .RS
16 * Interface status, number of transmitted packets and error rates.
17
18 * Availability of configured routers, including the default router.
19
20 * Proper host resolution, testing DNS resolution against a known host.
21
22 * Proper network connectivity, testing reachability of remote hosts using
23 ICMP and simulating a web connections to a remote web server (the web server
24 used for the tests can be configured through the environment, see below)
25 .RE
26
27 .P
28 The script does not need special privileges to run as it does not
29 do any system change.
30
31 .SH ENVIRONMENT
32
33 The program will, by default, check
34 .B www.debian.org
35 and its associated web server. If you want to use a different check host you
36 can setup the environment as follows:
37 .br
38 .TP
39 .B CHECK_HOST
40 The name of a host to use when testing DNS resolution.
41 .TP
42 .B CHECK_IP_ADRESS
43 The IP address of the host defined in
44 .B CHECK_HOST
45 .TP
46 .B CHECK_WEB_HOST
47 The web server to use for testing purposes when testing network connectivity.
48 .TP
49 .B CHECK_WEB_PORT
50 The web server port of server
51 .B CHECK_WEB_HOST
52 that will be used for testing.
53
54 .SH EXIT STATUS
55
56 The program will exit with error (1) if any of the network checks fail.
57
58 .SH BUGS
59 This program does not have \fIsuper cow powers\fP so it is unable to fix the
60 errors by itself. It is also unable to detect if the network is failing due to
61 a local firewall policy been in place so make sure you check your system logs
62 with
63 .B dmesg(1)
64
65 .\".SH SEE ALSO
66
67 .SH AUTHOR
68
69 .B network-test
70 was written by Javier Fernandez-Sanguino for the Debian
71 GNU/Linux distribution.
72
73 .SH COPYRIGHT AND LICENCE
74
75 Copyright (C) 2005,2006 Javier Fernandez-Sanguino <jfs@debian.org>.
76
77 This program is free software; you can redistribute it and/or modify
78 it under the terms of the GNU General Public License as published by
79 the Free Software Foundation; either version 2, or (at your option)
80 any later version.
81
82 On Debian systems, a copy of the GNU General Public License may be
83 found in /usr/share/common-licenses/GPL.
84
3030 elif o in ("-o", "--output"):
3131 outputfile = a
3232
33 if len(args) > 1:
33 if len(args) >= 1:
3434 popconfile = args[0]
35 if not os.path.exists(popconfile):
36 sys.stderr.write('''
37 I cannot file the popularity-contest data you pointed me to.
38 This program requires the data collected from popularity-contest
39 in order to work.
40
41 ''')
42 sys.exit(1)
3543 else:
3644 if not os.path.exists(popconfile):
3745 if not os.path.exists('/usr/sbin/popularity-contest'):
3636 .SH SEE ALSO
3737 .BR rc\-alert (1),
3838 .BR popularity\-contest (8)
39 .SH AUTOR
39 .SH AUTHOR
4040 The
4141 .B popbugs
4242 program is copyright \(co 2001 Matt Zimmerman <mdz@debian.org>.
0 #! /usr/bin/python
1 # which-pkg-broke: help find offending packages when something breaks
2 # Placed in the public domain by Bill Gribble <grib@billgribble.com>
3
4 import sys
5 import os
6 import popen2
7 import time
8 from string import *
9 from stat import *
10
11 def pkgdeps(pkg):
12 outstr, instr = popen2.popen4("LC_ALL=C apt-cache depends %s" % pkg)
13 deps = []
14 myline = outstr.readline()
15 while(myline != ''):
16 elts = map(strip, myline.split(':'))
17 if len(elts) == 2:
18 how, pkg = elts
19 if how == 'Depends':
20 deps.append(pkg)
21 myline = outstr.readline()
22 return deps
23
24 def alldeps(pkg, ignore):
25 deps = {}
26 imm_deps = pkgdeps(pkg)
27 for i in imm_deps:
28 if ignore.get(i) is None:
29 deps[i] = 1
30 ignore[i] = 1
31 childeps = alldeps(i, ignore)
32 for c in childeps:
33 deps[c] = 1
34 ignore[i] = 1
35
36 dlist = deps.keys()
37 return dlist
38
39 def pkginstalltime(pkg):
40 listfile = '/var/lib/dpkg/info/' + pkg + '.list'
41 try:
42 return os.stat(listfile)[ST_MTIME]
43 except:
44 print "Package", pkg, "has no install time info"
45 return None
46
47 def what_broke(pname):
48 def sortfun(a, b):
49 return cmp(a[1], b[1])
50
51 pkgs = [ pname ]
52 pkgs.extend(alldeps(sys.argv[1], {}))
53
54 itimes = []
55 for p in pkgs:
56 itimes.append([p, pkginstalltime(p)])
57 itimes.sort(sortfun)
58 for i in itimes:
59 p, t = i
60 if t is not None:
61 print ljust(p, 54), time.asctime(time.localtime(float(t)))
62
63 if (len(sys.argv) != 2 or sys.argv[1][0] == '-'):
64 print "Usage: what-broke <pkg-name>"
65 sys.exit(-1)
66 else:
67 what_broke(sys.argv[1])
68 sys.exit(0)
0 .\" which-pkg-broke.1 - find which package might have broken another
1 .\" Copyright (C) 2006 Javier Fernandez-Sanguino
2 .\" Everybody is allowed to distribute this manual page,
3 .\" to modify it, and to distribute modifed versions of it.
4 .TH which-pkg-broke 1 "July 24 2006" "debian\-goodies" "debian\-goodies"
5 .SH NAME
6 which-pkg-broke \- find which package might have broken another
7 .SH SYNOPSIS
8 .B which-pkg-broke
9 .RI package
10 .SH DESCRIPTION
11 The
12 .B which-pkg-broke
13 program will retrieve a list of the named package and all its dependencies
14 sorted by the time they were installed on the system (as determined
15 from the mtime information of
16 .B /var/lib/dpkg/info/*.list
17 \).
18
19 This tool makes it possible for a system admin to obtain information that might
20 correlate installation of package dependencies with a package breakage in order
21 to find which package update might be responsible for the breakage.
22
23 .SH EXAMPLES
24 This tool can be useful determine which package dependancies were upgraded
25 more recently and might be associated with the bug that is being observed.
26 For example, if aptitude stops working properly, an administrator can run:
27
28 .br
29 \fB$ which-pkg-broke aptitude\fP
30 .br
31 Package <libapt-pkg-libc6.3-5-3.3> has no install time info
32 .br
33 libdb1-compat Fri Aug 8 03:02:11 2003
34 .br
35 libsigc++-1.2-5c102 Fri Aug 8 05:15:58 2003
36 .br
37 aptitude Sun Jan 11 17:38:06 2004
38 .br
39 libncurses5 Sun Jan 18 08:11:05 2004
40 .br
41 libc6 Thu Jan 22 07:55:10 2004
42 .br
43 libgcc1 Tue Jan 27 07:37:22 2004
44 .br
45 gcc-3.3-base Tue Jan 27 07:37:31 2004
46 .br
47 libstdc++5 Tue Jan 27 07:37:32 2004
48 .br
49
50 So depending on exactly when the misbehaviour started, there may be a reason to
51 point the finger at a more-recently updated library like \fBlibstdc++\fP or
52 \fBlibncurses\fP, which are more-recently installed than
53 aptitude itself.
54
55
56 .SH SEE ALSO
57 .BR rc\-alert (1)
58
59 .SH AUTHOR
60 .B which-pkg-broke
61 was written by Bill Gribble <grib AT billgribble.com>
62
63 This manual page was written by Javier Fernandez-Sanguino for the Debian
64 GNU/Linux distribution.