Merge pull request #2 from thoschworks/pr_cupsadmin-defaults

Add defaults for CUPSADMIN and CUPSPASSWORD
This commit is contained in:
chuckcharlie
2020-12-23 23:43:08 -07:00
committed by GitHub
2 changed files with 12 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ This Alpine-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
If CUPSADMIN is not set, the default "cupsadmin" will be used. If CUPSPASSWORD is no set, the name of the admin user will be used.
### Ports/Network:
* Must be run on host network. This is required to support multicasting which is needed for Airprint.

View File

@@ -2,6 +2,16 @@
set -e
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
adduser -S -G lpadmin --no-create-home $CUPSADMIN
fi