Skip to content

Commit

Permalink
Fixing #73.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Mar 15, 2024
1 parent e02d7e6 commit 95f73dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions leads_vec/_bootloader/leads_vec.service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ then
echo "Error: Config file does not exist"
exit 1
fi
/usr/bin/xhost +SI:localuser:"${USER}"
python3.12 -m leads_vec -c /usr/local/leads/config.json run
4 changes: 1 addition & 3 deletions leads_vec/_bootloader/systemd.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from os import chmod as _chmod, getuid as _getuid
from os.path import abspath as _abspath
from pwd import getpwuid as _getpwuid
from subprocess import run as _run


def create_service() -> None:
_chmod(script := _abspath(__file__)[:-10] + "leads_vec.service.sh", 777)
_run(("/usr/bin/xhost", "+SI:localuser:" + (user := _getpwuid(_getuid()).pw_name)))
with open("/etc/systemd/system/leads_vec.service", "w") as f:
f.write(
"[Unit]\n"
Expand All @@ -15,7 +13,7 @@ def create_service() -> None:
"Requires=display-manager.service\n"
"[Service]\n"
"Type=simple\n"
f"User={user}\n"
f"User={(user := _getpwuid(_getuid()).pw_name)}\n"
"Environment=\"DISPLAY=:0\"\n"
f"Environment=\"XAUTHORITY=/home/{user}/.Xauthority\"\n"
f"ExecStart=/bin/bash {script}\n"
Expand Down

0 comments on commit 95f73dc

Please sign in to comment.