install routine deleted - now in ansible
This commit is contained in:
parent
7ea356bd84
commit
03e5e29f7b
@ -1,43 +0,0 @@
|
||||
#!/bin/python
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
|
||||
SERVICE_FILE = """
|
||||
[Unit]
|
||||
Description=Smarthome Ambient Information Service
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
[Service]
|
||||
User=%(UID)d
|
||||
Group=%(GID)d
|
||||
WorkingDirectory=%(MY_PATH)s
|
||||
ExecStart=%(MY_PATH)s/smart_brain.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], 'smart_brain.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()
|
Loading…
x
Reference in New Issue
Block a user