Explorar el Código

Ansible adaptions

master
Dirk Alders hace 1 año
padre
commit
962e7b6022
Se han modificado 3 ficheros con 13 adiciones y 46 borrados
  1. 0
    41
      __install__.py
  2. 5
    5
      config_example/config.py
  3. 8
    0
      init_venv

+ 0
- 41
__install__.py Ver fichero

@@ -1,41 +0,0 @@
1
-#!/bin/python
2
-#
3
-import os
4
-import sys
5
-
6
-SERVICE_FILE = """
7
-[Unit]
8
-Description=Smarthome IR Remote Control
9
-After=network-online.target
10
-Wants=network-online.target
11
-[Service]
12
-User=%(UID)d
13
-Group=%(GID)d
14
-ExecStart=%(MY_PATH)s/remote_control.sh
15
-Type=simple
16
-[Install]
17
-WantedBy=default.target
18
-"""
19
-
20
-
21
-def help():
22
-    print("Usage: prog <UID> <GID> <TARGET_PATH>")
23
-
24
-if __name__ == "__main__":
25
-    if len(sys.argv) == 4:
26
-        try:
27
-            uid = int(sys.argv[1])
28
-            gid = int(sys.argv[2])
29
-        except ValueError:
30
-            help()
31
-        else:
32
-            if os.path.isdir(sys.argv[3]):
33
-                with open(os.path.join(sys.argv[3], 'remote_control.service'), "w") as fh:
34
-                    fh.write(SERVICE_FILE % {
35
-                        "MY_PATH": os.path.dirname(os.path.abspath(__file__)),
36
-                        "UID": uid,
37
-                        "GID": gid})
38
-            else:
39
-                help()
40
-    else:
41
-        help()

+ 5
- 5
config_example/config.py Ver fichero

@@ -8,10 +8,10 @@ from remotes import technics_eur642100 as cd_player
8 8
 
9 9
 __BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
10 10
 
11
-MQTT_USER = "mqtt_username"
12
-MQTT_PASS = "mqtt_password"
13
-MQTT_SERVER = "mqtt_server"
14
-MQTT_TOPIC = "mqtt_topic"
11
+MQTT_SERVER = "<mqtt_smarthome_hostname>"
12
+MQTT_USER = "<mqtt_smarthome_username>"
13
+MQTT_PASS = "<mqtt_smarthome_password>"
14
+MQTT_TOPIC = "<mqtt_remote_topic>"
15 15
 
16 16
 SUPPORTED_REMOTES = {
17 17
     amplifier.NAME: amplifier.ALL,
@@ -23,7 +23,7 @@ SUPPORTED_REMOTES = {
23 23
 #
24 24
 APP_NAME = "remote_control"
25 25
 LOGTARGET = 'stdout'   # possible choices are: 'logfile' or 'stdout'
26
-LOGLVL = 'DEBUG'
26
+LOGLVL = 'INFO'
27 27
 
28 28
 LOGHOST = 'cutelog'
29 29
 LOGPORT = 19996

+ 8
- 0
init_venv Ver fichero

@@ -0,0 +1,8 @@
1
+#!/bin/sh
2
+#
3
+BASEPATH=`realpath $(dirname $0)`
4
+
5
+python3 -m venv $BASEPATH/venv
6
+$BASEPATH/venv/bin/pip install --upgrade pip
7
+find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
8
+$BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U

Loading…
Cancelar
Guardar