dpkg-www-2.54+nmu1/ 0000755 0002322 0002322 00000000000 10751712464 014264 5 ustar pbuilder pbuilder dpkg-www-2.54+nmu1/src/ 0000755 0002322 0002322 00000000000 10751711346 015051 5 ustar pbuilder pbuilder dpkg-www-2.54+nmu1/src/dpkg-www.xpm 0000644 0002322 0002322 00000002320 07633661570 017353 0 ustar pbuilder pbuilder /* XPM */
static char *dpkg_www[] = {
"32 32 2 1",
" c None",
"# c #ff0000",
" ",
" # ",
" ######### ",
" ############## ",
" ###### ###### ",
" ##### #### ",
" #### #### ",
" #### #### ",
" ## ### ",
" ## ## ",
" ## ## # ## ",
" ### # ## ",
" ## # ## ",
" ## # ## ",
" ## # ## ",
" # # # ",
" ## # ## ",
" # # # ",
" ## ## ## ",
" # # ## ",
" ## ####### ",
" ## ",
" ### ",
" ## ",
" ## ",
" ## ",
" ### ",
" ## ",
" ## ",
" ### ",
" ## ",
" # "
};
dpkg-www-2.54+nmu1/src/dpkg-www.1 0000644 0002322 0002322 00000005457 10222750501 016702 0 ustar pbuilder pbuilder .TH DPKG-WWW 1 "September 1, 2004"
.SH NAME
dpkg-www \- program to remotely open a WWW Debian package browser
.SH SYNOPSIS
.B dpkg-www
.I [-s|--stdout] [-h|--host host] [query]
.SH DESCRIPTION
.B dpkg-www
is used to remotely control a WEB browser and open a dpkg
URL on the local host from an interactive shell or script.
If the command is invoked while running under X-window the script
will try to find an installed X browser to open the specified URL.
If not running under X it will try to use a text browser instead.
If Netscape is found and a Netscape instance is already running it
will be asked to open the dpkg URL on localhost with the optional
.I query
supplied on the command line.
If there is no browser running, it will start automatically a new one.
The functionality provided by this program is identical to running
a web browser with the
.B \-remote openURL(http://localhost/cgi-bin/dpkg)
argument or opening the same URL from within the browser.
.B dpkg-www-installer
is an helper application which can configured in the WWW browser for web
installation. It should never be invoked directly by the user.
.SH OPTIONS
.TP
\fB\-s\fR, \fB\-\-stdout\fR
Redirect output to stdout. Requires one of the text browsers (lynx,
lynx-ssl or links) installed.
.TP
\fB\-h\fR, \fB\-\-host\fR \fBhost\fR
Send the query to a remote host, where dpkg-www must be installed.
.TP
.BI query
Specifies an optional package name, an absolute pathname or a query
argument which is passed to the dpkg cgi-bin. See
.BR dpkg-www(8)
for more information about the use of the cgi.
.SH FILES
.IP /etc/dpkg-www.conf
.IP ~/.dpkg-www
Configuration files for dpkg-www. It is not necessary for these files to exist,
there are sensible defaults for everything, but you can specify your preferred
www browser with the DPKG_WWW_BROWSER variable, for example:
.B DPKG_WWW_BROWSER=mozilla
.SH EXAMPLES
.TP
.B dpkg-www
This would open a dpkg URL on localhost listing all the installed packages.
.TP
.B dpkg-www bash
This would open a dpkg URL asking info on the bash package.
.TP
.B dpkg-www -h pisolo bash
This would open a dpkg URL asking info on the bash package on host pisolo.
.TP
.B dpkg-www 'dpkg*'
This would open a dpkg URL listing all packages matching dpkg*.
.TP
.B dpkg-www /bin/bash
This would open a dpkg URL asking info on the package(s)
owning the file /bin/bash .
.TP
.B dpkg-www depends=svgalib
This would open a dpkg URL listing all packages depending on svgalib.
.TP
.B dpkg-www --stdout depends=awk | grep ^ii
This would list on stdout all packages depending on awk and grep all
lines of installed packages.
.SH "SEE ALSO"
.BR dpkg(8) ,
.BR dpkg-www(8)
.SH AUTHOR
Massimo Dal Zotto .
.br
Bugs should be reported via the normal Debian bug reporting system.
.SH LICENCE
dpkg-www is licensed under the GNU General Public License version 2.
dpkg-www-2.54+nmu1/src/dpkg-www-browser 0000755 0002322 0002322 00000005310 07362774470 020241 0 ustar pbuilder pbuilder #!/bin/sh
#
# Dpkg browser helper used by dpkg-www.
#
# Copyright (C) 1999-2001 Massimo Dal Zotto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
usage() {
echo "${0##*/} [-x|--xterm] [-f|--file] "
}
press_enter() {
echo ""
echo -n "Press Enter to close this window..."; read x
}
packageURI() {
local package="$1"
local pkgcache=$(tempfile)
local srcpkgcache=$(tempfile)
trap "rm -f $pkgcache $srcpkgcache" 0
apt-get -o "Debug::NoLocking=1" \
-o "Dir::Cache=/tmp" \
-o "Dir::Cache::pkgcache=$pkgcache" \
-o "Dir::Cache::srcpkgcache=$srcpkgcache" \
-o "Dir::Cache::archives=/var/cache/apt/archives" \
install --reinstall --print-uris -y "$package" \
| grep -F "/${package}_" \
| sed "/^'/!d; s/^'//; s/'.*//"
rm -f $pkgcache $srcpkgcache 2>/dev/null
}
# Source optional config file
test -e /etc/dpkg-www.conf && . /etc/dpkg-www.conf 2>/dev/null
FILE=""
ACTION=""
HOST=""
PACKAGES=""
# Restart self in an xterm window. Must be the first option. Used by netscape.
if [ "$DISPLAY" -a "$1" = "-x" -o "$1" = "--xterm" ]; then
shift 1
xterm -T "Package Browser" -e $0 "$@"
exit 0
fi
while [ "${1#-}" != "$1" ]; do
case "$1" in
-\?|-help|--help)
usage
exit
;;
-f|--file)
FILE="$2"
shift 2
;;
-*)
echo "Invalid option: $1" >&2
press_enter
exit 1
;;
esac
done
FILE="${FILE:-$1}"
if [ "$FILE" != "" -a ! -e "$FILE" ]; then
echo "File not found: $FILE" >&2
press_enter
exit 1
fi
request="$(cat "$FILE" | head -10)"
if echo "$request" | grep -q "^Browse-package:"; then
PACKAGE=$(
echo "$request" | grep ^Browse-package: \
| head -1 | sed 's/.*: *//'
)
else
echo "Invalid request" >&2
press_enter
exit 1
fi
uri="$(packageURI "$PACKAGE")"
file="${uri#file:}"
if [ ! "$file" -o "$file" = "$uri" -o ! -e "$file" ]; then
echo "Package not found: $file" >&2
press_enter
exit 1
fi
if [ "$DISPLAY" ]; then
sensible-editor "$file" &
sleep 1
else
exec sensible-editor "$file"
fi
# end of file
dpkg-www-2.54+nmu1/src/apache.conf 0000644 0002322 0002322 00000000364 10321454556 017144 0 ustar pbuilder pbuilder # Apache config for dpkg-www
# Disable execution of dpkg from remote hosts
order deny,allow
deny from all
allow from localhost 127.0.0.1
# allow from .your_domain.com
# End dpkg-www config
dpkg-www-2.54+nmu1/src/dpkg-www.8 0000644 0002322 0002322 00000027320 10321455037 016710 0 ustar pbuilder pbuilder .TH DPKG-WWW 8 "Oct 7, 2005"
.SH NAME
dpkg-www, dpkg-www-installer \- WWW Debian package browser
.SH SYNOPSIS
http:///cgi-bin/dpkg
.SH DESCRIPTION
A typical Debian system can have hundreds installed packages and thousands
available for installation. Information about installed and available
packages can usually be obtained with the
.B dpkg(1)
command, but navigating through the package dependencies and the
documentation files can be a very frustrating and time-consuming task.
.PP
With the
.B dpkg-www
cgi you can instead browse Debian packages info with a WEB browser,
following package dependencies and locating documentation (man pages,
Info files, READMEs, and so on) with a few mouse clicks. If you have
superuser privileges you can even install, upgrade or remove packages
from your WEB browser.
The output provided by
.B dpkg-www
is basically that of
.B dpkg
with the addition of HREF's for packages dependencies and documentation
files.
.PP
The cgi program can take an optional query argument which can be given in
the URL or entered in the query field of the html form. This can be:
.IP
list concisely all installed packages
.IP *\ (asterisk)
list concisely all installed and available packages
.IP
list concisely the requested packages
.IP
list concisely all packages whose name matches the expression, for
example `*image*' will find all packages which contain the string `image'.
.IP
list verbosely a package and, if the package is installed, all its files.
If the package is not installed and the WEB installation is enabled you
can install it by clicking on the `Install' button. If the package is
installed you can remove it or upgrade to a new version, if available,
by clicking on the respective buttons.
.IP
list all the packages owners of a file. This can be used for example to find
which package installed a program.
.IP /
list all the packages owners of a file. The regexp form can be used to find
which packages own a non installed file.
.IP =
list all the packages with control field matching value. If the field name is
omitted the value is searched in any control field. The default search is a
case-insensitive fixed substring match but it can be changed with the
.B GREP_DCTRL_OPTS
option in the config file.
This feature works only if the
.B grep-dctrl
package is installed.
.IP ?\ (question\ mark)
show a concise help about the cgi usage.
.IP \ (a\ single\ space)
print only the input form, for use from window-manager menus.
.SS Configuration
dpkg-www can be configured by the local system administrator via the optional
.I /etc/dpkg-www.conf
file.
This file is a simple Bourne shell
.IR "" ( /bin/sh )
script that defines some or all the following variables
(defaults are used if the file doesn't exist, or doesn't define the variable):
.IP CHECK_BUTTONS
If this option is enabled
.B dpkw-www
will add a small `install' check-button for each package shown in the package
list. Default is 0 (disabled) because the resulting interface is not very nice.
The use of this option is therefore not recommended.
.IP INSTALL_BUTTON
If this option is set the `Install' or `Upgrade' and `Remove' buttons will
be added to the verbose info of a package. By clicking on these button you
will start the installation of removal the package as described in the section
.B WEB Installation.
Since this option can potentially introduce security holes it is disabled (0)
by default. Use at your own risk.
If the variable is set to "top" the button will be located before the file
list, default is the bottom of the page.
.IP SHOW_LOCAL_FILES
If this variable is set, dpkg-www will use file:/ style URL's to
access html files -- bypassing the cgi script. This is faster
on slow machines. Default is not defined, which means use local files
for connection from localhost and http:// URL's for remote connections.
.IP CHECK_PACKAGE_VERSION
If this variable is set, dpkg-www will check if a newer version of an installed
package is available. On slow machines you may want to set this option to
false since it can considerably slow down the execution.
.IP LIST_UNAVAILABLE
This option enables listing also unavailable packages in the packages list.
Disabled by default.
.IP LIST_DOCUMENTATION
This option enables the display of references to documents registered with
.B install-docs(8)
to the detailed package info, providing a quick path to relevant package
documentation. Unfortunately this feature is not totally reliable because
currently there is no way to find documents registered by a package with
.B install-docs
and the search is done with an ugly hack. Hopefully things will change in
woody. This option is enabled (1) by default.
.IP FORCE_SSH_PASSWD
This option forces ssh passwd prompt for package installation on a remote host
even if an ssh agent holds the private key.
.IP GREP_DCTRL_OPTS
These options are passed to
.B grep-dctrl(1)
when doing a query by field. Default is "-i" for case-insensitive fixed
substring match. See
.B grep-dctrl(1)
for more info.
.IP DPKG
Command providing the
.B dpkg(1)
query functionalities. This can be
.B dpkg
or
.B dlocate ,
or
.B auto .
Default is auto, meaning that the cgi will use
.B dlocate
if installed, otherwise revert to
.B dpkg
which should always be available on a Debian system. By specifying this
option you can force the use of one of the two program.
.IP MAN
Manpage to HTML translation command. Can be
.B dwww ,
.B man2html
or
.B auto .
Default is auto, meaning that the cgi will use
.B man2thml
if installed, otherwise revert to
.B dwww .
By specifying this option you can force the use of one of the two program.
.IP DEBIAN_CONTENTS
Optional list of one or more
.I Contents-xxx.gz
files mapping each file available in the Debian GNU/Linux system to
the package from which it originates. If available these files are used
to find the owner packages of non installed files. This can be useful for
quickly finding the package to install when a needed command is missing.
.IP BGCOLOR
background color of the HTML body.
.IP DEBUG
internal option used only for debugging. Disabled by default since it is
useless for normal users.
.IP DWWW_PATH
path on webserver to dwww cgi-bin.
.IP INFO2WWW_PATH
path on webserver to info2www cgi-bin.
.PP
The following is an exaple /etc/dpkg-www.conf file:
.PP
.in +2
# Enable install check-buttons in package list.
.br
CHECK_BUTTONS=0
.br
.br
# Enable install, upgrade and remove buttons in package info.
.br
INSTALL_BUTTON=1
.br
.br
# List registered package documentation.
.br
LIST_DOCUMENTATION=1
.br
.br
# Options passed to grep-dctrl in queryPackagesByField()
.br
GREP_DCTRL_OPTS="-i"
.br
.br
# Show local files directly. Automatically set.
.br
SHOW_LOCAL_FILES=auto
.br
.br
# Force ssh passwd prompt even if an ssh agent holds
.br
# the private key.
.br
FORCE_SSH_PASSWD=true
.br
.br
# List of Contents-xxx.gz files, if available.
.br
DEBIAN_CONTENTS="
.br
\ \ \ \ \ \ \ \ /debian/dists/stable/Contents-i386.gz
.br
\ \ \ \ \ \ \ \ /debian/dists/potato/non-US/Contents-i386.gz"
.br
.br
# Dpkg command (dpkg|dlocate|auto). Automatically detected.
.br
# DPKG=auto
.br
.br
# Manpage conversion command (dwww|man2html|auto). Automatically detected.
.br
# MAN=auto
.br
.br
# HTML background color.
.br
# BGCOLOR="#c0c0c0"
.br
.br
# Enable cgi debugging. Not really useful.
.br
# DEBUG=1
.PP
.SS Cgi access
The information provided by
.B dpkg-www
and the ability to install or remove packages also remotely can potentially
give useful information to crackers and open security holes. For these reasons
access to this cgi program should be allowed only from localhost and trusted
hosts or domains. Unfortunately this configuration is dependent on the
particular installed WEB server. The dpkg-www package configures the apache
server, if installed, to allow access only from localhost. Other WEB servers
must be configured manually by the system administrator to restrict access
to trusted hosts. If you administer many Debian system on a local network
you may want to enable access to the cgi from your network and browse
packages on any host from any other machine.
.SS WEB installation
If this option is enabled in the
.I /etc/dpkg-www.conf
file, the `Install', `Upgrade' and `Remove' buttons are added to the info
page of installed or uninstalled packages.
By clicking on this button the system administrator, or more precisely any
user who has the ability to become system administrator (since you don't
want to run a web browser as root!), will be able to install or remove a
package on the fly, provided he has properly configured his browser for WEB
installation.
.PP
For security reasons the installation is done entirely from the browser side,
so that you don't need to gain root privileges from the cgi program which is
run on the server. The only thing done on the server is to generate an
installation request which is downloaded to the browser for the execution,
which is started under control of the user and with his privileges.
The real installation is done by a small helper script run from the user's
browser when a document with content-type `application/dpkg-www-installer'
is received from the web server. The helper script opens an XTerm on the
user's display and runs a script which becomes superuser, after asking the
root password, and execs an apt-get command to install the requested
packages.
.PP
The WEB browser must have been configured to handle the above content-type
by running the command "/usr/sbin/dpkg-www-installer -x -f '%s'", which must
obviously intalled also on the client side if installing from remote.
If the dpkg-www package is not installed on the browser client you can simply
copy the script /usr/sbin/dpkg-www-installer and hope it works...
.PP
You can configure your
.B Netscape.
browser from the Navigator -> Application menu of the Preferences
window. You must add a new item with MIME type "application/dpkg-www-installer"
and application "/usr/sbin/dpkg-www-installer -x -f '%s'".
This should add the following line to your Netscape mailcap file:
.PP
.in +2
application/dpkg-www-installer;/usr/sbin/dpkg-www-installer -x -f '%s'
.PP
The dpkg-www WEB installation has been succesfully tested only with
.B Netscape.
With other WEB browsers it is untested and it may not work correctly.
.PP
In order to be able to install the packages the user must known the root
password asked for `su root' when installing on the local server, or have
the ability to ssh as root to the remote host when installing from a remote
client.
.PP
From the security point of view, executing a WEB installation is functionally
equivalent to opening a shell in an XTerm, becoming superuser after having
supplied the proper password and running apt-get as root to install or remove
the required packages. Starting this from the WEB could be potentially
vulnerable to man-in-the-middle attacks, but since it requires a password
on the client it seems quite safe. If you are really paranoid connect to a
secure server from an SSL-enabled browser.
.PP
The dpkg-www WEB installation is not intended to replace the normal use
of apt-get from the shell. It is provided only as a shortcut to allow the
installation of a package after having located it with the browser without
needing to open a root shell and run apt-get manually. For normal package
maintenance and system upgrade the use of apt-get from the shell is
recommended.
.SH FILES
.IP /etc/dpkg-www.conf
Configuration file for dpkg-www. It is not necessary for this file to exist,
there are sensible defaults for everything.
.SH "SEE ALSO"
.BR dpkg(8) ,
.BR dwww(1) ,
.BR dwww(8) ,
.BR dlocate(1) ,
.BR man2html(8) ,
.BR grep-dctrl(1)
.SH AUTHOR
Massimo Dal Zotto .
.br
Bugs should be reported via the normal Debian bug reporting system.
.SH LICENCE
dpkg-www is licensed under the GNU General Public License version 2.
dpkg-www-2.54+nmu1/src/dpkg 0000755 0002322 0002322 00000117013 10751711346 015727 0 ustar pbuilder pbuilder #!/bin/bash
#
# Cgi interface to dpkg. Show information about debian packages.
#
# Copyright (C) 1999-2006 Massimo Dal Zotto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
PROG_VERSION=2.54
SELF=${0##*/}; export SELF
HELP_PAGE="/usr/share/man/man8/dpkg-www.8.gz"
COLUMNS=256; export COLUMNS
SECTION_DESCRIPTIONS="
admin Utilities to administer the system
base Basic needed utilities of every Debian system
comm Software to use your modem in the old fashioned style
devel Development utilities, compilers, environments, libraries, etc.
doc FAQs, HOWTOs, documents and software to browse documentation
editors Software to edit files and programming environments
electronics Electronics utilities
games Programs to spend a nice time with after setting up Debian
graphics Editors, viewers, converters... Everything to become an artist
hamradio Software for ham radio
interpreters Interpreters for interpreted languages and macro processors
libs Libraries to make other programs work
mail Programs to route, read, and compose E-mail messages
math Math software
misc Miscellaneous utilities that didn't fit well anywhere else
net Daemons and clients to connect your system to the world
news Software to access Usenet, to set up news servers, etc.
non-us Software restricted in the US by export regulations or patents
oldlibs Old versions of libraries, kept for backward compatibility
otherosfs Software to use programs and filesystems for other O.S.
science Basic tools for scientific work
shells Command shells and friendly user interfaces for beginners.
sound Utilities to deal with sound: mixers, players, recorders, etc.
tex The famous typesetting software and related programs
text Utilities to format and print text documents
utils Utilities for file/disk manipulation, backup, monitoring, etc.
web Web servers, browsers, proxies, download tools etc.
x11 X servers, libraries, fonts, window managers, and applications
"
TASK_DESCRIPTIONS="
basic-desktop X window system
c-dev C and C++
chinese-s simplified Chinese environment
chinese-t traditional Chinese environment
cyrillic Cyrillic environment
database-server SQL database
desktop desktop environment
dialup dialup system
dns-server DNS server
file-server file server
fortran-dev fortran
french French environment
games games
german German environment
japanese Japanese environment
junior Debian Jr.
korean Korean environment
laptop laptop system
mail-server mail server
news-server usenet news server
polish Polish environment
print-server print server
python-dev Python
russian Russian environment
science scientific applications
spanish Spanish environment
tcltk-dev Tcl/Tk
tex TeX/LaTeX environment
unix-server conventional unix server
web-server web server
"
# Configuration defaults, can be overriden in /etc/dpkg-www.conf
#
SHOW_LOCAL_FILES=auto # Show local files directly (automatic)
LIST_UNAVAILABLE=0 # List also unavailable packages
LIST_DOCUMENTATION=1 # List registered package documentation
DPKG=auto # Select the dpkg program (automatic)
MAN=auto # Select the man program (automatic)
DEBIAN_CONTENTS= # List of Contents-xxx.gz files
INSTALLED_ONLY=0 # Only installed packages
DPKG_STATUS=/var/lib/dpkg/status
DPKG_AVAILABLE=/var/lib/dpkg/available
TASK_DESCRIPTIONS_FILE=/usr/share/tasksel/debian-tasks.desc
APT_CACHE_OPTS="-o APT::Cache::AllVersions=0"
CHECK_PACKAGE_VERSION=true
DPKG_WWW_BROWSER_HACK=false
GREP_DCTRL_OPTS="-i"
BGCOLOR="#c0c0c0"
KEEP_INPUT=0
DEBUG=0
DWWW_PATH="/cgi-bin/dwww"
INFO2WWW_PATH="/cgi-bin/info2www"
# Install buttons support. This require that users define the following
# mime action in their netscape mailcap file:
#
# application/dpkg-www-installer;/usr/sbin/dpkg-www-installer -f '%s'
#
CHECK_BUTTONS=0 # Enable install check-buttons in package list
INSTALL_BUTTON=0 # Enable install button in package info
# Source optional local configuration file
test -e /etc/dpkg-www.conf && . /etc/dpkg-www.conf 2>/dev/null
set -o noglob
HOSTNAME_FULL="$(hostname -f)"
HOSTNAME="${HOSTNAME_FULL%%.*}"
# Use dlocate, if installed, to speedup certain queries
if [ ! "$DPKG" -o "$DPKG" = auto ]; then
if [ -x /usr/bin/dlocate ]; then
DPKG=dlocate
else
DPKG=dpkg
fi
fi
# Select the Manpage to HTML translator
if [ "$MAN" = dwww ]; then
MAN="${DWWW_PATH}?type=man\\\\&location="
fi
if [ "$MAN" = man2html ]; then
if [ -x /usr/lib/cgi-bin/man/man2html ]; then
MAN="/cgi-bin/man/man2html?"
elif [ -x /usr/lib/cgi-bin/man2html ]; then
MAN="/cgi-bin/man2html?"
else
MAN="${DWWW_PATH}?type=man\\\\&location="
fi
fi
if [ ! "$MAN" -o "$MAN" = auto ]; then
if [ -x /usr/lib/cgi-bin/man/man2html ]; then
MAN="/cgi-bin/man/man2html?"
elif [ -x /usr/lib/cgi-bin/man2html ]; then
MAN="/cgi-bin/man2html?"
else
MAN="${DWWW_PATH}?type=man\\\\&location="
fi
fi
# If remote host is localhost generate local URL's for local files
case "$REMOTE_HOST" in
localhost|$HOSTNAME|$HOSTNAME_FULL)
if [ ! "$SHOW_LOCAL_FILES" -o "$SHOW_LOCAL_FILES" = auto ]; then
SHOW_LOCAL_FILES=true
fi
if [ "$HTTP_USER_AGENT" != "${HTTP_USER_AGENT#*Mozilla/[56]}" ]; then
# It seems that Mozilla/5.0 refuses to access local files from
# a web page for security reasons.
SHOW_LOCAL_FILES=false
fi
;;
*)
SHOW_LOCAL_FILES=false
;;
esac
# Print a short help for the cgi-program
usage() {
cat <<- EOF
You can query information about Debian packages and installed files.
The search argument can be:
?
show this help page
*
list all packages available on your system
<empty>
list all packages installed on your system
<space>
print only the input form, for use from wm menus
package
list the required package and its owned files
list of packages
list required packages concisely
wilcard expression
list matching packages concisely
absolute pathname
list packages owning pathname
field=value
list packages with control field matching value
=value
list packages with any field matching value
section=?
list available package sections
task=?
list available tasks
recent=[<N>]
list packages installed in last N days (default 1)
Examples:
(1) The regexp form can be used to query also packages owning files
not installed on your system. However this works only if you have
properly configured the variable DEBIAN_CONTENTS in the
configuration file /etc/dpkg-www.conf.
This query can be used to find which package you should install
in order to get some missing command or file.
Note that the leading '/' is required to distinguish filename
queries from package queries.
(2) This works only if the
grep-dctrl package is installed.
(3) This works only if INSTALL_BUTTON=1 has been set in the
configuration file /etc/dpkg-www.conf, your browser has
been configured to handle WEB installation requests and, of course,
you know the root password.
See dpkg-www(8)
man page for more information.
EOF
}
debug() {
test_flag "$DEBUG" && echo "$(escape_html "$*") "
}
test_flag() {
case "$1" in
0|false|n|no|"") return 1 ;;
*) return 0 ;;
esac
}
# Sanity check on input values
checkInput() {
if echo "$*" | grep -q '[(){}<>$%#&!|\\;`]'; then
printError "Error: invalid input"
exit
fi
}
# Execute the query
doQuery() {
debug "doQuery $1"
local query="$1"
case "${query%/}" in
\?|-\?|-h|-help|--help)
usage
;;
" ")
return
;;
-*)
printError "Invalid keyword: $query"
exit
;;
/*)
queryOwners "$query"
;;
*=*)
queryPackagesByField "$query"
;;
*)
checkInput "$query"
queryPackages "$query"
;;
esac
}
# Query one or more packages
queryPackages() {
debug "queryPackages $*"
local packages="$*"
local package="${packages%% *}"
if [ ! "$packages" ]; then
# No argument, show the package list
debug "no arguments"
listPackages
elif [ "$package" != "$packages" -o "$packages" != "${packages#*[\[*?]}" ]
then
# Package list or wildcard, list packages concisely
debug "package list"
listPackages $packages
else
# One package, show package information
debug "one package"
listPackage $package
fi
}
# Query one or more packages by control field value
queryPackagesByField() {
field="${*%%=*}"; arg="${*#$field}"; arg="${arg#=}"
field="${field## }"; field="${field%% }"
arg="${arg## }"; arg="${arg%% }"
if [ "$field" = section -a "$arg" = "?" ]; then
listSections
return
fi
if [ "$field" = task -a "$arg" = "?" ]; then
listTasks
return
fi
if [ "$field" = recent -o "$field" = new ]; then
listRecentPackages $arg
return
fi
if [ "$field" != "" -a ! -x /usr/bin/grep-dctrl ]; then
echo "
"
echo -n "Error: the "
echo -n "grep-dctrl"
echo " command is not installed on your system"
echo "
"
return
fi
echo "
"
echo "Packages with $(escape_html "${field:-any field matching} $arg")"
echo ""
{
if [ -x /usr/bin/grep-dctrl ]; then
grep-dctrl $GREP_DCTRL_OPTS -s Package -F "$field" "$arg" \
$DPKG_STATUS $DPKG_AVAILABLE
else
apt-cache search "$arg" | sed 's/ .*//;s/^/Package: /'
fi
dpkg -l "*" 2>&1
} \
| awk '
/^Package:/ { p[$2]=1; NR=0; next }
(NR <= 5) { print }
(p[$2] != 1) { next }
{ print }' \
| listFilter
echo "
"
echo "Available sections:"
echo ""
for s in $sections; do
desc=$(
echo "$SECTION_DESCRIPTIONS" | sed "/^$s/!d; s/^$s[ ]*//;q"
)
desc=${desc:="no description available"}
x=$(printf "%$[16-${#s}]s" " ")
echo " ${s}${x} ${desc}"
done
echo "
"
}
# List available tasks
listTasks() {
tasks=$(
grep -h "^Task:" $DPKG_STATUS $DPKG_AVAILABLE \
| sed 's|.*:[ ]*||; s|,[ ]*|\
|g' | sort | uniq
)
echo "
"
echo "Available tasks:"
echo ""
for t in $tasks; do
desc=$(
if [ -e "$TASK_DESCRIPTIONS_FILE" ]; then
cat "$TASK_DESCRIPTIONS_FILE" 2>/dev/null | awk -v t="$t" '
/^Task:/ { task = $2 }
/^Description:/ && (task == t) {
sub($1"[ ]*",""); print; exit
}'
else
echo "$TASK_DESCRIPTIONS" | sed "/^$t/!d; s/^$t[ ]*//;q"
fi
)
desc=${desc:="no description available"}
x=$(printf "%$[16-${#t}]s" " ")
echo " ${t}${x} ${desc}"
done
echo "
"
}
# List recent packages
listRecentPackages() {
n=${1:-1}
packages=$(
find /var/lib/dpkg/info/ -daystart \( -name \*.list -a -mtime -$n \) \
| sed 's|.list$||;s|.*/||' \
| sort
)
if [ "$packages" ]; then
echo "
"
echo "Recent packages in last $n days:"
echo ""
dpkg -l $packages 2>&1 | listFilter
echo "
"
else
echo "
"
echo "No recent packages in last $n days"
echo "
"
fi
}
# List one or more packages concisely
listPackages() {
debug "listPackages $*"
echo "
"
dpkg -l "$@" 2>&1 | listFilter
echo "
"
}
# List a single package
#
listPackage() {
debug "listPackage $*"
local package="$1"
local installed
local status
local version
local latest
local priority
local essential
pkg_info="$(dpkg -s $package)"
if [ ! "$pkg_info" ]; then
# Unknown package or virtual package
listVirtualPackage $package || listUnknownPackage $package
return 1
fi
status="$(echo "$pkg_info" | awk '/^Status:/ {print $4}')"
# installed The package is unpacked and configured OK.
# half-installed The installation has started but not completed.
# not-installed The package is not installed on your system.
# unpacked The package is unpacked, but not configured.
# half-configured The package configuration has not completed.
# config-files Only the config files exist on the system.
# Handle unknown package
if [ ! "$status" ]; then
listUnknownPackage $package
return 1
fi
if [ "$status" = not-installed -o "$status" = config-files ]; then
if [ -x /usr/bin/apt-cache ]; then
pkg_info="$(
echo "$pkg_info" \
| grep "^\(Package\|Status\|Priority\|Section\):"
apt-cache $APT_CACHE_OPTS show $package 2>/dev/null \
| sed 's/^installed-size:/Installed-Size:/' \
| grep -v -e "^\(Package\|Status\|Priority\|Section\):" \
-e "^\(Filename\|MD5sum\|Size\):"
)"
else
pkg_info="$(
echo "$pkg_info" \
| grep "^\(Package\|Status\|Priority\|Section\):"
dpkg --print-avail $package 2>/dev/null \
| grep -v -e "^\(Package\|Status\|Priority\|Section\):" \
-e "^\(Filename\|MD5sum\|Size\):"
)"
fi
fi
# Check for newer version of installed package
if [ "$status" = installed ]; then
version="$(echo "$pkg_info" | awk '/^Version:/ {print $2}')"
priority="$(echo "$pkg_info" | grep ^Priority: | awk '{print $2}')"
essential="$(echo "$pkg_info" | grep ^Essential: | awk '{print $2}')"
if test_flag "$CHECK_PACKAGE_VERSION"; then
latest=$(
apt-cache $APT_CACHE_OPTS show $package \
| grep ^Version: | awk '{print $2}'
); latest=${latest:-$version}
if dpkg --compare-versions "$latest" gt "$version"; then
pkg_info="$(
echo "$pkg_info" \
| sed "/^Version:/s/\$/ (latest is $latest)/"
)"
fi
else
latest="$version"
fi
fi
echo "
"
# Print package info
echo "$pkg_info" | packageFilter $package
if [ "$INSTALL_BUTTON" = "top" ]; then
addButtons
fi
# Print documentation and file list
if [ "$status" != not-installed ]; then
listPackageDocumentation $package
listPackageFiles $package
fi
if [ "$INSTALL_BUTTON" != "top" ]; then
addButtons
fi
echo "
"
}
# Add "Install", "Update" and "Remove" buttons if enabled.
addButtons() {
if [ "$status" = installed ]; then
if [ "$priority" = required -o "$essential" = yes ]; then
if [ "$version" != "$latest" ]; then
addUpgradeButton $package $latest
fi
else
if [ "$version" != "$latest" ]; then
addRemoveUpgradeButtons $package $latest
else
addRemoveButton $package
fi
fi
else
addInstallButton $package
fi
}
# Print a "Package not installed" message and add the "Install" button
# if enabled in the configuration file.
#
addInstallButton() {
debug "addInstallButton $*"
local package="$1"
local pkgname="$package"
if test_flag "$INSTALL_BUTTON"; then
echo ""
else
echo ""
echo "Package $(escape_html "$package") is not installed."
fi
}
# Add the "Remove" button if enabled in the configuration file.
#
addRemoveButton() {
debug "addRemoveButton $*"
local package="$1"
local pkgname="$package"
if test_flag "$INSTALL_BUTTON"; then
echo ""
fi
}
# Add the "Upgrade" button if enabled in the configuration file.
#
addUpgradeButton() {
debug "addUpgradeButton $*"
local package="$1"
local latest="$2"
local pkgname="$package"
if test_flag "$INSTALL_BUTTON"; then
echo ""
fi
}
# Add the "Remove" and "Upgrade" buttons if enabled in the configuration file.
#
addRemoveUpgradeButtons() {
debug "addRemoveUpgradeButtons $*"
local package="$1"
local latest="$2"
local pkgname="$package"
if test_flag "$INSTALL_BUTTON"; then
echo ""
fi
}
# List all packages providing a virtual package.
#
listVirtualPackage() {
debug "listVirtualPackage $*"
local package="$1"
local packages=$(
cat $DPKG_STATUS $DPKG_AVAILABLE \
| awk -v package=$package '
/^Package:/ { owner = $2 }
/^Provides:/ {
gsub(",","")
for (i=2; i<=NF; i++) { if ($i == package) { print owner } }
}' \
| sort | uniq
)
test "$packages" || return 1
debug "is virtual package"
echo "
"
echo "No package is owning $(escape_html "$file")"
echo "
"
}
# Convert package info to html by adding hrefs to other packages.
#
packageFilter() {
local package="$1"
local uri=""
if [ "$DPKG_WWW_BROWSER_HACK" = true -a "$SHOW_LOCAL_FILES" ]; then
uri="$(packageURI "$package")"
test "$uri" = "${uri#file:/}" && uri=""
fi
awk -v SELF=$SELF -v package="$package" -v uri="$uri" '
{ gsub("<","\\<"); gsub(">","\\>") }
/^Package:/ {
# Add link to the Debian package page for this package
p = s = package; gsub("\\+", "%2B", s)
u = "http://packages.debian.org"
$2 = sprintf("%s", u,s,p)
}
/^Section:/ {
# Add link to package section list
s = t = r = $2
gsub("\\+", "\\+", r)
gsub("\\+", "%2B", s)
sub(r, "" t "", $2)
}
/^Task:/ {
# Add links to package tasks list
for (f=2; f<=NF; f++) {
r = $f;
gsub(",", "", r)
s = t = r
gsub("\\+", "\\+", r)
gsub("\\+", "%2B", s)
sub(r, "" t "", $f)
}
}
/^Maintainer:/ {
# Add link to maintainer packages overview
m = $0; sub(".*: ","",m);sub(" <.*","",m);gsub("[()]","\\\\&",m)
e = $0; sub(".*<","",e);sub(">.*","",e)
u = "http://qa.debian.org/developer.php/developer.php?login=" e
sub(m, "&")
# Add link to Debian BTS page for this package
s = package; gsub("\\+", "%2B", s)
d = "[Debian Bug Report]"
u = "http://bugs.debian.org/cgi-bin/pkgreport.cgi"
h = sprintf("%s", u,s,d)
$0 = $0 " " h
}
/^(Depends|Pre-Depends|Conflicts|Replaces|Provides|Suggests|\
|Recommends|Enhances):/\
{
# Workaround for apt-cache missing space:
# Depends: python-slang(>= 0.2.0), python (>= 2.1)
gsub("\\(", " (")
for (f=2; f<=NF; f++) {
if ($f == "|") {
continue
}
if (match($f,"^\\(")) {
f++;
continue
}
r = $f;
gsub(",", "", r)
s = t = r
gsub("\\+", "\\+", r)
gsub("\\+", "%2B", s)
sub(r, "" t "", $f)
}
}
/^Description:/ {
if (uri != "") {
s = package
t = uri
gsub("\\+", "%2B", s)
gsub("^file:", "", t)
h = SELF "?browse=Browse&packages=" s
printf("Filename: %s\n", h, t)
}
}
/^Version:/ {
if (match($0, "latest is")) {
# Show latest version in bold
sub("\\(latest is", "(latest is"); sub("\\)", ")")
}
}
/^$/ { next}
/^ .$/ { $0 = " " }
{ print }'
}
# Convert a dpkg package list to html adding hrefs to package names.
# This is used for both file list and documentation list.
#
listFilter() {
awk -v SELF=$SELF \
-v CHECK_BUTTONS=$CHECK_BUTTONS \
-v DPKG_AVAILABLE=$DPKG_AVAILABLE \
-v LIST_UNAVAILABLE=$LIST_UNAVAILABLE \
-v INSTALLED_ONLY=$INSTALLED_ONLY '
BEGIN {
is_hdr = 1
statMax = 3
nameMax = 10
versMax = 10
descMax = 10
if (CHECK_BUTTONS) {
pkg_button = \
""
install_button = \
""
reset_button = \
""
buttonW = 2
}
}
/^No packages found matching/ {
print $0
missing++
NR--
next
}
(is_hdr) {
header[NR] = $0
}
(is_hdr == 1) && ($1 == "||/") {
# ||/ Name Version Description
hstat = $1
hname = $2
hvers = $3
hdesc = $4
is_hdr = 2
next
}
(is_hdr == 2) {
# +++-==============-==============-===============================
split($0,A,"-")
statLen = length(A[1])
nameLen = length(A[2])
versLen = length(A[3])
hsep = A[4] A[4] A[4]
is_hdr = 0
next
}
(!is_hdr) {
# ii dpkg-www 2.52 package description ...
stat = substr($0,1,statLen)
name = substr($0,5,nameLen)
vers = substr($0,6+nameLen,versLen)
desc = substr($0,7+nameLen+versLen)
sub("[ ]+$","",name)
sub("[ ]+$","",vers)
sub("[ ]+$","",desc)
if (INSTALLED_ONLY && !match(stat,"^(i.|.c)")) {
next
}
# if (vers == "") { vers = "-" }
nameMax = max(nameMax, length(name))
versMax = max(versMax, length(vers))
descMax = max(descMax, length(desc))
packages[NR,"stat"] = stat
packages[NR,"name"] = name
packages[NR,"vers"] = vers
packages[NR,"desc"] = desc
if (desc == "(no description available)") {
needs_desc = missing_desc[name] = NR
}
}
END {
if (needs_desc) {
update_descs()
}
if (NR < 6) {
if (!missing) {
print "no packages found"
}
exit
}
if (missing) {
print ""
}
if (CHECK_BUTTONS) {
printf ""
}
}
function escape(s) {
gsub("&","\\&",s)
gsub("<","\\<",s)
gsub(">","\\>",s)
return s
}
function pad(s,l) {
while (length(s) < l) {
s = s " "
}
return substr(s,1,l)
}
function max(x,y) {
return ((x > y) ? x : y)
}
function update_descs() {
while (getline < DPKG_AVAILABLE) {
if ($1 == "Package:") {
if ((nr=missing_desc[$2])) {
package = $2
} else {
package = ""
}
}
if (package && ($1 == "Version:")) {
sub("Version: ",""); vers = $0
packages[nr,"vers"] = vers
versMax = max(versMax, length(vers))
}
if (package && ($1 == "Description:")) {
sub("Description: ",""); desc = $0
packages[nr,"desc"] = desc
descMax = max(descMax, length(desc))
}
}
}'
}
# Convert a file list to html adding hrefs to files in /usr/{doc,info,man}.
#
fileFilter() {
awk -v title="$*" -v show_local_files="$SHOW_LOCAL_FILES" \
-v man="$MAN" -v info2www="$INFO2WWW_PATH" -v dwww="$DWWW_PATH" '
/\/usr\/(share\/)?([a-zA-Z0-9_+-]+\/)?man\/.*\..*/ {
if (title) { t = title } else { t = $1 }
if ($2) { t = t " [" $2 "]"; NF=1 }
r = s = $1
gsub("\\+", "\\+", r);
gsub("\\+", "%2B", s);
gsub("\\$","\\$",r)
sub(r, "" t "")
print
next
}
/\/usr\/(share\/)?info\/.*\.gz/ {
if (title) { t = title } else { t = $1 }
if ($2) { t = t " [" $2 "]"; NF=1 }
r = s = $1
gsub("\\+", "\\+", r);
gsub("\\+", "%2B", s);
gsub("\\$","\\$",r)
sub(r, "" t "")
print
next
}
/\/usr\/(doc|share\/(doc|gtk-doc|gnome\/(html|help)|RFC))\// {
if (title) { t = title } else { t = $1 }
if ($2) { t = t " [" $2 "]"; NF=1 }
r = s = $1
gsub("\\+", "\\+", r);
gsub("\\+", "%2B", s);
gsub("\\$","\\$",r)
if (show_local_files == "true") {
sub(r, "" t "")
} else {
sub(r, ""\
t "")
}
print
next
}
/^\/.$/ { next }
/^$/ { next }
/^[^\/]/ { sub("^"," ") }
{ print }'
}
packageURI() {
local package="$1"
local pkgcache=$(tempfile)
local srcpkgcache=$(tempfile)
trap "rm -f $pkgcache $srcpkgcache" 0
apt-get -o "Debug::NoLocking=1" \
-o "Dir::Cache=/tmp" \
-o "Dir::Cache::pkgcache=$pkgcache" \
-o "Dir::Cache::srcpkgcache=$srcpkgcache" \
-o "Dir::Cache::archives=/var/cache/apt/archives" \
install --reinstall --print-uris -y "$package" \
| grep -F "/${package}_" \
| sed "/^'/!d; s/^'//; s/'.*//"
rm -f $pkgcache $srcpkgcache 2>/dev/null
}
printInstallRequest() {
local packages="$1"
local host="$HOSTNAME_FULL"
cat <<-EOF
dpkg-www WEB Installation
If you are reading this document on your browser or you have
been asked to save it to disk instead of running the installation
of the required packages this means that your browser has not
been set up correctly for dpkg-www WEB installation.
See dpkg-www(8)
man page for more information.
EOF
}
printRemoveRequest() {
local packages="$1"
local host="$HOSTNAME_FULL"
cat <<-EOF
dpkg-www WEB Deinstallation
If you are reading this document on your browser or you have
been asked to save it to disk instead of running the installation
of the required packages this means that your browser has not
been set up correctly for dpkg-www WEB installation.
See dpkg-www(8)
man page for more information.
EOF
}
printBrowseRequest() {
local package="$1"
local host="$HOSTNAME_FULL"
cat <<-EOF
dpkg-www Browse Request
If you are reading this document on your browser or you have
been asked to save it to disk instead of running a browser
on the required packages this means that your browser has not
been set up correctly for dpkg-www WEB installation.
See dpkg-www(8)
man page for more information.
EOF
}
# Get the value of a query argument
getValue() {
local key="$1"
test -x /usr/bin/perl || return
perl -e "use CGI; my \$q = new CGI(\$_); print \$q->param('$key')" "$1"
}
escape_html() {
echo "$*" | sed 's/&/\&/g; s/\"/\"/g; s/\</g; s/>/\>/g'
}
printHtmlHeader() {
local title="${1:-Debian Packages}"
local content_type="${2:-text/html}"
test "$html_header_done" && return
html_header_done=true
echo "Content-type: $content_type"
echo "Connection: close"
echo ""
if [ "$content_type" ]; then
echo ""
echo ""
echo "$title"
echo ""
echo ""
fi
}
# Generate an input form or the tag
printInputForm() {
local default
local installed
test "$noheader" = true && return
test "$input_form_done" = true && return
test "$KEEP_INPUT" = 1 && default="$query"
test "$INSTALLED_ONLY" = 1 && installed="checked"
echo "
Debian packages on $HOSTNAME
"
if [ -x /usr/bin/perl ]; then
echo '
'
if [ "${HTTP_USER_AGENT#Lynx}" != "$HTTP_USER_AGENT" ]; then
echo "
'
else
echo "'
test "$query" != " " && echo ''
fi
echo ''
else
echo '
'
echo ''
echo '
'
fi
input_form_done=true
}
# Print bottom info
printHtmlBottom() {
test "$noheader" = true && return
cat <<- EOF
EOF
tempfile=$(tempfile); trap "rm -f $tempfile" 0
exec 2>$tempfile
set -x
fi
# Sanity check on input values. $query is checked in doQuery.
checkInput "$install$remove$packages$debug"
if [ "$install" -a "$remove" ]; then
printError "Error: invalid request"
exit
fi
if [ "$install$remove$browse" -a "$packages" = "" ]; then
printError "Error: invalid request"
exit
fi
if [ "$install$remove$browse" -a "$query" != "" ]; then
printError "Error: invalid request"
exit
fi
if [ "$install" -a "$install" != "Install" -a "$install" != "Upgrade" ]; then
printError "Error: invalid request"
exit
fi
if [ "$remove" -a "$remove" != "Remove" ]; then
printError "Error: invalid request"
exit
fi
if [ "$browse" -a "$browse" != "Browse" ]; then
printError "Error: invalid request"
exit
fi
if [ "$installed" != "" ]; then
if test_flag "$installed"; then
INSTALLED_ONLY=1
else
INSTALLED_ONLY=0
fi
fi
title="Debian Packages${query:+: $query}"
if [ "$install" ]; then
printHtmlHeader "Package Installation" application/dpkg-www-installer
printInstallRequest "$packages"
printHtmlBottom
elif [ "$remove" ]; then
printHtmlHeader "Package Deinstallation" application/dpkg-www-installer
printRemoveRequest "$packages"
printHtmlBottom
elif [ "$browse" ]; then
printHtmlHeader "Package Browser" application/dpkg-www-browser
printBrowseRequest "$packages"
printHtmlBottom
else
printHtmlHeader "$title" text/html
printInputForm
doQuery "$query"
printHtmlBottom
fi
# end of file
dpkg-www-2.54+nmu1/src/dpkg-www-installer 0000755 0002322 0002322 00000010605 11032500425 020526 0 ustar pbuilder pbuilder #!/bin/sh
#
# Dpkg-www install helper used for dpkg-www cgi installation.
#
# Copyright (C) 1999-2003 Massimo Dal Zotto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
usage() {
echo "${0##*/} [-x|--xterm] [-f|--file] "
}
press_enter() {
echo ""
echo -n "Press Enter to close this window..."; read x
}
# Restart self in an xterm window. Must be the first option. Used by netscape.
if [ "$1" = "-x" -o "$1" = "--xterm" ]; then
shift 1
xterm -T "Package Installation" -e $0 "$@"
exit 0
fi
# Restart self in an xterm window. Used by mozilla which can't pass -x switch.
if [ "$DPKG_WWW_INSTALLER_XTERM" != true ] && ! tty -s; then
DPKG_WWW_INSTALLER_XTERM=true xterm -T "Package Installation" -e $0 "$@"
exit 0
fi
# Source optional config file
test -e /etc/dpkg-www.conf && . /etc/dpkg-www.conf 2>/dev/null
FILE=""
ACTION=""
HOST=""
PACKAGES=""
while [ "${1#-}" != "$1" ]; do
case "$1" in
-\?|-help|--help)
usage
exit
;;
-f|--file)
FILE="$2"
shift 2
;;
-*)
echo "Invalid option: $1" >&2
press_enter
exit 1
;;
esac
done
FILE="${FILE:-$1}"
if [ "$FILE" != "" -a ! -e "$FILE" ]; then
echo "File not found: $FILE" >&2
press_enter
exit 1
fi
request="$(cat "$FILE" | head -10)"; rm -f "$FILE"
if echo "$request" | grep -q "^Install-packages:"; then
ACTION=install
HOST=$(
echo "$request" | grep ^Install-host: \
| head -1 | sed 's/.*: *//; s/,/ /g'
)
PACKAGES=$(
echo "$request" | grep ^Install-packages: \
| head -1 | sed 's/.*: *//; s/,/ /g'
)
else
ACTION=remove
HOST=$(
echo "$request" | grep ^Remove-host: \
| head -1 | sed 's/.*: *//; s/,/ /g'
)
PACKAGES=$(
echo "$request" | grep ^Remove-packages: \
| head -1 | sed 's/.*: *//; s/,/ /g'
)
fi
if [ ! "$HOST" ]; then
echo "Missing hostname" >&2
press_enter
exit 1
fi
if [ "$(echo "$HOST" | sed 's/[ a-zA-Z0-9_.+-]//g')" ]; then
echo "Invalid characters in hostname: $HOST" >&2
press_enter
exit 1
fi
if [ ! "$PACKAGES" ]; then
echo "Missing package names" >&2
press_enter
exit 1
fi
# From Debian Packaging Manual, 4.2.1:
#
# The name of the binary package. Package names consist of the alphanumerics
# and + - . (plus, minus and full stop). In current versions of dpkg they are
# sort of case-sensitive.
#
if [ "$(echo "$PACKAGES" | sed 's/[ a-zA-Z0-9.+-]//g')" ]; then
echo "Invalid characters in package names: $PACKAGES" >&2
press_enter
exit 1
fi
if [ $(echo "$PACKAGES" | wc -w) -gt 1 ]; then
if [ "$ACTION" = install ]; then
echo "Installing the following packages on $HOST:"
else
echo "Removing the following packages on $HOST:"
fi
echo ""
echo "$PACKAGES" \
| if [ -x /usr/bin/fold ]; then fold -s -w 76; else cat; fi \
| sed 's/^/ /'
echo ""
else
if [ "$ACTION" = install ]; then
echo "Installing package $PACKAGES on $HOST."
else
echo "Removing package $PACKAGES from $HOST."
fi
echo ""
fi
case "$HOST" in
localhost|$(hostname)|$(hostname -f))
if [ "$(id -u)" = "0" ]; then
echo "You should NOT run this script as root!"
echo ""
echo -n "Press Enter to continue..."; read x
echo ""
apt-get -s $REINSTALL $ACTION $PACKAGES; echo
apt-get $REINSTALL $ACTION $PACKAGES
else
echo -n "Root "; su root -c "\
apt-get -s $REINSTALL $ACTION $PACKAGES; echo
apt-get $REINSTALL $ACTION $PACKAGES"
fi
;;
*)
# Ignore any active ssh-agent to force ssh passwd prompt
test "$FORCE_SSH_PASSWD" = true && unset SSH_AGENT_PID SSH_AUTH_SOCK
/usr/bin/ssh -l root "$HOST" PATH=/usr/sbin:/sbin:/usr/bin:/bin \
apt-get -s $REINSTALL $ACTION $PACKAGES \; echo \; \
apt-get $REINSTALL $ACTION $PACKAGES
;;
esac
press_enter
exit 0
# end of file
dpkg-www-2.54+nmu1/src/dpkg-www 0000755 0002322 0002322 00000006027 11020063333 016535 0 ustar pbuilder pbuilder #!/bin/sh
#
# Command-line interface to dpkg-www.
#
# Copyright (C) 1999-2006 Massimo Dal Zotto
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
usage() {
# Automatic help hack
echo "Usage: ${0##*/} [] []"
echo
echo "Options:"
echo
sed '/^ -/!d; s/\\//; s/)//; s/#/; s/#/>/' $0
echo
}
urlencode() {
perl -e '
$s=join(" ",@ARGV);
$s=~s/([^a-zA-Z0-9 _\.*@-])/uc sprintf("%%%02x",ord($1))/eg;
$s=~s/ /+/g;
print $s . "\n";' "$*"
}
DPKG_WWW_URL="http://${DPKG_WWW_HOST:-localhost}/cgi-bin/dpkg"
X11_BROWSERS="\
sensible-browser x-www-browser
mozilla firefox galeon gzilla arena chimera chimera2 amaya
gnome-help-browser opera netscape"
TXT_BROWSERS="\
sensible-browser www-browser
lynx lynx-ssl links w3m"
browser=
browser_args=
while [ "${1#-}" != "$1" ]; do
case "$1" in
-\?|-help|--help)
usage
exit
;;
-x|--xtrace)
shift 1
set -x
;;
-h|--host) #host#
test "$2" || { usage; exit 1; }
DPKG_WWW_URL="http://${2}/cgi-bin/dpkg"
shift 2 || exit 1
;;
-s|--stdout)
shift 1
export DISPLAY=""
noheader="&noheader=true"
if [ -x /usr/bin/lynx ]; then
browser="lynx"
browser_args="-dump -nolist"
elif [ -x /usr/bin/lynx-ssl ]; then
browser="lynx"
browser_args="-dump -nolist"
elif [ -x /usr/bin/links ]; then
browser="links"
browser_args=""
elif [ -x /usr/bin/w3m ]; then
browser="w3m"
browser_args=""
fi
;;
--|*)
break
;;
esac
done
# Source optional local and user configuration files
test -e /etc/dpkg-www.conf && . /etc/dpkg-www.conf 2>/dev/null
test -e ~/.dpkg-www && . ~/.dpkg-www 2>/dev/null
if [ "$DISPLAY" ]; then
for f in $browser $DPKG_WWW_BROWSER $X11_BROWSERS $TXT_BROWSERS; do
if which $f >/dev/null 2>&1; then
browser=$f
break
fi
done
else
for f in $browser $DPKG_WWW_BROWSER $TXT_BROWSERS; do
echo $X11_BROWSERS | grep -qw "$f" && continue # skip X11 $BROWSER
if which $f >/dev/null 2>&1; then
browser=$f
break
fi
done
fi
if [ ! "$browser" ]; then
echo "dpkg-www: no WWW browser found" >&2
exit 1
fi
query=$(urlencode "$*")
if [ "$DEBUG" = 1 -o "$DEBUG" = true ]; then
echo $browser $browser_args "$DPKG_WWW_URL?query=$query$noheader"
fi
exec $browser $browser_args "$DPKG_WWW_URL?query=$query$noheader"
# end of file
dpkg-www-2.54+nmu1/src/dpkg-www.conf 0000644 0002322 0002322 00000002463 10321452170 017462 0 ustar pbuilder pbuilder # Configuration file for dpkg-www. See dpkg-www(8) for more info.
# Enable install check-buttons in package list. Not recommended.
CHECK_BUTTONS=0
# Enable the install, upgrade and remove buttons in package info page.
# Use at your own risk. Possible values: (0|1|top).
INSTALL_BUTTON=0
# List also unavailable packages.
LIST_UNAVAILABLE=0
# List registered package documentation.
LIST_DOCUMENTATION=1
# Show local files directly. Automatically set.
SHOW_LOCAL_FILES=auto
# Check for newer versions. On slow machines you may want to disable this.
CHECK_PACKAGE_VERSION=1
# Options passed to grep-dctrl in queryPackagesByField()
GREP_DCTRL_OPTS="-i"
# Force ssh passwd prompt even if an ssh agent holds the private key.
FORCE_SSH_PASSWD=true
# List of Contents-xxx.gz files, if available.
# DEBIAN_CONTENTS="
# /mirror/debian/dists/stable/Contents-i386.gz
# /mirror/debian/dists/stable/non-US/Contents-i386.gz"
# Dpkg command (dpkg|dlocate|auto). Automatically detected.
#DPKG=auto
# Manpage conversion command (dwww|man2html|auto). Automatically detected.
#MAN=auto
# HTML background color.
BGCOLOR="#d0e0d0"
# Enable cgi debugging. Not really useful to normal users.
# DEBUG=1
# Path on webserver to dwww
#DWWW_PATH="/cgi-bin/dwww"
# Path on webserver to info2www
#INFO2WWW_PATH="/cgi-bin/info2www"
# end of file
dpkg-www-2.54+nmu1/debian/ 0000755 0002322 0002322 00000000000 11020063761 015473 5 ustar pbuilder pbuilder dpkg-www-2.54+nmu1/debian/dpkg-www.mime 0000644 0002322 0002322 00000000203 10075315376 020121 0 ustar pbuilder pbuilder application/dpkg-www-installer; /usr/sbin/dpkg-www-installer %s; needsterminal; description=dpkg-www-installer request; priority=2
dpkg-www-2.54+nmu1/debian/copyright 0000644 0002322 0002322 00000002077 10421404113 017426 0 ustar pbuilder pbuilder This package was written by Massimo Dal Zotto on
Mon, 2 Aug 1999 17:37:25 +0200.
This software is released under the terms of the GNU General Public
Licence.
Copyright (C) 1999-2006 Massimo Dal Zotto
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
dpkg-www-2.54+nmu1/debian/dirs 0000644 0002322 0002322 00000000135 10201450532 016352 0 ustar pbuilder pbuilder etc
usr/bin
usr/lib/cgi-bin
usr/sbin
usr/share/man/man1
usr/share/man/man8
usr/share/pixmaps
dpkg-www-2.54+nmu1/debian/postinst 0000644 0002322 0002322 00000000757 10506214563 017320 0 ustar pbuilder pbuilder #!/bin/sh
set -e
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
for server in apache2 apache apache-ssl; do
apachectl="/usr/sbin/${server}ctl"
apachepid="/var/run/${server}.pid"
if [ -x $apachectl -a -f $apachepid ]; then
echo "Restarting $server..." >&2
$apachectl restart >&2