[Pkg-cups-devel] r329 - in cupsys/branches/cups-1.2/debian: local
Martin Pitt
mpitt at costa.debian.org
Mon Jul 24 09:04:42 UTC 2006
Author: mpitt
Date: Mon Jul 24 09:04:42 2006
New Revision: 329
Added:
cupsys/branches/cups-1.2/debian/local/enable_sharing (contents, props changed)
cupsys/branches/cups-1.2/debian/local/sharing_status (contents, props changed)
Modified:
cupsys/branches/cups-1.2/debian/changelog
cupsys/branches/cups-1.2/debian/rules
Log:
* Add debian/local/{enable_sharing,sharing_status}: Similar to
enable_browsing and browsing_status, this switches between "Listen
localhost:631" and "Port 631" (just as the web interface does). Install
files in debian/rules.
Modified: cupsys/branches/cups-1.2/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2/debian/changelog (original)
+++ cupsys/branches/cups-1.2/debian/changelog Mon Jul 24 09:04:42 2006
@@ -27,8 +27,12 @@
them).
* debian/local/{enable_browsing,browsing_status}: Adapt to single-file
configuration file style.
+ * Add debian/local/{enable_sharing,sharing_status}: Similar to
+ enable_browsing and browsing_status, this switches between "Listen
+ localhost:631" and "Port 631" (just as the web interface does). Install
+ files in debian/rules.
- -- Kenshi Muto <kmuto at debian.org> Mon, 24 Jul 2006 10:55:22 +0200
+ -- Kenshi Muto <kmuto at debian.org> Mon, 24 Jul 2006 10:59:27 +0200
cupsys (1.2.1-4) unstable; urgency=medium
Added: cupsys/branches/cups-1.2/debian/local/enable_sharing
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2/debian/local/enable_sharing Mon Jul 24 09:04:42 2006
@@ -0,0 +1,65 @@
+#!/bin/sh -e
+
+# Author: Martin Pitt <martin.pitt at ubuntu.com>
+# (C) 2005 Canonical Ltd.
+#
+# Configure CUPS IPP LAN printer sharing; this is only possible if "Listen" is
+# present in ports.conf (i. e. sharing_status returns 0 or 1). If the setting
+# changed, CUPS will be restarted.
+#
+# Argument:
+# 0: disable sharing
+# 1: enabled sharing
+# Return 0 on success, or 1 on failure (prints error to stderr)
+
+STATUS_SCRIPT=/usr/share/cups/sharing_status
+CONF=/etc/cups/cupsd.conf
+
+[ -x $STATUS_SCRIPT ] || {
+ echo "Error: cannot execute $STATUS_SCRIPT" >&2
+ exit 1
+}
+
+set +e
+$STATUS_SCRIPT
+STATUS=$?
+set -e
+
+case "$1" in
+ 0)
+ NEWVAL=Off
+ ;;
+ 1)
+ NEWVAL=On
+ ;;
+ *)
+ echo "Invalid argument (must be 0 or 1)" >&2
+ exit 1
+ ;;
+esac
+
+[ $STATUS = 0 -o $STATUS = 1 ] || {
+ echo "Error: cannot modify custom configuration" >&2
+ exit 1
+}
+
+# nothing to do?
+[ $1 != $STATUS ] || exit 0
+
+
+if [ $1 = 0 ]; then
+ sed -ri "s/^[[:space:]]*(Port|Listen)[[:space:]]+631\\>/Listen 127.0.0.1:631/i" $CONF
+else
+ sed -ri "s/^[[:space:]]*Listen[[:space:]]+localhost:631\\>/Listen 631/i" $CONF
+fi
+
+
+# restart CUPS
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/cupsys" ]; then
+ if [ -x /usr/sbin/invoke-rc.d ]; then
+ invoke-rc.d cupsys force-reload || exit 0
+ else
+ /etc/init.d/cupsys force-reload || exit 0
+ fi
+fi
Added: cupsys/branches/cups-1.2/debian/local/sharing_status
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2/debian/local/sharing_status Mon Jul 24 09:04:42 2006
@@ -0,0 +1,23 @@
+#!/bin/sh -e
+
+# Author: Martin Pitt <martin.pitt at ubuntu.com>
+# (C) 2005 Canonical Ltd.
+#
+# Get the status of IPP network browsing through exit code:
+#
+# 0: sharing is disabled (default configuration)
+# 1: sharing is enabled for LAN
+# 2: the configuration was adapted manually; in this case enable_sharing cannot
+# be used
+
+CONF=/etc/cups/cupsd.conf
+
+[ -f $CONF ] || exit 2
+
+if egrep -qi '^[[:space:]]*(Port|Listen)[[:space:]]+(631)[[:space:]]*(#.*)?$' $CONF; then
+ exit 1
+fi
+if egrep -qi '^[[:space:]]*Listen[[:space:]]+(localhost|127.0.0.1):631[[:space:]]*(#.*)?$' $CONF; then
+ exit 0
+fi
+exit 2
Modified: cupsys/branches/cups-1.2/debian/rules
==============================================================================
--- cupsys/branches/cups-1.2/debian/rules (original)
+++ cupsys/branches/cups-1.2/debian/rules Mon Jul 24 09:04:42 2006
@@ -55,7 +55,7 @@
#(cd $(DEB_DESTDIR)/../cupsys/usr/share/man && mv man1/backend.1 man1/cups-backend.1 && mv man1/filter.1 man1/cups-filter.1)
(install -m 755 -o root -g root $(DEB_DESTDIR)/../pdftops $(DEB_DESTDIR)/../cupsys/usr/lib/cups/filter/)
install -o root -g root -m 644 debian/cupsys.default debian/cupsys/etc/default/cupsys
- install -m 755 debian/local/browsing_status debian/local/enable_browsing $(DEB_DESTDIR)/../cupsys/usr/share/cups
+ install -m 755 debian/local/browsing_status debian/local/enable_browsing debian/local/sharing_status debian/local/enable_sharing $(DEB_DESTDIR)/../cupsys/usr/share/cups
# Install PPDs into /usr/share/ppd/cups-included/<Manufacturer>, see
# http://wiki.debian.org/PpdFileStructureSpecification
More information about the Pkg-cups-devel
mailing list