-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path50_configure_xeoma.sh
executable file
·63 lines (41 loc) · 2.21 KB
/
50_configure_xeoma.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
MAC_FILE=/config/macs.txt
#-----------------------------------------------------------------------------------------------------------------------
. /etc/envvars.merged
set -e
#-----------------------------------------------------------------------------------------------------------------------
function ts {
echo [`date '+%b %d %X'`]
}
#-----------------------------------------------------------------------------------------------------------------------
# Save some information about the interface that talks to the internet, in case we need it later.
# Have to parse /proc/net/route because there is no "ip" to do this: iface=$(ip route show default | awk '/default/ {print $5}')
iface=$(grep -E '^\S+\s+00000000' /proc/net/route | awk '{print $1}')
mac_address=$(cat /sys/class/net/$iface/address)
echo "$(ts) $iface $mac_address" >> "$MAC_FILE"
#-----------------------------------------------------------------------------------------------------------------------
# Delete before creating the symlinks, for two reasons: (1) the symlink might be left-over from a previous container (and
# therefore invalid in this container), and (2) if the container is restarted, there will already be a symlink, causing
# a new symlink like /usr/local/Xeoma/config/config
# Clean up any mess from before
rm -f /config/config
# NOTE: Around version 18.7.10 /.config is no longer used. Instead /usr/local/Xeoma is used whether or not the software
# is installed.
# == Old code below (for backwards compatibility)
# If we were to install Xeoma, it would run in /usr/local/Xeoma. But we're not, so it runs in /.config
mkdir -p /.config
rm -f /.config/Xeoma
ln -s /config /.config/Xeoma
rm -f /config/XeomaArchive
ln -s /archive /config/XeomaArchive
# == New code below.
rm -f /usr/local/Xeoma
ln -s /config /usr/local/Xeoma
rm -f /usr/local/Xeoma/XeomaArchive
ln -s /archive /usr/local/Xeoma/XeomaArchive
#-----------------------------------------------------------------------------------------------------------------------
echo "$(ts) Setting the password"
/usr/bin/xeoma -setpassword "$PASSWORD"
# Not sure why this is necessary, but without it, I can't connect to the server
/usr/bin/xeoma -showpassword > /dev/null 2>&1
exit 0