-
Notifications
You must be signed in to change notification settings - Fork 146
/
entrypoint.sh
44 lines (35 loc) · 965 Bytes
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
set -xve
# Test using the following form:
# export SANED_NET_HOSTS="a|b" AIRSCAN_DEVICES="c|d" DELIMITER="|"; ./entrypoint.sh
# turn off globbing
set -f
# split at newlines only (airscan devices can have spaces in)
IFS='
'
# Get a custom delimiter but default to ;
DELIMITER=${DELIMITER:-;}
# Insert a list of net hosts
if [ ! -z "$SANED_NET_HOSTS" ]; then
hosts=$(echo $SANED_NET_HOSTS | sed "s/$DELIMITER/\n/")
for host in $hosts; do
echo $host >> /etc/sane.d/net.conf
done
fi
# Insert airscan devices
if [ ! -z "$AIRSCAN_DEVICES" ]; then
devices=$(echo $AIRSCAN_DEVICES | sed "s/$DELIMITER/\n/")
for device in $devices; do
sed -i "/^\[devices\]/a $device" /etc/sane.d/airscan.conf
done
fi
# Insert pixma hosts
if [ ! -z "$PIXMA_HOSTS" ]; then
hosts=$(echo $PIXMA_HOSTS | sed "s/$DELIMITER/\n/")
for host in $hosts; do
echo "bjnp://$host" >> /etc/sane.d/pixma.conf
done
fi
unset IFS
set +f
node ./server/server.js