Removed dbus configuration and added avahi reload.

This commit is contained in:
root
2018-09-19 19:57:20 -05:00
parent d0860b01e3
commit 018d9232d4
4 changed files with 9 additions and 13 deletions

View File

@@ -32,6 +32,7 @@ RUN sed -i 's/Listen localhost:631/Listen 0.0.0.0:631/' /etc/cups/cupsd.conf &&
sed -i 's/<Location \/>/<Location \/>\n Allow All/' /etc/cups/cupsd.conf && \
sed -i 's/<Location \/admin>/<Location \/admin>\n Allow All\n Require user @SYSTEM/' /etc/cups/cupsd.conf && \
sed -i 's/<Location \/admin\/conf>/<Location \/admin\/conf>\n Allow All/' /etc/cups/cupsd.conf && \
sed -i 's/.*enable\-dbus=.*/enable\-dbus\=no/' /etc/avahi/avahi-daemon.conf && \
echo "ServerAlias *" >> /etc/cups/cupsd.conf && \
echo "DefaultEncryption Never" >> /etc/cups/cupsd.conf

View File

@@ -14,29 +14,19 @@ This Ubuntu-based Docker image runs a CUPS instance that is meant as an AirPrint
* `CUPSADMIN`: the CUPS admin user you want created
* `CUPSPASSWORD`: the password for the CUPS admin user
### Ports:
* `631`: the TCP port for CUPS must be exposed
### Ports/Network:
* Must be run on host network. This is required to support multicasting which is needed for Airprint.
### Example run command:
```
docker run --name cups -p 631:631 --restart unless-stopped \
docker run --name cups --restart unless-stopped --net host\
-v <your services dir>:/services \
-v <your config dir>:/config \
-v /var/run/dbus:/var/run/dbus \
-e CUPSADMIN="<username>" \
-e CUPSPASSWORD="<password>" \
chuckcharlie/cups-airprint-brother:latest
```
## Install Avahi on local host:
These commands only work on RedHat/CentOS/Fedora. Ubuntu will be different.
```
yum install avahi
systemctl start avahi-daemon
systemctl enable avahi-daemon
```
***This was the only way I was able to get /var/run/dbus to respond correctly in the container.***
## Add and set up printer:
CUPS will be configurable at http://[host ip]:631 using the CUPSADMIN/CUPSPASSWORD.

View File

@@ -3,7 +3,10 @@ inotifywait -m -e close_write,moved_to,create /etc/cups |
while read -r directory events filename; do
if [ "$filename" = "printers.conf" ]; then
rm -rf /services/AirPrint-*.service
rm -rf /etc/avahi/services/AirPrint-*.service
/root/airprint-generate.py -d /services
cp /etc/cups/printers.conf /config/printers.conf
cp -f /services/AirPrint-*.service /etc/avahi/services/ &
/usr/sbin/avahi-daemon --reload
fi
done

View File

@@ -11,10 +11,12 @@ mkdir -p /config/ppd
mkdir -p /services
rm -rf /etc/cups/ppd
ln -s /config/ppd /etc/cups
cp -f /services/*.service /etc/avahi/services/
if [ ! -f /config/printers.conf ]; then
touch /config/printers.conf
fi
cp /config/printers.conf /etc/cups/printers.conf
/root/printer-update.sh &
/usr/sbin/avahi-daemon &
exec /usr/sbin/cupsd -f