Ansible adaptions
This commit is contained in:
parent
2c53b23775
commit
962e7b6022
@ -1,41 +0,0 @@
|
|||||||
#!/bin/python
|
|
||||||
#
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
SERVICE_FILE = """
|
|
||||||
[Unit]
|
|
||||||
Description=Smarthome IR Remote Control
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
[Service]
|
|
||||||
User=%(UID)d
|
|
||||||
Group=%(GID)d
|
|
||||||
ExecStart=%(MY_PATH)s/remote_control.sh
|
|
||||||
Type=simple
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def help():
|
|
||||||
print("Usage: prog <UID> <GID> <TARGET_PATH>")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if len(sys.argv) == 4:
|
|
||||||
try:
|
|
||||||
uid = int(sys.argv[1])
|
|
||||||
gid = int(sys.argv[2])
|
|
||||||
except ValueError:
|
|
||||||
help()
|
|
||||||
else:
|
|
||||||
if os.path.isdir(sys.argv[3]):
|
|
||||||
with open(os.path.join(sys.argv[3], 'remote_control.service'), "w") as fh:
|
|
||||||
fh.write(SERVICE_FILE % {
|
|
||||||
"MY_PATH": os.path.dirname(os.path.abspath(__file__)),
|
|
||||||
"UID": uid,
|
|
||||||
"GID": gid})
|
|
||||||
else:
|
|
||||||
help()
|
|
||||||
else:
|
|
||||||
help()
|
|
@ -8,10 +8,10 @@ from remotes import technics_eur642100 as cd_player
|
|||||||
|
|
||||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
MQTT_USER = "mqtt_username"
|
MQTT_SERVER = "<mqtt_smarthome_hostname>"
|
||||||
MQTT_PASS = "mqtt_password"
|
MQTT_USER = "<mqtt_smarthome_username>"
|
||||||
MQTT_SERVER = "mqtt_server"
|
MQTT_PASS = "<mqtt_smarthome_password>"
|
||||||
MQTT_TOPIC = "mqtt_topic"
|
MQTT_TOPIC = "<mqtt_remote_topic>"
|
||||||
|
|
||||||
SUPPORTED_REMOTES = {
|
SUPPORTED_REMOTES = {
|
||||||
amplifier.NAME: amplifier.ALL,
|
amplifier.NAME: amplifier.ALL,
|
||||||
@ -23,7 +23,7 @@ SUPPORTED_REMOTES = {
|
|||||||
#
|
#
|
||||||
APP_NAME = "remote_control"
|
APP_NAME = "remote_control"
|
||||||
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
||||||
LOGLVL = 'DEBUG'
|
LOGLVL = 'INFO'
|
||||||
|
|
||||||
LOGHOST = 'cutelog'
|
LOGHOST = 'cutelog'
|
||||||
LOGPORT = 19996
|
LOGPORT = 19996
|
||||||
|
8
init_venv
Executable file
8
init_venv
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
BASEPATH=`realpath $(dirname $0)`
|
||||||
|
|
||||||
|
python3 -m venv $BASEPATH/venv
|
||||||
|
$BASEPATH/venv/bin/pip install --upgrade pip
|
||||||
|
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
|
||||||
|
$BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U
|
Loading…
x
Reference in New Issue
Block a user