fix: go build module cache permission + README sudo
- Set GOMODCACHE + GOPATH to /opt/receiptnext/.go (writable location) - Removes sudo from README one-liner — script self-elevates - Build now works for users whose home directory isn't writable
This commit is contained in:
parent
b7fddf0069
commit
0ab9f1e1be
2 changed files with 5 additions and 1 deletions
|
|
@ -9,7 +9,7 @@
|
|||
## 🚀 One-Command Install
|
||||
|
||||
```bash
|
||||
sudo bash -c "$(curl -fsSL https://git.lohmar.co.uk/cclohmar/ReceiptNext/raw/branch/main/install.sh)"
|
||||
bash -c "$(curl -fsSL https://git.lohmar.co.uk/cclohmar/ReceiptNext/raw/branch/main/install.sh)"
|
||||
```
|
||||
|
||||
Or from a local clone:
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ esac
|
|||
|
||||
if command -v go &>/dev/null; then
|
||||
info "Building binary from source (pure Go, no CGO)..."
|
||||
# Use a writable module cache — the user's home may not be writable
|
||||
export GOMODCACHE="${INSTALL_DIR}/.go/mod"
|
||||
export GOPATH="${INSTALL_DIR}/.go"
|
||||
mkdir -p "${GOMODCACHE}" 2>/dev/null || sudo_if mkdir -p "${GOMODCACHE}"
|
||||
CGO_ENABLED=0 go build -ldflags="-s -w" -o app .
|
||||
else
|
||||
info "Go not found — downloading pre-built binary..."
|
||||
|
|
|
|||
Loading…
Reference in a new issue