Skip to content

Commit

Permalink
Merge pull request #47 from PhilippMundhenk/20-printer-always-display…
Browse files Browse the repository at this point in the history
…s-qnap-machine-name-as-username

Fixing NAME variable
  • Loading branch information
pedropombeiro authored Sep 23, 2024
2 parents 04cf4de + 970d0f7 commit 898ec94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
14 changes: 10 additions & 4 deletions files/runScanner.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/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
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 "-----"
Expand Down Expand Up @@ -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:"
Expand Down

0 comments on commit 898ec94

Please sign in to comment.