diff options
Diffstat (limited to 'files')
-rw-r--r-- | files/files/etc/config/dayled.sops | 21 | ||||
-rw-r--r-- | files/files/etc/hotplug.d/ntp/99-dayled | 7 | ||||
-rwxr-xr-x | files/files/etc/init.d/dayled | 11 | ||||
-rw-r--r-- | files/files/usr/local/sbin/dayled.sh | 22 |
4 files changed, 61 insertions, 0 deletions
diff --git a/files/files/etc/config/dayled.sops b/files/files/etc/config/dayled.sops new file mode 100644 index 0000000..ad89426 --- /dev/null +++ b/files/files/etc/config/dayled.sops | |||
@@ -0,0 +1,21 @@ | |||
1 | { | ||
2 | "data": "ENC[AES256_GCM,data:hOZtsaVLwayRsA1vSdN0Rp6V6shQe0sQp1mGnKiwhR3SsSitYmGohzt+sfXER4YKRaMjE1QwdeSFcX3kjthvgHiOqscirKBdodTxYQvwrr8iog1FgmWCLlNAy4ymu4w=,iv:boQ8RbTFCUPAmzr6dW/q2mg6/Hj8Z3oN9y79gdSMLvQ=,tag:f/suZzHXTpS7RWVQQw1D/g==,type:str]", | ||
3 | "sops": { | ||
4 | "kms": null, | ||
5 | "gcp_kms": null, | ||
6 | "azure_kv": null, | ||
7 | "hc_vault": null, | ||
8 | "age": null, | ||
9 | "lastmodified": "2022-01-09T01:15:26Z", | ||
10 | "mac": "ENC[AES256_GCM,data:hwXoKGTfNQAydB1dW5z8OOIngWPtgpuoNA/cUE7Fp7pk0qfepkasAI3Ia5pbnTelwEdEA8WIUkspsWMTsHSsSfGCaK1nlUoJaFEPp2WfAlYMlv72hpYSPCMliEqzZlVEKErHEntzmKEKkzIEZgvRdcXlKkuaoVqw4BLOq7D7GMY=,iv:oUhIWjYBRp+IG/CGQ0Di53O9p1IThTUZZFtOnyrC210=,tag:6URfy7eJE7UyfLfo5cw6Ng==,type:str]", | ||
11 | "pgp": [ | ||
12 | { | ||
13 | "created_at": "2022-01-09T01:06:05Z", | ||
14 | "enc": "-----BEGIN PGP MESSAGE-----\n\nhF4DXxoViZlp6dISAQdAsk0uQt1Z6ZLFOIk7wnRrGAvqKX6heGmm1lT/H0Tmq1sw\nbPoi/dET8FwNNuAMnzZ2tDvFK9EPc5JUsVUJQj1UovnX8C7LOB4sj6d5r5QX8ESy\n0l4BobggGBHcNiHymFSkDpnCcR/16twE+HWNGvqDKtjMDncgLgrsB3ost4sGDLVI\nZxVgSSFcEfi2wUOToI/A9jjPAk4Kg80nTHHZrWvAYBDkkh6+fcLyI42JGrhklNqv\n=IXR/\n-----END PGP MESSAGE-----\n", | ||
15 | "fp": "30D3453B8CD02FE2A3E7C78C0FB536FB87AE8F51" | ||
16 | } | ||
17 | ], | ||
18 | "unencrypted_suffix": "_unencrypted", | ||
19 | "version": "3.7.1" | ||
20 | } | ||
21 | } \ No newline at end of file | ||
diff --git a/files/files/etc/hotplug.d/ntp/99-dayled b/files/files/etc/hotplug.d/ntp/99-dayled new file mode 100644 index 0000000..6dcaadc --- /dev/null +++ b/files/files/etc/hotplug.d/ntp/99-dayled | |||
@@ -0,0 +1,7 @@ | |||
1 | [ "$ACTION" = "stratum" ] || exit 0 | ||
2 | |||
3 | /etc/init.d/dayled stop | ||
4 | |||
5 | /usr/local/sbin/dayled.sh poll | ||
6 | |||
7 | /etc/init.d/dayled start \ No newline at end of file | ||
diff --git a/files/files/etc/init.d/dayled b/files/files/etc/init.d/dayled new file mode 100755 index 0000000..79a9c59 --- /dev/null +++ b/files/files/etc/init.d/dayled | |||
@@ -0,0 +1,11 @@ | |||
1 | #!/bin/sh /etc/rc.common | ||
2 | |||
3 | USE_PROCD=1 | ||
4 | NAME=dayled | ||
5 | |||
6 | start_service() { | ||
7 | procd_open_instance $NAME | ||
8 | procd_set_param command /usr/local/sbi/dayled.sh | ||
9 | procd_set_param respawn 3600 1 0 | ||
10 | procd_close_instance | ||
11 | } | ||
diff --git a/files/files/usr/local/sbin/dayled.sh b/files/files/usr/local/sbin/dayled.sh new file mode 100644 index 0000000..8a30b4e --- /dev/null +++ b/files/files/usr/local/sbin/dayled.sh | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | local latitude="$(uci get dayled.@dayled[0].latitude)" | ||
4 | local longitude="$(uci get dayled.@dayled[0].longitude)" | ||
5 | local offset="$(uci get dayled.@dayled[0].offset)" | ||
6 | |||
7 | function act() { | ||
8 | sunwait $1 $offset $latitude $longitude >/dev/null | ||
9 | local state=$? | ||
10 | if [ "$state" -eq 2 ]; then | ||
11 | cat /sys/class/leds/blue\:dome/max_brightness > /sys/class/leds/blue\:dome/brightness | ||
12 | elif [ "$state" -eq 3 ]; then | ||
13 | echo 0 > /sys/class/leds/blue\:dome/brightness | ||
14 | fi | ||
15 | } | ||
16 | |||
17 | while | ||
18 | act "${1:-wait}" | ||
19 | [ "${1:-wait}" = "wait" ] | ||
20 | do :; done | ||
21 | act wait | ||
22 | done | ||