install script, new ringtone, absolute path to ringtone

This commit is contained in:
Dirk Alders 2022-09-21 15:57:45 +01:00
parent f8284b51ef
commit 50ecad5a4a
4 changed files with 43 additions and 2 deletions

41
__install__.py Normal file
View File

@ -0,0 +1,41 @@
#!/bin/python
#
import os
import sys
SERVICE_FILE = """
[Unit]
Description=Exec Command Service
After=network-online.target
Wants=network-online.target
[Service]
User=%(UID)d
Group=%(GID)d
ExecStart=%(MY_PATH)s/exec_command.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], 'exec_command.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()

View File

@ -11,7 +11,7 @@ MQTT_SERVER = "host"
TOPIC = 'topic' TOPIC = 'topic'
PAYLOAD = b'payload' PAYLOAD = b'payload'
COMMAND = "aplay ring.wav -D plughw:UACDemoV10,0" COMMAND = "aplay %s/ring.wav -D plughw:UACDemoV10,0" % __BASEPATH__
# #
# Logging # Logging

View File

@ -1 +1 @@
sounds/phone-incoming-call.wav sounds/door-bell.wav

BIN
sounds/door-bell.wav Normal file

Binary file not shown.