# Maintainer: AlphaJack pkgname="librespeed-go" pkgver=1.1.5 _commit=abc8ac0a7b933c8c4b58a105337f377deb7fd005 pkgrel=13 pkgdesc="Go backend for LibreSpeed" url="https://github.com/librespeed/speedtest-go" license=("LGPL3") arch=("i386" "x86_64" "aarch64" "armv5h" "armv6h" "armv7h") conflicts=("librespeed-rs") makedepends=("go>=1.16") optdepends=("mariadb: alternative database to bolt" "postgresql: alternative database to bolt") source=("git+https://gitea.balki.me/balki/speedtest-go.git#commit=${_commit}" "librespeed.ico" "librespeed.service" "librespeed.sysusers" "librespeed.tmpfiles") b2sums=('673e24d4fc7dd13074bcf9e9805530a1a0665a2cd91840e8444e26cfb2cbc3e1f2bdc9235526e19c746e503abcd4ba445a0c90f086a2aa9c84330cde105d7218' 'd561280edc2fe3f7228ce3366132bd22e345e7574f21d92e6f188f701642fe98ffab8c8b12e807ad72fea15a6016605d6febd08c3389395828c47767779540bc' '6aa0ca421c7ee5ac2dd58df13c1a42a350186eb5a72bad7f83776b7a291b3032ae84e0789d0fafb8116f4371b73317b6bda476ea3f44f72337b236e7e2514761' 'a7d3d6d4e7adb5b5d45e254fafad7c7180a54c1eec898657cbd8d457e218c746742067d7a024b81e2bf1fefb05a6ce3f7abebbdf233f70c99a34406edf047b6c' 'f89c7cdee011d281dca7726a2b196e768423e8b3c52a1335b04b6740d83d2700acfd1ad248a3e0549a7e0ca8f996db635448be35fdf96889a3d714902ec95aae') backup=("etc/librespeed/settings.toml" "usr/share/librespeed/assets/index.html") prepare(){ cd "speedtest-go" # use arch linux paths sed -i "settings.toml" \ -e 's|^assets_path=.*|assets_path="/usr/share/librespeed/assets"|' \ -e 's|database_file=.*|database_file="/var/lib/librespeed/speedtest.db"|' # remove "Example" from html pages sed -i "web/assets/"*.html \ -e "s|LibreSpeed Example|LibreSpeed Speedtest|g" } build(){ cd "speedtest-go" go build -ldflags "-w -s" -trimpath -o "speedtest" "main.go" } package(){ cd "speedtest-go" # binary file install -D "speedtest" "$pkgdir/usr/bin/librespeed" # configuration install -D -m 640 "settings.toml" "$pkgdir/etc/librespeed/settings.toml" # database install -d -m 750 "$pkgdir/var/lib/librespeed" #touch "$pkgdir/var/lib/librespeed/speedtest.db" # webapp files install -d "$pkgdir/usr/share/librespeed" install -m 644 "database/mysql/telemetry_mysql.sql" "$pkgdir/usr/share/librespeed" install -m 644 "database/postgresql/telemetry_postgresql.sql" "$pkgdir/usr/share/librespeed" # html pages install -D -m 644 "$srcdir/librespeed.ico" "web/assets/favicon.ico" cp -r "web/assets" "$pkgdir/usr/share/librespeed" # systemd files install -D -m 644 "$srcdir/librespeed.service" "$pkgdir/usr/lib/systemd/system/librespeed.service" install -D -m 644 "$srcdir/librespeed.sysusers" "$pkgdir/usr/lib/sysusers.d/librespeed.conf" install -D -m 644 "$srcdir/librespeed.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/librespeed.conf" }