Initial commit

This commit is contained in:
AlphaJack 2020-10-03 20:50:37 +02:00
commit ec7bab44e1
6 changed files with 142 additions and 0 deletions

31
.SRCINFO Normal file
View File

@ -0,0 +1,31 @@
pkgbase = librespeed-go
pkgdesc = Very lightweight speed test implemented in Javascript, using XMLHttpRequest and Web Workers.
pkgver = 1.1.1
pkgrel = 1
url = https://github.com/librespeed/speedtest-go
arch = i386
arch = x86_64
arch = aarch64
arch = armv5h
arch = armv6h
arch = armv7h
license = LGPL3
makedepends = go>=1.13
optdepends = mariadb: database
optdepends = postgres: database
conflicts = librespeed-go-bin
backup = etc/librespeed/settings.toml
backup = var/lib/librespeed/speedtest.db
source = https://github.com/librespeed/speedtest-go/archive/v1.1.1.zip
source = librespeed.service
source = librespeed.sysusers
source = librespeed.tmpfiles
source = settings.toml
md5sums = 4534a45a909ca9bb4fe176299dbb0deb
md5sums = 81c7b43b922df27533399746715a5db5
md5sums = 62f7aab9f9607bb9f0f4250f54928c3f
md5sums = 25ec3e5a8b85467863134a68cd3e0e03
md5sums = 0a3ae23c24688169f44931a937df8a85
pkgname = librespeed-go

49
PKGBUILD Normal file
View File

@ -0,0 +1,49 @@
# Maintainer: AlphaJack <alphajack at tuta dot io>
pkgname="librespeed-go"
pkgver=1.1.1
pkgrel=1
pkgdesc="Very lightweight speed test implemented in Javascript, using XMLHttpRequest and Web Workers."
url="https://github.com/librespeed/speedtest-go"
license=("LGPL3")
arch=("i386" "x86_64" "aarch64" "armv5h" "armv6h" "armv7h")
conflicts=("librespeed-go-bin")
makedepends=("go>=1.13")
optdepends=("mariadb: database"
"postgres: database")
source=("https://github.com/librespeed/speedtest-go/archive/v$pkgver.zip"
"librespeed.service"
"librespeed.sysusers"
"librespeed.tmpfiles"
"settings.toml")
md5sums=("4534a45a909ca9bb4fe176299dbb0deb"
"81c7b43b922df27533399746715a5db5"
"62f7aab9f9607bb9f0f4250f54928c3f"
"25ec3e5a8b85467863134a68cd3e0e03"
"0a3ae23c24688169f44931a937df8a85")
backup=("etc/librespeed/settings.toml" "var/lib/librespeed/speedtest.db")
build(){
cd "speedtest-go-$pkgver"
go build -ldflags "-w -s" -trimpath -o "speedtest" "main.go"
}
package(){
install -D -m 644 "librespeed.service" "$pkgdir/usr/lib/systemd/system/librespeed.service"
install -D -m 644 "librespeed.sysusers" "$pkgdir/usr/lib/sysusers.d/librespeed.conf"
install -D -m 644 "librespeed.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/librespeed.conf"
install -D -m 640 "settings.toml" "$pkgdir/etc/librespeed/settings.toml"
cd "speedtest-go-$pkgver"
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"
cp -r "assets" "$pkgdir/usr/share/librespeed"
install -D "speedtest" "$pkgdir/usr/bin/librespeed"
install -d -m 750 "$pkgdir/var/lib/librespeed"
touch "$pkgdir/var/lib/librespeed/speedtest.db"
install -D -m 644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

29
librespeed.service Normal file
View File

@ -0,0 +1,29 @@
[Unit]
Description=Librespeed speed test
After=network.target
[Service]
Type=simple
User=librespeed
Group=librespeed
WorkingDirectory=/usr/share/librespeed/
ExecStart=/usr/bin/librespeed -c /etc/librespeed/settings.toml
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictNamespaces=yes
RestrictRealtime=yes
ReadWritePaths=/var/lib/librespeed
ReadWritePaths=/etc/librespeed/settings.toml
PrivateDevices=yes
ProtectSystem=strict
ProtectHome=true
MemoryDenyWriteExecute=yes
[Install]
WantedBy=multi-user.target

1
librespeed.sysusers Normal file
View File

@ -0,0 +1 @@
u librespeed - "Librespeed user" /var/lib/librespeed

3
librespeed.tmpfiles Normal file
View File

@ -0,0 +1,3 @@
d /var/lib/librespeed 0750 librespeed librespeed
f /etc/librespeed/settings.toml 0640 root librespeed
f /var/lib/librespeed/speedtest.db 0640 librespeed librespeed

29
settings.toml Normal file
View File

@ -0,0 +1,29 @@
# bind address, use empty string to bind to all interfaces
bind_address=""
# backend listen port
listen_port=8989
# proxy protocol port, use 0 to disable
proxyprotocol_port=0
# Server location
server_lat=0
server_lng=0
# ipinfo.io API key, if applicable
ipinfo_api_key=""
# assets directory path, defaults to `assets` in the same directory
assets_path="/usr/share/librespeed/assets"
# password for logging into statistics page
statistics_password="PASSWORD"
# redact IP addresses
redact_ip_addresses=false
# database type for statistics data, currently supports: bolt, mysql, postgresql
database_type="bolt"
database_hostname=""
database_name=""
database_username=""
database_password=""
# if you use `bolt` as database, set database_file to database file location
database_file="/var/lib/librespeed/speedtest.db"