Add documentation for building antidrift into single executable.

This commit is contained in:
2022-07-23 13:19:14 -04:00
parent 2e4856f0e5
commit f255fcffee
2 changed files with 25 additions and 3 deletions

View File

@@ -2,6 +2,28 @@
Utilize your computer purposefully. Utilize your computer purposefully.
## Make executable and install
```
pip install pyinstaller --user
pyinstaller --onefile antidrift.py
sudo cp dist/antidrift /usr/bin
```
## Dependencies
- dbus-python
- glib
## Create sudoers configuration
Create a file `antidrift` in `/etc/sudoers.d`. This allows antidrift to run
itself with sudo ultimately making it unkillable from the regular user.
```
user hostname = (root) NOPASSWD: /usr/bin/antidrift
```
## Autostart with systemd ## Autostart with systemd
- Create `~/.config/systemd/user/antidrift.service` - Create `~/.config/systemd/user/antidrift.service`
@@ -13,7 +35,7 @@ Utilize your computer purposefully.
Description=AntiDrift Description=AntiDrift
[Service] [Service]
ExecStart=/home/felixm/dot/bin/antidrift ExecStart=antidrift
[Install] [Install]
WantedBy=default.target WantedBy=default.target
@@ -28,7 +50,7 @@ Add the following content to the file.
``` ```
[Desktop Entry] [Desktop Entry]
Name=AntiDrift Name=AntiDrift
Exec=/home/felixm/dot/bin/antidrift Exec=antidrift
Terminal=false Terminal=false
Type=Application Type=Application
StartupNotify=false StartupNotify=false

View File

@@ -61,7 +61,7 @@ def main() -> None:
if newpid == 0: if newpid == 0:
main_daemon(config) main_daemon(config)
else: else:
cmd = ["sudo", "/home/felixm/dot/bin/antidrift"] cmd = ["sudo", "antidrift"]
subprocess.Popen(cmd) subprocess.Popen(cmd)
elif len(sys.argv) == 2 and sys.argv[1] == '--daemon_user': elif len(sys.argv) == 2 and sys.argv[1] == '--daemon_user':
main_daemon(config) main_daemon(config)