Fritzctl can't be installed

If I try to install fritzctl I got this error:

Erstelle fritzctl...
==> Erstelle Paket: fritzctl 1.4.23-1 (Mi 19 Jul 2023 14:56:44 CEST)
==> Prüfe Laufzeit-Abhängigkeiten...
==> Prüfe Buildtime-Abhängigkeiten...
==> Empfange Quellen...
  -> v1.4.23.tar.gz gefunden
==> Überprüfe source Dateien mit sha256sums...
    v1.4.23.tar.gz ... Erfolg
==> Entferne existierendes $srcdir/ Verzeichnis...
==> Entpacke Quellen...
  -> Entpacke v1.4.23.tar.gz mit bsdtar
==> Beginne prepare()...
==> Entferne existierendes $pkgdir/ Verzeichnis...
==> Beginne build()...
go: cannot find main module, but found Gopkg.lock in /tmp/pamac-build-suther/fritzctl/src/src/github.com/bpicode/fritzctl
	to create a module there, run:
	go mod init
==> FEHLER: Ein Fehler geschah in build().
    Breche ab...

Any Idea how to fix this?

you have to install the package base-devel and the linux-header-files that match your kernel-version before building an app from aur.

I was bored and fixed it.

PKGBUILD
pkgname=fritzctl
pkgver=1.4.23
pkgrel=1
pkgdesc="A lightweight, easy to use console client for the AVM FRITZ!Box Home Automation."
arch=('x86_64')
url="https://github.com/bpicode/fritzctl"
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('63bd37113146bb75b3ba1aff10b9a1fe34e7e8d684ed0b624c97b0cd03e26830')

build() {
  cd "${pkgname}-${pkgver}"
  export GOPATH="$srcdir/gopath"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go mod init "github.com/bpicode/${pkgname}"
  go mod tidy
  make build
  make completion_bash
  make man

  # Clean module cache for makepkg -C
  go clean -modcache
}

package() {
  cd "${pkgname}-${pkgver}"
  install -Dm755 "${pkgname}" -t "$pkgdir/usr/bin/"
  install -Dm644 os/config/fritz.pem -t "${pkgdir}/etc/${pkgname}/"
  install -Dm644 "os/config/${pkgname}.json" -t "${pkgdir}/etc/${pkgname}/"
  install -Dm644 "os/completion/${pkgname}" -t \
    "${pkgdir}/usr/share/bash-completion/completions/"
  install -Dm644 "os/man/${pkgname}.1.gz" -t "${pkgdir}/usr/share/man/man1/"
  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
2 Likes