forked from arnaudhb/docker-fahclient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
30 lines (24 loc) · 794 Bytes
/
docker-entrypoint.sh
File metadata and controls
30 lines (24 loc) · 794 Bytes
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
#!/bin/bash
function check_configuration()
{
echo "Check environment variables"
if [ -z "$FAHCLIENT_PASSKEY" -o -z "$FAHCLIENT_TEAM" -o -z "$FAHCLIENT_USER" ]
then
echo "Please set the variables by editing $0"
return 1
fi
echo "Update configuration"
local FAHCLIENT_CONF=/etc/fahclient/config.xml
sed -i s/_POWER_/$FAHCLIENT_POWER/g $FAHCLIENT_CONF
sed -i s/_PASSKEY_/$FAHCLIENT_PASSKEY/g $FAHCLIENT_CONF
sed -i s/_TEAM_/$FAHCLIENT_TEAM/g $FAHCLIENT_CONF
sed -i s/_USER_/$FAHCLIENT_USER/g $FAHCLIENT_CONF
}
function start_fahclient()
{
echo "Starting FAHclient..."
/usr/bin/FAHClient /etc/fahclient/config.xml --pid-file=/var/run/fahclient.pid --daemon
}
check_configuration || { echo "Invalid configuration"; exit 1; }
start_fahclient
/bin/sleep infinity