Skip to content

Commit

Permalink
Fix passing None to systemd unit
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Jul 5, 2020
1 parent 31df71e commit 8fbaa66
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/promnesia/misc/install_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def install_launchd(name: str, out: Path, launcher: str, largs: List[str]) -> No

def install(args) -> None:
name = args.name
# todo use appdirs for config dir detection
if SYSTEM == 'Linux':
# Check for existence of systemd
# https://www.freedesktop.org/software/systemd/man/sd_booted.html
Expand All @@ -120,7 +121,13 @@ def install(args) -> None:
exe = distutils.spawn.find_executable('promnesia'); assert exe is not None
launcher = exe # older systemd wants absolute paths..

largs = ['serve', '--db', args.db, '--timezone', args.timezone, '--port', args.port]
db = args.db
largs = [
'serve',
*([] if db is None else ['--db', str(db)]),
'--timezone', args.timezone,
'--port', args.port,
]

out.parent.mkdir(parents=True, exist_ok=True) # sometimes systemd dir doesn't exist
if SYSTEM == 'Linux':
Expand Down

0 comments on commit 8fbaa66

Please sign in to comment.