Add arg checker.
parent
10f59ae380
commit
f8e1324c82
|
@ -18,6 +18,9 @@ def main(args):
|
|||
args = ["--help"]
|
||||
result = parser.parse_args(args)
|
||||
|
||||
def check_client_args_exists():
|
||||
return False
|
||||
|
||||
# Deamon mode
|
||||
if not isinstance(result.sys_server, bool):
|
||||
raise RuntimeError("Arg parser has the wrong type.")
|
||||
|
@ -26,14 +29,23 @@ def main(args):
|
|||
if result.sys_server and result.user_server:
|
||||
raise ValueError("System and user service can't be set simultan.")
|
||||
if result.sys_server:
|
||||
# Check if root
|
||||
if os.getuid() != 0:
|
||||
# Checks
|
||||
if check_client_args_exists():
|
||||
raise RuntimeError("Client settings are setting in system service mode.")
|
||||
if os.getuid() != 0: # Check root
|
||||
raise RuntimeError("System service has to run as root.")
|
||||
|
||||
# Run deamon
|
||||
asyncio.run(sys_service.rpc.run_deamon()) # TODO: Change default path
|
||||
elif result.user_server:
|
||||
# Checks
|
||||
if check_client_args_exists():
|
||||
raise RuntimeError("Client settings are setting in system service mode.")
|
||||
|
||||
# Run deamon
|
||||
asyncio.run(user_service.rpc.run_deamon()) # TODO: Change default path of user and system socket
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue