# Borg 2.0.0b5 One-File Build (Variante B: **ohne** FUSE/mount)

Diese Variante erzeugt ein **kleineres Binary**, das alle Borg-Funktionen außer `mount` unterstützt. Build-Host: **Debian Bookworm**. Ziel: **Debian Trixie**.

## Voraussetzungen (Bookworm)

```bash
sudo apt update
sudo apt install -y git python3-venv python3-dev build-essential pkg-config \
  libssl-dev libxxhash-dev liblz4-dev libzstd-dev libacl1-dev \
  liblzma-dev libb2-dev ca-certificates
```

## Build per Skript

```bash
chmod +x build-nofuse.sh
./build-nofuse.sh
```

Ergebnis: `/opt/borg2-b5-build/dist/borg2-b5`

## Manuell (Kurzfassung)

```bash
python3 -m venv /opt/borg2-b5-build
source /opt/borg2-b5-build/bin/activate
python -m pip install -U "pip<25" "setuptools<70" wheel "Cython==0.29.36" pkgconfig "setuptools-scm<8"

cd /opt
git clone --depth 1 --branch 2.0.0b5 https://github.com/borgbackup/borg.git borg-b5-src

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig
export BORG_CYTHONIZE=1
export BORG_OPENSSL_PREFIX=/usr
export BORG_LIBXXHASH_PREFIX=/usr
export BORG_LIBLZ4_PREFIX=/usr
export BORG_LIBZSTD_PREFIX=/usr
export BORG_LIBB2_PREFIX=/usr
export BORG_LIBLZMA_PREFIX=/usr
export BORG_LIBACL_PREFIX=/usr

cd /opt/borg-b5-src
python -m pip install --no-build-isolation --no-cache-dir .

cd /
python - <<'PY'
import borg, sys, inspect
print("borg", borg.__version__, "python", sys.version.split()[0])
print("from:", inspect.getsourcefile(borg) or borg.__file__)
PY

cat > /opt/borg2-b5-build/borg2_entry.py <<'EOF'
import os, sys, types
os.environ.setdefault("BORG_SELFTEST", "disabled")
m = types.ModuleType("borg.selftest")
def _selftest(*a, **kw): return 0
m.selftest = _selftest
sys.modules["borg.selftest"] = m
ver = types.ModuleType("borg._version")
ver.version = "2.0.0b5"
sys.modules["borg._version"] = ver
import borg.archiver as A
if __name__ == "__main__":
    A.main()
EOF

python -m pip install "pyinstaller>=6,<7"
cd /opt/borg2-b5-build
python -m PyInstaller -F -n borg2-b5 -c borg2_entry.py \
  --collect-data borg --collect-binaries borg \
  --exclude-module borg.testsuite \
  --hidden-import=packaging.version --hidden-import=packaging.specifiers \
  --clean -y

./dist/borg2-b5 --version
```

## Deployment (Trixie)

```bash
scp /opt/borg2-b5-build/dist/borg2-b5 root@trixie:/usr/local/bin/
ssh root@trixie 'chmod +x /usr/local/bin/borg2-b5 && borg2-b5 --version'
```

## Nutzung (Beispiele)

```bash
export BORG_REMOTE_PATH=borg2
borg2-b5 rlist  ssh://borg@backup-server/srv/borg-repos/deb12
borg2-b5 create --stats \
  ssh://borg@backup-server/srv/borg-repos/deb12::'{now:%Y-%m-%d_%H%M%S}' \
  /etc /var/www
```

## Unterschiede zu Variante A (mit FUSE)

- Kein `pyfuse3` installiert, keine `--collect-all pyfuse3` im Build.
- `borg mount` ist **nicht** verfügbar.
- Binary ist kleiner, Build schneller.
