summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 362492b714f33824b118ec3afde546bbd9883657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Maintainer: Tobias Brox <t-arch@tobixen.no>
pkgname=inventory-md
pkgver=0.4.0
pkgrel=1
pkgdesc="A flexible markdown-based inventory management system"
url="https://github.com/tobixen/inventory-md"
arch=('any')
license=('GPL-3.0-or-later')
depends=('python' 'python-pillow')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-hatchling' 'python-hatch-vcs')
optdepends=(
    'python-fastapi: API server and chat functionality'
    'python-uvicorn: API server'
    'python-anthropic: Claude AI chat integration'
    'python-pyzbar: Barcode scanning'
    'python-easyocr: OCR text extraction'
)
backup=('etc/inventory-system/example.conf')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/tobixen/inventory-md/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('07fce006b1c690f6b8dd0bc014296a2eb7fa109c6f930001ae8c975b66d8a5d0')

build() {
    cd "${pkgname}-${pkgver}"
    export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"
    python -m build --wheel --no-isolation
}

package() {
    cd "${pkgname}-${pkgver}"
    python -m installer --destdir="$pkgdir" dist/*.whl

    # Install systemd service files
    install -Dm644 systemd/inventory-api@.service "$pkgdir/usr/lib/systemd/system/inventory-api@.service"
    install -Dm644 systemd/inventory-web@.service "$pkgdir/usr/lib/systemd/system/inventory-web@.service"

    # Fix ExecStart path for system-wide installation
    sed -i 's|/opt/inventory-md/venv/bin/inventory-md|/usr/bin/inventory-md|g' \
        "$pkgdir/usr/lib/systemd/system/inventory-api@.service" \
        "$pkgdir/usr/lib/systemd/system/inventory-web@.service"

    # Install example configuration
    install -Dm644 /dev/stdin "$pkgdir/etc/inventory-system/example.conf" << 'CONF'
# Inventory System Configuration
# Copy this file to /etc/inventory-system/<instance>.conf
# and adjust the values for your instance.

# Path to inventory directory (containing inventory.md/inventory.json)
INVENTORY_PATH=/var/lib/inventory/myinstance

# API server port
API_PORT=8765

# API server host (use 0.0.0.0 to listen on all interfaces)
API_HOST=127.0.0.1

# Web server port (optional, for static file serving)
WEB_PORT=8080

# Anthropic API key for Claude chat (optional)
#ANTHROPIC_API_KEY=sk-ant-...
CONF
}