paws/paws/__main__.py
2020-01-13 04:59:27 -05:00

30 lines
543 B
Python

#!/usr/bin/env python3
import sys
import os
import stat
from os import environ as env
from .routes import main
if 'install' in sys.argv:
from .config import mastodir, logging
script = f'{mastodir}/paws.sh'
start_script = f'''#!/bin/sh
export MASTODIR={mastodir}
(cd MASTODIR && python -m paws)'''
with open(script, 'w') as sh:
sh.write(start_script)
if os.path.isfile(script):
os.chmod(script, 492)
logging.info(f'Startup script saved as {script}')
else:
logging.info(f'Failed to write script as {script}')
else:
main()