diff --git a/README.md b/README.md index 20846a8..4aa062f 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ You can configure the tool via environment variables: | Variable | Type | Description | | ------------- | ------------- | ------------- | -| NAME | mandatory | Arbitrary name to give your scanner. Displayed on scanner, if multiple servers are running. | +| NAME | mandatory | Arbitrary (avoid spaces) name to give your scanner. Displayed on scanner, if multiple servers are running. | | MODEL | mandatory | Model of your scanner (e.g., MFC-L2700DW) | | IPADDRESS | mandatory | IP Address of your scanner | | RESOLUTION | optional | DPI resolution of scan, refer to capabilities of printer on startup | diff --git a/files/runScanner.sh b/files/runScanner.sh index a3d82a0..7cabf45 100755 --- a/files/runScanner.sh +++ b/files/runScanner.sh @@ -1,5 +1,11 @@ #!/bin/bash echo "setting up user & logfile:" + +if [[ $NAME == *" "* ]]; then + echo "Do not use spaces in NAME!" + exit -1 +fi + if [[ -z ${UID} ]]; then UID=1000 fi @@ -7,11 +13,11 @@ if [[ -z ${GID} ]]; then GID=1000 fi groupadd --gid "$GID" NAS -adduser "$USERNAME" --uid $UID --gid "$GID" --disabled-password --force-badname --gecos "" +adduser "$NAME" --uid $UID --gid "$GID" --disabled-password --force-badname --gecos "" mkdir -p /scans chmod 777 /scans touch /var/log/scanner.log -chown "$USERNAME" /var/log/scanner.log +chown "$NAME" /var/log/scanner.log env >/opt/brother/scanner/env.txt chmod -R 777 /opt/brother echo "-----" @@ -43,8 +49,8 @@ cat /opt/brother/scanner/brscan-skey/brscan-skey.config echo "-----" echo "starting scanner drivers..." -su - "$USERNAME" -c "/usr/bin/brsaneconfig4 -a name=$NAME model=$MODEL ip=$IPADDRESS" -su - "$USERNAME" -c "/usr/bin/brscan-skey" +su - "$NAME" -c "/usr/bin/brsaneconfig4 -a name=$NAME model=$MODEL ip=$IPADDRESS" +su - "$NAME" -c "/usr/bin/brscan-skey" echo "-----" echo "setting up webserver:"