Initial commit

This commit is contained in:
root 2015-08-04 08:17:49 +00:00
commit 866680428e
5 changed files with 77 additions and 0 deletions

2
.gitignore vendored Normal file

@ -0,0 +1,2 @@
*~
tellstick.conf.new

35
sync-config.sh Executable file

@ -0,0 +1,35 @@
#!/bin/sh
set -e
REMOTE_HOST="schema-gw.dsv.su.se"
REMOTE_FILE="/etc/dhcp/static-ips.conf"
TEMPL="tellstick.templ"
SKEL="tellstick.skel"
CONFFILE="tellstick.conf"
TMPCONF="$CONFFILE.new"
TMPFILE=$(mktemp)
trap 'rm -f $TMPFILE' EXIT
cd /opt/tellconf
#git commit -am "Autocommit on boot at $(date '+%F %R')"
scp "$REMOTE_HOST:$REMOTE_FILE" "$TMPFILE"
cp "$SKEL" "$TMPCONF"
while read line; do
hostname=$(echo "$line" | cut -d' ' -f2 | sed "s/.local//")
hostnum=$(echo "$line" | grep -Eo "[0-9]+;}$" | sed "s/;}//")
sed -e "s/HOSTNAME/$hostname/g" \
-e "s/HOSTNUM/$hostnum/g" \
"$TEMPL" >> "$TMPCONF"
done < "$TMPFILE"
#mv "$TMPCONF" "$CONFFILE"
#service telldusd restart

20
tellstick.conf Normal file

@ -0,0 +1,20 @@
user = "nobody"
group = "plugdev"
deviceNode = "/dev/tellstick"
ignoreControllerConfirmation = "false"
controller {
id = 1
type = 2
serial = "A703AKUA"
}
device {
id = 1
name = "master"
controller = 0
protocol = "arctech"
model = "selflearning-switch"
parameters {
house = "1"
unit = "1"
}
}

9
tellstick.skel Normal file

@ -0,0 +1,9 @@
user = "nobody"
group = "plugdev"
deviceNode = "/dev/tellstick"
ignoreControllerConfirmation = "false"
controller {
id = 1
type = 2
serial = "A703AKUA"
}

11
tellstick.templ Normal file

@ -0,0 +1,11 @@
device {
id = HOSTNUM
name = "HOSTNAME"
controller = 0
protocol = "arctech"
model = "selflearning-switch"
parameters {
house = "HOSTNUM"
unit = "1"
}
}