Create ~/.config/systemd/user and parent dirs if it does not already exist

This commit is contained in:
Matt Gauger 2019-12-12 18:15:17 -06:00 committed by Dmitrii Gerasimov
parent becc43863c
commit c5440b61cb

View file

@ -26,8 +26,12 @@ def systemd(*args, method=check_call):
]) ])
def setup(args): def setup(args):
base_path = '~/.config/systemd/user'
if not Path(base_path).expanduser().is_dir():
Path(base_path).expanduser().mkdir(parents=True, exist_ok=True)
unit_name = args.unit_name unit_name = args.unit_name
out = Path(f'~/.config/systemd/user/{unit_name}').expanduser() out = Path(f'{base_path}/{unit_name}').expanduser()
print(f"Writing systemd config to {out}:") print(f"Writing systemd config to {out}:")
server_bin = Path(__file__).parent.joinpath('grasp_server.py').absolute() server_bin = Path(__file__).parent.joinpath('grasp_server.py').absolute()