Codebase list debian-goodies / debian/0.30
Imported Debian version 0.30 Javier Fernandez-Sanguino 12 years ago
9 changed file(s) with 423 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
Binary diff not shown
119119 if path.endswith('.sh'):
120120 continue
121121 package.initscripts.append(path)
122 # Alternatively, find init.d scripts that match the process name
123 if len(package.initscripts) == 0:
124 for process in package.processes:
125 path = '/etc/init.d/' + os.path.basename(process.program)
126 if os.path.exists(path):
127 package.initscripts.append(path)
128 # Remove duplicate inits
129 package.initscripts = [ u for u in package.initscripts if u not in locals()['_[1]'] ]
122130
123131 restartable = []
124132 nonrestartable = []
130138 else:
131139 nonrestartable.append(package)
132140
133 print
134 print "Of these, %d seem to contain init scripts which can be used to restart them:" % len(restartable)
135 # TODO - consider putting this in a --verbose option
136 print "Of these, the following seem to contain init scripts which can be used to restart them:"
137 for package in restartable:
138 print package.name + ':'
139 for process in package.processes:
140 print "\t%s\t%s" % (process.pid,process.program)
141 if len(restartable) > 0:
142 print
143 print "Of these, %d seem to contain init scripts which can be used to restart them:" % len(restartable)
144 # TODO - consider putting this in a --verbose option
145 print "The following packages seem to have init scripts that could be used\nto restart them:"
146 for package in restartable:
147 print package.name + ':'
148 for process in package.processes:
149 print "\t%s\t%s" % (process.pid,process.program)
141150
142 print
143 print "These are the init scripts:"
144 print '\n'.join(restartCommands)
145 print
151 print
152 print "These are the init scripts:"
153 print '\n'.join(restartCommands)
154 print
146155
147156 if len(nonrestartable) == 0:
148157 sys.exit(0)
149158
150159 # TODO - consider putting this in a --verbose option
151 print "Here are the others that do not seem to contain an init script for restarting them::"
160 print "These processes do not seem to han an associated init script to restart them:"
152161 for package in nonrestartable:
153162 print package.name + ':'
154163 for process in package.processes:
167176 elif field == 'n':
168177 # Remove the previous entry to check if this is something we should do
169178 if data.startswith('/SYSV'):
179 last = process.descriptors.pop()
180 if not re.compile("DEL").search(last):
181 process.files.append(data)
182 elif data.startswith('/dev/zero'):
170183 last = process.descriptors.pop()
171184 if not re.compile("DEL").search(last):
172185 process.files.append(data)
283296 # what dpkg would do. Now we need to be more contrieved.
284297 def needsRestart(self):
285298 for f in self.files:
286 #print "Checking %s" % f
287299 # We don't care about log files
288300 if f.startswith('/var/log/'):
289301 continue
290302 # Or about files under /tmp
291303 if f.startswith('/tmp/'):
304 continue
305 # Or /dev/zero
306 if f.startswith('/dev/zero'):
292307 continue
293308 # TODO: it should only care about library files (i.e. /lib, /usr/lib and the like)
294309 # build that check with a regexp to exclude others
297312 if re.compile("\(path inode=[0-9]+\)$").search(f):
298313 return 1
299314 for f in self.descriptors:
300 # If it begins with SYSV it is not a deleted file
315 # Notice that if it begins with SYSV or /dev/zero
316 # it is not a deleted file and the descriptor was popped already
317 # (see above)
301318 if re.compile("DEL").search(f):
302319 return 1
303320 for f in self.links:
0 debian-goodies (0.30) unstable; urgency=low
1
2 * checkrestart changes:
3 * Do not warn on processes than use /dev/zero and shows up as
4 deleted. This prevents it from warning about apache2 (Closes: #432569)
5 * Slightly improve the messages output.
6 * Find init.d scripts even if not provided in the package by looking
7 for init.d scripts that match the process name (works for apache2 too)
8 * Fix some typos in which-pkg-broke(1) (Closes: #409581)
9
10 -- Javier Fernandez-Sanguino Pen~a <jfs@debian.org> Wed, 22 Aug 2007 22:59:27 +0200
11
012 debian-goodies (0.29) unstable; urgency=low
113
214 * Network-test: use -t switch to use user's TMPDIR or /tmp instead of
0 # Debian debmany(1) completion.
1 #
2 have debmany &&
3 _debmany()
4 {
5 local cur prev
6
7 COMPREPLY=()
8 cur=${COMP_WORDS[COMP_CWORD]}
9 prev=${COMP_WORDS[COMP_CWORD-1]}
10
11 if [[ "$prev" == -m ]]; then
12 case "${cur:0:1}" in
13 \"|\') local manpageviewer="${cur:1}";;
14 *) local manpageviewer="$cur";;
15 esac
16 COMP_WORDS=(COMP_WORDS[0] $manpageviewer)
17 COMP_CWORD=1
18 _command
19 # not perfect: '-m "konquer<tab' gets completed to '-m "konqueror"'
20 # and '-m konquer<tab' gets completed to '-m konqueror'
21 # both shall complete to '-m "konqueror man:%s"' ?!
22 # but [ ${#COMPREPLY[@]} -eq 1 ] && [ ${COMPREPLY:0:1} != '"' ] && COMPREPLY[0]='"'$COMPREPLY' man:%s"'
23 # completes to debmany -m \"konqueror\ man\:%s\"
24 # my knowledge is too low concerning completion
25 # whole -m section should be rewritten by someone with knowledge
26 else
27 if [[ "$cur" == -* ]]; then
28 COMPREPLY=( $( compgen -W '-? -h --help -k -g -x -m' -- $cur ) )
29 else
30 COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null; ) )
31 [ ${#COMPREPLY[@]} -eq 0 ] && _filedir deb
32 fi
33 fi
34
35 return 0
36 } &&
37 complete -F _debmany $filenames debmany
0 #!/bin/bassh
1 # script: debmany
2 # author: Michael Arlt
3 # description: select the manpages of any [not] installed debian package
4 # comment: debmany is based on the work of debman and debget
5 # uses: whiptail (preferred) or dialog
6 # This is free software. You may redistribute copies of it under the terms of
7 # the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
8 # There is NO WARRANTY, to the extent permitted by law.
9
10 LC_ALL=C
11
12 # choose the manpageviewer
13 mancmdline="man %s" # default manpageviewer
14 test -n "$DEBMANY_MANPAGE_VIEWER" && mancmdline="$DEBMANY_MANPAGE_VIEWER" # override default manpageviewer
15
16 curdir=`pwd`
17
18 error()
19 {
20 # show errorcode and quit
21 echo "ERROR: $*" >&2
22 exit 1
23 }
24
25 usage()
26 {
27 self="${0##*/}"
28 echo "debmany 1.1 Sun Aug 19 20:11:48 CEST 2007
29 Description: Display a manpage from a Debian package.
30 The list of manpages is displayed in a dialog.
31 Supported locations for debian packages are: Local .deb-file,
32 a package in the repository or a installed package.
33 Syntax : $self [-?|-h|--help] [-m manpageviewer|-k|-g|-x] package|package.deb
34
35 Examples: $self foo.deb show manpages from a local package file foo.deb
36 $self foo show manpages from a package, if the package is
37 not installed it is retrieved from the
38 configured repositories.
39 $self -k foo show manpages using your preferred man-viewer
40 (KDE users)
41 $self -g foo show manpages using your preferred man-viewer
42 (GNOME users)
43 $self -x foo show manpages using your preferred man-viewer
44 using xdg-open (Xfce users)
45 $self -m 'konqueror man:%s' foo
46 show manpages using konqueror as man-viewer
47 export DEBMANY_MANPAGE_VIEWER='konqueror man:%s'; $self sc"
48 if [ $# -eq 0 ]
49 then
50 exit 0
51 else
52 error "$*"
53 fi
54 }
55
56 case "$1" in
57 "-?"|-h|--help) usage ;;
58 -m) shift
59 # override default manpageviewer or environment variable DEBMANY_MAN_VIEWER
60 mancmd=($1) # get first word from manpageviewer
61 if which $mancmd >/dev/null 2>&1 # is the manpageviewer executeable?
62 then
63 mancmdline="$1"
64 shift
65 else
66 usage "Manpageviewer '$mancmd' is not available or executable"
67 fi
68 ;;
69 -k) shift; mancmdline='kfmclient exec man:%s';; # set kde viewer
70 -g) shift; mancmdline='gnome-open man:%s';; # set gnome viewer
71 -x) shift; mancmdline='xdg-open man:%s';; # set independant viewer
72 -*) usage "Unknown option $1"
73 ;;
74 esac
75
76 test $# -ne 1 && usage "You must specify one package or a Debian package file"
77
78 # determine the size of your terminal
79 declare -i size=(`stty size`)
80 declare -i x=${size[1]}
81 declare -i y=${size[0]}
82
83 # if it is impossible to determine the size
84 if [ $x -eq 0 ]
85 then
86 x=80
87 y=25
88 echo "Unable to determine the size of your terminal - using Console default: $x*$y" >&2
89 sleep 3
90 fi
91
92 # test upon minimum resolution
93 if [ $x -lt 40 -o $y -lt 9 ]
94 then
95 error "Resolution too small ($x*$y). I need a minimum of 40*9 - recommended is more..."
96 fi
97
98 # set the size of the dialog window and menu
99 x=x-1 # width of the dialog
100 y=y-1 # height of the dialog
101 declare -i h=y-7 # height of the menu
102
103 if [ "${1##*.}" = "deb" ]
104 then
105 # mode1: you want to see manpages from a .deb-file
106 if [ -r "$1" ] ; then
107 file=`readlink -f "$1"`
108 status=file
109 else
110 error "The file $1 cannot be read"
111 fi
112 else
113 # mode 2: test if you have the package already installed
114 for man in `dpkg -L "$1" 2>/dev/null | grep -e /usr/share/man -e /usr/X11R6/man|sort`
115 do
116 # mode 2: add the manpages to the list
117 test -f $man && manpages="$manpages $man ${man##*/}"
118 done
119 fi
120
121 # TODO: If there is a locally installed package with no manpages
122 # it will try to download a new version. This could be considered
123 # a bug or a feature (as there are slim chances of this to
124 # provide any new manpages). Maybe it should just abort if the
125 # packaged is installed but there are no manpages to see.
126 if [ -n "$manpages" ]
127 then
128 # mode 2
129 cd /
130 status=installed
131 else
132 # mode 1 and 3
133 trap 'test -n "$temp" && rm -rf $temp; exit' 0 2 15 # cleanup
134
135 tmp=/dev/shm # set default tempdir
136 test -d $tmp || tmp=/tmp # if not available use /tmp
137
138 # make a temporary folder for the manpages - $TMPDIR overrides the path of -p
139 temp=`mktemp -d -p $tmp debmany.XXXXXXXXXX` || error "Unable to create a temporary folder."
140
141 if [ -z "$file" ]
142 then
143 # mode 3: find the package.deb
144 aptdata=`apt-get -q2 --print-uris --reinstall install "$1" 2>/dev/null | tail -1`
145 if [ -z "$aptdata" ]
146 then
147 error "There is no package called '$1'."
148 exit 1
149 fi
150
151 url=`echo "$aptdata" | sed -e "s/^'\([^']*\)'.*$/\1/"`
152 test -z "$url" && error "Could not obtain an URL for '$pkgspec'."
153
154 if [ "${url%%:*}" = "file" ]
155 then
156 # mode 3: access the local file
157 file="${url#*:}"
158 if [ ! -r "$file" ]
159 then
160 error "Could not access '$file' from the repository."
161 fi
162 status=repos-file
163 else
164 # mode 3: download the local file
165 file="$temp/tmp.deb"
166 curl "$url" >"$file" || error "Could not download '$file' from the repository."
167 status=repos-curl
168 fi
169 fi
170 cd $temp
171 # extract the manpages
172 MANDIRS='usr/share/man usr/X11R6/man ./usr/share/man ./usr/X11R6/man'
173 dpkg --fsys-tarfile "$file" | tar -xf - $MANDIRS 2>/dev/null
174 manpages=`find usr -type f|sort|sed -e 's§\([^/]*\)$§\1 \1§'`
175 fi
176
177 # choose whiptail or dialog
178 whiptail=/usr/bin/whiptail
179 dialog=/usr/bin/dialog
180 test -x $whiptail && cmd=$whiptail || cmd=$dialog
181
182 while true
183 do
184 # test if manpages where found
185 test -z "$manpages" && error "No manpage exists for package '$1'."
186
187 # select your manpages using dialog
188 exec 3>&1
189 return=`$cmd --title "Select a manpage ($status:$1)" --menu '' $y $x $h $manpages 2>&1 1>&3`
190 exec 3>&-
191 if [ -n "$return" ]
192 then
193 # show the manpage
194 `printf "$mancmdline" "$PWD/$return"`
195 else
196 cd $curdir
197 exit
198 fi
199 done
200
201 # This should not be reached
202 cd $curdir
203 exit 0
0 .TH "DEBMANY" "1" "1.1" "Michael Arlt" "Dienstprogramme für Benutzer"
1 .SH "NAME"
2 debmany \- Wählen von manpages aus installierten Paketen, Paketen des Repositories oder .deb\-Dateien zum Betrachten mit "man" oder einem alternativen Viewer.
3 .SH "SYNTAX"
4 .B debmany
5 \fI\-\-help
6 .br
7 .B debmany
8 \fI[\-m manpageviewer|\-k|\-g|\-x] Paket|Paket.deb\fR
9 .SH "BESCHREIBUNG"
10 .\" Add any additional description here
11 .PP
12 Wählen Sie eine Manpage von einem Debian Paket um sie mit "man" oder einem alternativen Viewer zu betrachten. Die Liste der Manpages wird in einem Dialog dargestellt. Unterstützte Quellen für Debian Pakete sind: Lokale .deb\-Datei, ein Paket aus dem Repository oder ein installiertes Paket.
13 .TP
14 \fB\-\-help\fR
15 zeigt eine kurze Hilfe und beendet sich
16 .TP
17 \fB\-m manpageviewer\fR
18 Setzt optional den Manpageviewer. Der Viewer muss .gz Dateien unterstützen. Durch die Umgebungsvariable DEBMANY_MANPAGE_VIEWER kann der gewünschte Manpageviewer voreingestellt werden. Hierbei ist zu beachten, dass der komplette Aufruf formuliert werden muss. "%s" wird durch den Pfad zur Manpage ersetzt. Der Aufruf muss in "" oder '' gefasst werden \- siehe Beispiele.
19 Bei der Benutzung eines grafischen Manpageviewers müssen Sie sicherstellen, dass Sie Zugriff auf den Desktop haben (ggf.: sux oder ssh mit x\-forwarding)
20 .TP
21 \fB\-k\fR
22 Zeigt die Manpage im bevorzugten Viewer (muss .gz Dateien unterstützen) an, falls Sie KDE benutzen \- Kurzform von \-m 'kfmclient exec man:%s'. "kfmclient" ist Teil des Paketes "konqueror".
23 .TP
24 \fB\-g\fR
25 Zeigt die Manpage im bevorzugten Viewer (muss .gz Dateien unterstützen) an, falls Sie GNOME benutzen \- Kurzform von \-m 'gnome\-open man:%s'. "gnome\-open" ist Teil des Paketes "libgnome2\-0".
26 .TP
27 \fB\-x\fR
28 Zeigt die Manpage im bevorzugten Viewer (muss .gz Dateien unterstützen) an, falls Sie KDE/GNOME/Xfce benutzen \- Kurzform von \-m 'xdg\-open man:%s'. "xdg\-open" ist Teil des Paketes "xdg\-utils".
29 .PP
30 Die Manpages werden temporär nach /dev/shm (sofern dieses Verzeichnis existiert) oder /tmp extrahiert. Durch das Setzen und Exportieren der Umgebungsvariable TMPDIR kann der Speicherort überschrieben werden.
31 .PP
32 Das Debian Paket "whiptail" (bevorzugt) oder "dialog" sowie "curl" muss installiert sein.
33 .SH "BEISPIELE"
34 .TP
35 debmany coreutils
36 Zeigt alle Manpages des installierten Debian Pakets "coreutils" mit "man" an.
37 .TP
38 debmany 3dchess
39 Zeigt alle Manpages des Paketes "3dchess" mit "man" an. Da es noch nicht installiert ist wird es vom Repository bezogen \- wenn nötig auch per Download.
40 .TP
41 debmany test.deb
42 Zeigt alle Manpages des lokalen Debian Paketes "./test.deb" mit "man" an.
43 .TP
44 debmany \-k sc
45 Benutzt den bevorzugten Manviewer (für KDE Anwender)
46 .TP
47 debmany \-g sc
48 Benutzt den bevorzugten Manviewer (für GNOME Anwender)
49 .TP
50 debmany \-x sc
51 Benutzt den bevorzugten Manviewer (für KDE/GNOME/Xfce Anwender)
52 .TP
53 debmany \-m 'konqueror man:%s' sc
54 Benutzt Konqueror als Viewer
55 .TP
56 export DEBMANY_MANPAGE_VIEWER="konqueror man:%s"; debmany sc
57 Benutzt den in der Umgebungsvariable DEBMANY_MANPAGE_VIEWER festgelegten Viewer (konqueror)
58 .SH "AUTOR"
59 Geschrieben von Michael Arlt.
60 .SH "LIZENZ"
61 This is free software. You may redistribute copies of it under the terms of
62 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
63 There is NO WARRANTY, to the extent permitted by law.
0 .TH "DEBMANY" "1" "1.1" "Michael Arlt" "User Commands"
1 .SH "NAME"
2 debmany \- select manpages from installed packages, packages from the repository or .deb\-files for viewing using "man" or an alternative viewer.
3 .SH "SYNOPSIS"
4 .B debmany
5 \fI\-\-help
6 .br
7 .B debmany
8 \fI[\-m manpageviewer|\-k|\-g|\-x] package|package.deb\fR
9 .SH "DESCRIPTION"
10 .\" Add any additional description here
11 .PP
12 Select a manpage from a debian package for viewing with man or an alternative viewer. The list of manpages is displayed in a dialog. Supported locations for debian packages are: Local .deb\-file, a package in the repository or a installed package.
13 .TP
14 \fB\-\-help\fR
15 display a small help and exit
16 .TP
17 \fB\-m manpageviewer\fR
18 Optionally set a manpage viewer. The viewer must support .gz files. You can preset the desired manpage viewer with the environment variable DEBMANY_MANPAGE_VIEWER. You must define the complete request. "%s" gets replaced with the path to the manpage. The manpageviewer must be enclosed with "" or '' \- see examples.
19 If you use a graphical viewer you must ensure that you have access to your desktop (if necessary: sux or ssh with x\-forwarding)
20 .TP
21 \fB\-k\fR
22 Display the manpage using your preferred viewer (must support .gz files) if you use KDE \- this is the short form of \-m 'kfmclient exec man:%s'. "kfmclient" is a part of the package "konqueror".
23 .TP
24 \fB\-g\fR
25 Display the manpage using your preferred viewer (must support .gz files) if you use GNOME \- this is the short form of \-m 'gnome\-open man:%s'. "gnome\-open" is a part of the package "libgnome2\-0".
26 .TP
27 \fB\-x\fR
28 Display the manpage using your preferred viewer (must support .gz files) if you use KDE/GNOME/Xfce \- this is the short form of \-m 'xdg\-open man:%s'. "xdg\-open" is a part of the package "xdg\-utils".
29 .PP
30 The manpages are temporarily extracted to /dev/shm (if the directory exists) or /tmp . You can override the path if you set and export the environment variable TMPDIR.
31 .PP
32 You need to have the debian package "whiptail" (preferred) or "dialog" as well as "curl" installed.
33 .SH "EXAMPLES"
34 .TP
35 debmany coreutils
36 Show all manpages from the installed debian package "coreutils" using man.
37 .TP
38 debmany 3dchess
39 Show all manpages from the package "3dchess" using man. Since it is not already installed the package is accessed from the repository \- even downloading is done if needed.
40 .TP
41 debmany test.deb
42 Show all manpages from the local debian package "./test.deb" using man.
43 .TP
44 debmany \-k sc
45 Use your preferred man\-viewer (for KDE user)
46 .TP
47 debmany \-g sc
48 Use your preferred man\-viewer (for GNOME user)
49 .TP
50 debmany \-x sc
51 Use your preferred man\-viewer (for KDE/GNOME/Xfce user)
52 .TP
53 debmany \-m 'konqueror man:%s' sc
54 Use Konqueror as viewer
55 .TP
56 export DEBMANY_MANPAGE_VIEWER="konqueror man:%s"; debmany sc
57 Use the viewer specified in the environment variable DEBMANY_MANPAGE_VIEWER (konqueror)
58 .SH "AUTHOR"
59 Written by Michael Arlt.
60 .SH "LICENSE"
61 This is free software. You may redistribute copies of it under the terms of
62 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
63 There is NO WARRANTY, to the extent permitted by law.
0 copy bash_completion to ~/.bash_completion
1 it uses functions from /etc/bash_completion
2 completion is done for
3 parameters (-m is not handled very good),
4 packages,
5 filenames ending with .deb and
6 folders
00 .\" which-pkg-broke.1 - find which package might have broken another
11 .\" Copyright (C) 2006 Javier Fernandez-Sanguino
22 .\" Everybody is allowed to distribute this manual page,
3 .\" to modify it, and to distribute modifed versions of it.
3 .\" to modify it, and to distribute modified versions of it.
44 .TH which-pkg-broke 1 "July 24 2006" "debian\-goodies" "debian\-goodies"
55 .SH NAME
66 which-pkg-broke \- find which package might have broken another
2121 to find which package update might be responsible for the breakage.
2222
2323 .SH EXAMPLES
24 This tool can be useful determine which package dependancies were upgraded
24 This tool can be useful determine which package dependencies were upgraded
2525 more recently and might be associated with the bug that is being observed.
2626 For example, if aptitude stops working properly, an administrator can run:
2727