-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelcom-runner
executable file
·73 lines (64 loc) · 1.93 KB
/
delcom-runner
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
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# This file is called by systemd via [email protected]
#
# delcom-clock Copyright 2014 Stuart Pook http://www.pook.it/
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# https://github.com/stuart12/delcom-clock
# I have 3 clocks and I want them to show different things. I use the
# kernel device to distinguish between the different clocks.
# You don;t need this script if you want all you clocks to show the same thing.
# Just call delcom-clock directly from [email protected]
format='%m%d %k%M'
update=60
case "$1" in
*.3:1.0)
args="--off --control /run/led-bedroom --chown stuart"
decimals=10000101
;;
*/3-13:1.0|*.4:1.0)
decimals=00010100
format='%w %H%M%S'
update=1
;;
*)
decimals=10000100
;;
esac
exec /usr/local/lib/delcom-clock --syslog --decimals $decimals --update $update --format "$format" $args -- "$1"
####
decimals=00010100
format='%w %H%M%S'
update=1
if [[ "$1" =~ /0000:00:..\../0000:0.:00\.0/usb[0-9]+/[0-9]+-[0-9]+\.[0-9]+:1\.0$ ]]
then
: USB 3.0 card
elif [[ "$1" =~ /[0-9]+-[0-9]+\.[0-9]+:1\.0$ ]]
then
: in a hub
format='%m%d %k%M'
update=60
case "$1" in
*.3:1.0)
: in position 3 in a hub
args="--control /run/led-bedroom --chown stuart"
decimals=10000101
;;
*)
decimals=10000100
;;
esac
else
: not in a hub
fi
exec /usr/local/lib/delcom-clock --syslog --decimals $decimals --update $update --format "$format" $args -- "$1"