Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing NAME variable #47

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading