mirror of
https://github.com/nikdoof/cups-avahi-airprint.git
synced 2025-12-12 00:02:16 +00:00
Adding python3 support and gutenprint packages
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -8,17 +8,21 @@ RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositorie
|
|||||||
cups-client \
|
cups-client \
|
||||||
cups-filters \
|
cups-filters \
|
||||||
cups-dev \
|
cups-dev \
|
||||||
|
gutenprint \
|
||||||
|
gutenprint-libs \
|
||||||
|
gutenprint-doc \
|
||||||
|
gutenprint-cups \
|
||||||
ghostscript \
|
ghostscript \
|
||||||
avahi \
|
avahi \
|
||||||
inotify-tools \
|
inotify-tools \
|
||||||
python \
|
python3 \
|
||||||
python-dev \
|
python3-dev \
|
||||||
py-pip \
|
py3-pip \
|
||||||
build-base \
|
build-base \
|
||||||
wget \
|
wget \
|
||||||
rsync \
|
rsync \
|
||||||
&& pip --no-cache-dir install --upgrade pip \
|
&& pip3 --no-cache-dir install --upgrade pip \
|
||||||
&& pip install pycups \
|
&& pip3 install pycups \
|
||||||
&& rm -rf /var/cache/apk/*
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# This will use port 631
|
# This will use port 631
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright (c) 2010 Timothy J Fontaine <tjfontaine@atxconsulting.com>
|
Copyright (c) 2010 Timothy J Fontaine <tjfontaine@atxconsulting.com>
|
||||||
@@ -22,9 +22,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import cups, os, optparse, re, urlparse
|
import cups, os, optparse, re
|
||||||
|
import urllib.parse as urlparse
|
||||||
import os.path
|
import os.path
|
||||||
from StringIO import StringIO
|
from io import StringIO
|
||||||
|
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
@@ -43,7 +44,8 @@ except:
|
|||||||
from elementtree import Element, ElementTree, tostring
|
from elementtree import Element, ElementTree, tostring
|
||||||
etree = None
|
etree = None
|
||||||
except:
|
except:
|
||||||
raise 'Failed to find python libxml or elementtree, please install one of those or use python >= 2.5'
|
print('Failed to find python libxml or elementtree, please install one of those or use python >= 2.5')
|
||||||
|
raise
|
||||||
|
|
||||||
XML_TEMPLATE = """<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
|
XML_TEMPLATE = """<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
|
||||||
<service-group>
|
<service-group>
|
||||||
@@ -121,7 +123,7 @@ class AirPrintGenerate(object):
|
|||||||
|
|
||||||
printers = conn.getPrinters()
|
printers = conn.getPrinters()
|
||||||
|
|
||||||
for p, v in printers.items():
|
for p, v in list(printers.items()):
|
||||||
if v['printer-is-shared']:
|
if v['printer-is-shared']:
|
||||||
attrs = conn.getPrinterAttributes(p)
|
attrs = conn.getPrinterAttributes(p)
|
||||||
uri = urlparse.urlparse(v['printer-uri-supported'])
|
uri = urlparse.urlparse(v['printer-uri-supported'])
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
# Is CUPSADMIN set? If not, set to default
|
||||||
|
if [ -z "$CUPSADMIN" ]; then
|
||||||
|
CUPSADMIN="cupsadmin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Is CUPSPASSWORD set? If not, set to $CUPSADMIN
|
||||||
|
if [ -z "$CUPSPASSWORD" ]; then
|
||||||
|
CUPSPASSWORD=$CUPSADMIN
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $(grep -ci $CUPSADMIN /etc/shadow) -eq 0 ]; then
|
if [ $(grep -ci $CUPSADMIN /etc/shadow) -eq 0 ]; then
|
||||||
adduser -S -G lpadmin --no-create-home $CUPSADMIN
|
adduser -S -G lpadmin --no-create-home $CUPSADMIN
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user