install script, new ringtone, absolute path to ringtone
This commit is contained in:
parent
f8284b51ef
commit
50ecad5a4a
41
__install__.py
Normal file
41
__install__.py
Normal 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()
|
@ -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
|
||||||
|
BIN
sounds/door-bell.wav
Normal file
BIN
sounds/door-bell.wav
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user