qbit_manage/docs/Nix-Installation.md
bobokun 06abe3cfb0
4.3.0 (#814)
# Breaking Change
- `requirements.txt` is now replaced with `pyproject.toml` meaning that
**local installs** will need to replace their update command `pip
install -r requirements.txt` with `pip install .`
- Those that are running qbit-manage in docker don't need to do anything
and things will continue to work as is

# Requirements Updated
qbittorrent-api==2025.5.0
humanize==4.12.3

# New Updates
- Added user defined stalled_tag. Configurable through config.yml.
(Closes #802 Thanks to @Patchy3767)

## Bug Fixes
- Fixed max_seeding time of 0 for share_limits (Fixes #790 Thanks to
@glau-bd)
- Fixed Upload Limit not reset when LastActive/MinSeedsNotMet (Fixes
#804)
- Fixed Share limits not showing in logs when 0 torrents are in the
group(Fixes #789)
- Fixes bug where it tries to remove root_dir when not using category
(Fixes #777)

**Full Changelog**:
https://github.com/StuffAnThings/qbit_manage/compare/v4.2.2...v4.3.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Actionbot <actions@github.com>
Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Gerald Lau <glau@bitdefender.com>
Co-authored-by: Patchy3767 <birabinowitz+github@gmail.com>
2025-05-10 10:36:02 -04:00

3.1 KiB

*Nix Installation

  • Download the script
wget -O - https://github.com/StuffAnThings/qbit_manage/archive/master.tar.gz | tar xz --strip=1 "qbit_manage-master"
  • Make it executable
chmod +x qbit_manage.py
  • Get & Install Requirements
pip install .
  • Create Config
cd config
cp config.yml.sample config.yml
nano -e config.yml
  • Create the update script
nano qbm-update.sh
  • Paste the below into the update script and update the Paths and Service Name (if using systemd)
#!/usr/bin/env bash
set -e
set -o pipefail

force_update=${1:-false}

# Constants
QBM_PATH="/opt/qbit_manage"
QBM_VENV_PATH="/opt/.venv/qbm-venv"
QBM_SERVICE_NAME="qbmanage"
QBM_UPSTREAM_GIT_REMOTE="origin"
QBM_VERSION_FILE="$QBM_PATH/VERSION"
QBM_REQUIREMENTS_FILE="$QBM_PATH/pyproject.toml"
CURRENT_UID=$(id -un)

# Check if QBM is installed and if the current user owns it
check_qbm_installation() {
    if [ -d "$QBM_PATH" ]; then
        qbm_repo_owner=$(stat --format='%U' "$QBM_PATH")
        qbm_repo_group=$(stat --format='%G' "$QBM_PATH")
        if [ "$qbm_repo_owner" != "$CURRENT_UID" ]; then
            echo "You do not own the QbitManage repo. Please run this script as the user that owns the repo [$qbm_repo_owner]."
            echo "use 'sudo -u $qbm_repo_owner -g $qbm_repo_group /path/to/qbm-update.sh'"
            exit 1
        fi
    else
        echo "QbitManage folder does not exist. Please install QbitManage before running this script."
        exit 1
    fi
}

# Update QBM if necessary
update_qbm() {
    current_branch=$(git -C "$QBM_PATH" rev-parse --abbrev-ref HEAD)
    echo "Current Branch: $current_branch. Checking for updates..."
    git -C "$QBM_PATH" fetch
    if [ "$(git -C "$QBM_PATH" rev-parse HEAD)" = "$(git -C "$QBM_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
        current_version=$(cat "$QBM_VERSION_FILE")
        echo "=== Already up to date $current_version on $current_branch ==="
        exit 0
    fi
    current_requirements=$(sha1sum "$QBM_REQUIREMENTS_FILE" | awk '{print $1}')
    git -C "$QBM_PATH" reset --hard "$QBM_UPSTREAM_GIT_REMOTE/$current_branch"
}

# Update virtual environment if requirements have changed
update_venv() {
    new_requirements=$(sha1sum "$QBM_REQUIREMENTS_FILE" | awk '{print $1}')
    if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
        echo "=== Requirements changed, updating venv ==="
        "$QBM_VENV_PATH/bin/python" -m pip  install --upgrade "$QBM_PATH"
    fi
}

# Restart the QBM service
restart_service() {
    echo "=== Restarting QBM Service ==="
    sudo systemctl restart "$QBM_SERVICE_NAME"
    new_version=$(cat "$QBM_VERSION_FILE")
    echo "=== Updated to $new_version on $current_branch"
}

# Main script execution
check_qbm_installation
update_qbm
update_venv
restart_service
  • Make the update script executable
chmod +x qbm-update.sh
  • Run the update script
./qbm-update.sh