diff --git a/README.md b/README.md index bbab389..84b8e78 100644 --- a/README.md +++ b/README.md @@ -4,31 +4,31 @@ An experimental [Hikari](https://www.hikari-py.dev) Discord bot for reverse imag [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B1AUB66) ## Prerequisites -A Unix-based operating system is used for the following commands\ +Linux is used for the following commands\ [WSL](https://docs.microsoft.com/en-us/windows/wsl) can be used to run Linux on Windows, but is not required to run the bot ## Requirements [Git](https://git-scm.com/downloads)\ [Python](https://www.python.org) 3.10+\ [Poetry](https://python-poetry.org/docs/master) ## Installing -Clone this repository +1. Clone repository ``` git clone https://github.com/Myned/Modufur.git ``` -Go to the project folder +2. Go to project folder ``` cd Modufur ``` -Create a virtual environment and install dependencies +3. Create a virtual environment and install dependencies ``` poetry install ``` ## Usage -Go to the project folder +1. Go to project folder ``` cd Modufur ``` -Run with optimizations +2. Run with optimizations ``` poetry run python -OO run.py ``` @@ -44,25 +44,57 @@ activity = "" # bot status saucenao = "" # saucenao token e621 = "" # e621 token ``` -## Updating -Go to the project folder +### systemd service +Run in the background on most Linux machines\ +This assumes that the project folder is located at `~/.git/Modufur`\ +Change the `WorkingDirectory` path in `modufur.service` if this is not the case +1. Go to project folder ``` cd Modufur ``` -Pull changes from the repository +2. Copy user service file +``` +cp modufur.service ~/.config/systemd/user +``` +3. Reload user daemon +``` +systemctl --user daemon-reload +``` +4. Start and enable service on login +``` +systemctl --user enable --now modufur +``` +5. Enable lingering to start user services on boot +``` +sudo loginctl enable-linger username +``` +## Updating +1. Go to project folder +``` +cd Modufur +``` +2. Pull changes from repository ``` git pull ``` -Remove the virtual environment folder (necessary because of git dependencies) -``` -rm -rf .venv -``` -Reinstall and update the virtual environment +3. Update virtual environment ``` poetry update ``` ## Uninstalling -Remove the project folder +1. Stop and disable systemd user service +``` +systemctl --user disable --now modufur +``` +2. Remove systemd user service file +``` +rm ~/.config/systemd/user/modufur.service +``` +3. Optionally disable lingering +``` +sudo loginctl disable-linger username +``` +4. Remove project folder ``` rm -rf Modufur ```