From 866680428e462156a571540eb58d66f072a57e53 Mon Sep 17 00:00:00 2001 From: root <root@pimote.dsv.su.se> Date: Tue, 4 Aug 2015 08:17:49 +0000 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ sync-config.sh | 35 +++++++++++++++++++++++++++++++++++ tellstick.conf | 20 ++++++++++++++++++++ tellstick.skel | 9 +++++++++ tellstick.templ | 11 +++++++++++ 5 files changed, 77 insertions(+) create mode 100644 .gitignore create mode 100755 sync-config.sh create mode 100644 tellstick.conf create mode 100644 tellstick.skel create mode 100644 tellstick.templ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..77f70e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +tellstick.conf.new diff --git a/sync-config.sh b/sync-config.sh new file mode 100755 index 0000000..374eaec --- /dev/null +++ b/sync-config.sh @@ -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 diff --git a/tellstick.conf b/tellstick.conf new file mode 100644 index 0000000..377f0d8 --- /dev/null +++ b/tellstick.conf @@ -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" + } +} diff --git a/tellstick.skel b/tellstick.skel new file mode 100644 index 0000000..cf05e1b --- /dev/null +++ b/tellstick.skel @@ -0,0 +1,9 @@ +user = "nobody" +group = "plugdev" +deviceNode = "/dev/tellstick" +ignoreControllerConfirmation = "false" +controller { + id = 1 + type = 2 + serial = "A703AKUA" +} diff --git a/tellstick.templ b/tellstick.templ new file mode 100644 index 0000000..6075896 --- /dev/null +++ b/tellstick.templ @@ -0,0 +1,11 @@ +device { + id = HOSTNUM + name = "HOSTNAME" + controller = 0 + protocol = "arctech" + model = "selflearning-switch" + parameters { + house = "HOSTNUM" + unit = "1" + } +}