[Pkg-ocaml-maint-commits] r1309 - in trunk/projects/approx: . debian
Eric Cooper
ecc-guest@costa.debian.org
Mon, 25 Apr 2005 13:54:00 +0000
Author: ecc-guest
Date: 2005-04-25 13:54:00 +0000 (Mon, 25 Apr 2005)
New Revision: 1309
Added:
trunk/projects/approx/debian/approx.default
trunk/projects/approx/debian/approx.postinst
trunk/projects/approx/debian/approx.postrm
trunk/projects/approx/debian/compat
Removed:
trunk/projects/approx/debian/conffiles
Modified:
trunk/projects/approx/approx.ml
trunk/projects/approx/debian/approx.init
trunk/projects/approx/debian/changelog
trunk/projects/approx/debian/control
trunk/projects/approx/debian/rules
Log:
run as unprivileged user (closes: #305451)
added /etc/default/approx with example of setting
http_proxy environment variable (closes: #305453)
detect possible conflict with apt-proxy at installation time
and at runtime if binding to port 9999 fails
Modified: trunk/projects/approx/approx.ml
===================================================================
--- trunk/projects/approx/approx.ml 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/approx.ml 2005-04-25 13:54:00 UTC (rev 1309)
@@ -330,8 +330,11 @@
print_config ();
main (daemon_spec ~port ~callback ~mode: `Single ~timeout: None ())
with
+ | Unix.Unix_error (Unix.EADDRINUSE, "bind", _) ->
+ message "Port %d is already in use" port;
+ if port = 9999 then message "Perhaps apt-proxy is already running?"
| Unix.Unix_error (err, str, _) ->
- message "%s: %s" str (Unix.error_message err)
+ message "%s: %s" str (Unix.error_message err);
| e ->
message "%s" (Printexc.to_string e)
Added: trunk/projects/approx/debian/approx.default
===================================================================
--- trunk/projects/approx/debian/approx.default 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/approx.default 2005-04-25 13:54:00 UTC (rev 1309)
@@ -0,0 +1,4 @@
+# Default settings for approx, included by the /etc/init.d/approx shell script
+
+# Uncomment and edit this definition to have approx use a proxy server
+#export http_proxy=HOST:PORT
Modified: trunk/projects/approx/debian/approx.init
===================================================================
--- trunk/projects/approx/debian/approx.init 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/approx.init 2005-04-25 13:54:00 UTC (rev 1309)
@@ -15,30 +15,30 @@
test -x $DAEMON || exit 0
# Read config file if it is present.
-#if [ -r /etc/default/$NAME ]
-#then
-# . /etc/default/$NAME
-#fi
+if [ -r /etc/default/$NAME ]
+then
+ . /etc/default/$NAME
+fi
#
# Function that starts the daemon/service.
#
d_start() {
- start-stop-daemon --start --quiet --exec $DAEMON
+ start-stop-daemon --start --quiet --exec $DAEMON --chuid approx:approx
}
#
# Function that stops the daemon/service.
#
d_stop() {
- start-stop-daemon --stop --quiet --name $NAME
+ start-stop-daemon --stop --quiet --exec $DAEMON
}
#
# Function that sends a SIGHUP to the daemon/service.
#
d_reload() {
- start-stop-daemon --stop --quiet --name $NAME --signal 1
+ start-stop-daemon --stop --quiet --exec $DAEMON --signal 1
}
case "$1" in
Added: trunk/projects/approx/debian/approx.postinst
===================================================================
--- trunk/projects/approx/debian/approx.postinst 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/approx.postinst 2005-04-25 13:54:00 UTC (rev 1309)
@@ -0,0 +1,38 @@
+#!/bin/sh -e
+
+action="$1"
+oldversion="$2"
+
+if [ "$action" != "configure" ]; then
+ exit 0
+fi
+
+# add the approx user
+if ! getent passwd approx >/dev/null; then
+ adduser --quiet --system --group --no-create-home --home /var/cache/approx approx
+fi
+
+# make sure cache is owned by the approx user
+if dpkg --compare-versions "$oldversion" lt 1.12; then
+ chown -R approx:approx /var/cache/approx
+fi
+
+# check for potential conflict with apt-proxy
+if [ -x /etc/init.d/apt-proxy ]; then
+ default_approx_port=9999
+ approx_port=$(awk '/^[ \t]*port/{print $2}' /etc/approx/approx.conf) || true
+ if [ -z "$approx_port" ]; then
+ approx_port=$default_approx_port;
+ fi
+ if [ "$approx_port" = "$default_approx_port" ]; then
+ echo "Warning: apt-proxy appears to be installed also." >&2
+ echo " For compatibility with client sources.list files," >&2
+ echo " approx uses the same port (9999) by default." >&2
+ echo " Please stop or remove apt-proxy, or configure" >&2
+ echo " one of them to listen on a different port." >&2
+ fi
+fi
+
+#DEBHELPER#
+
+# -*- shell-script-mode -*-
Added: trunk/projects/approx/debian/approx.postrm
===================================================================
--- trunk/projects/approx/debian/approx.postrm 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/approx.postrm 2005-04-25 13:54:00 UTC (rev 1309)
@@ -0,0 +1,18 @@
+#!/bin/sh -e
+
+action="$1"
+
+if [ "$action" != "purge" ]; then
+ exit 0
+fi
+
+rm -r /var/cache/approx
+
+if getent passwd approx >/dev/null; then
+ deluser --quiet approx
+ delgroup --quiet approx
+fi
+
+#DEBHELPER#
+
+# -*- shell-script-mode -*-
Modified: trunk/projects/approx/debian/changelog
===================================================================
--- trunk/projects/approx/debian/changelog 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/changelog 2005-04-25 13:54:00 UTC (rev 1309)
@@ -2,9 +2,20 @@
* New description, from suggestions by
Raphaƫl Berbain <raphael.berbain@free.fr>
-
- --
+ * approx
+ - run as unprivileged user (closes: #305451)
+ - added /etc/default/approx with example of setting
+ http_proxy environment variable (closes: #305453)
+ - detect possible conflict with apt-proxy at installation time
+ and at runtime if binding to port 9999 fails
+ * gc_approx
+ - remove unused distributions and empty parent directories from cache
+ - don't recheck files that have already been checked
+ - uncompress Packages.gz files to disk
+ - use wget to download Packages.gz file if decompression fails
+ -- Eric Cooper <ecc@cmu.edu> Mon, 25 Apr 2005 09:01:56 -0400
+
approx (1.11) unstable; urgency=low
* Daemonize correctly (closes: #305102)
Added: trunk/projects/approx/debian/compat
===================================================================
--- trunk/projects/approx/debian/compat 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/compat 2005-04-25 13:54:00 UTC (rev 1309)
@@ -0,0 +1 @@
+4
Deleted: trunk/projects/approx/debian/conffiles
===================================================================
--- trunk/projects/approx/debian/conffiles 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/conffiles 2005-04-25 13:54:00 UTC (rev 1309)
@@ -1,3 +0,0 @@
-/etc/approx/approx.conf
-/etc/init.d/approx
-/etc/cron.weekly/approx
Modified: trunk/projects/approx/debian/control
===================================================================
--- trunk/projects/approx/debian/control 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/control 2005-04-25 13:54:00 UTC (rev 1309)
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Eric Cooper <ecc@cmu.edu>
Uploaders: Sven Luther <luther@debian.org>, Stefano Zacchiroli <zack@debian.org>
-Build-Depends: debhelper, ocaml-nox-3.08.3, ocaml-tools, libsyslog-ocaml-dev (>= 1.0-3), libhttp-ocaml-dev (>= 0.1.0-3), libocamlnet-ocaml-dev (>= 1.0), libpcre-ocaml-dev, libcurl-ocaml-dev
+Build-Depends: debhelper (>= 4), ocaml-nox-3.08.3, ocaml-tools, libsyslog-ocaml-dev (>= 1.0-3), libhttp-ocaml-dev (>= 0.1.0-3), libocamlnet-ocaml-dev (>= 1.0), libpcre-ocaml-dev, libcurl-ocaml-dev
Standards-Version: 3.6.1
Package: approx
Modified: trunk/projects/approx/debian/rules
===================================================================
--- trunk/projects/approx/debian/rules 2005-04-24 21:10:56 UTC (rev 1308)
+++ trunk/projects/approx/debian/rules 2005-04-25 13:54:00 UTC (rev 1309)
@@ -1,6 +1,5 @@
#!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# This file is public domain software, originally written by Joey Hess.
+# Based on /usr/share/doc/debhelper/examples/rules
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1