backports/thelounge: new aport #389

Merged
ayakael merged 1 commit from thelounge/initial into edge 2024-02-03 18:06:09 +00:00
5 changed files with 133 additions and 0 deletions

View file

@ -0,0 +1,81 @@
# Contributor: Kay Thomas <kaythomas@pm.me>
# Maintainer: Kay Thomas <kaythomas@pm.me>
pkgname=thelounge
pkgver=4.4.1
pkgrel=0
pkgdesc="Modern, responsive, cross-platform, self-hosted web IRC client"
url="https://thelounge.chat"
# x86: textrels
# s390x: fails to check
# riscv64: fails to build
arch="all !x86 !s390x !riscv64"
license="MIT"
depends="nodejs"
makedepends="yarn npm python3"
subpackages="$pkgname-openrc"
pkgusers="thelounge"
pkggroups="thelounge"
install="$pkgname.pre-install $pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/thelounge/thelounge/archive/v$pkgver.tar.gz
no-version-test.patch
thelounge.initd
"
options="net" # npm
prepare() {
default_prepare
yarn install --frozen-lockfile
}
build() {
NODE_ENV=production yarn run build
}
check() {
CI=yes yarn run test:mocha
}
package() {
yarn install --production --ignore-scripts --prefer-offline
NODE_ENV=production npm install --unsafe-perm -g --prefix "$pkgdir"/usr
# Remove incorrect symlink, copy correct files
rm "$pkgdir"/usr/lib/node_modules/thelounge
mkdir -p "$pkgdir"/usr/lib/node_modules/thelounge
cp -a index.js client public node_modules dist package.json "$pkgdir"/usr/lib/node_modules/thelounge/
# cleanup unused files
find "$pkgdir" -type f -a \( \
-name "*.ts" \
-o -name "webpack*" \
-o -name "tsconfig*" \
-o -name "babel.config*" \
-o -name "README*" \
-o -name "CHANGELOG*" \
-o -name "*.map" \
-o -name "LICENSE" \
\) \
-delete
# Set home location
echo /var/lib/thelounge > \
"$pkgdir"/usr/lib/node_modules/$pkgname/.thelounge_home
# Add default config
# this is only read from 'home' so we have to just put everything in var/lib
install -dm755 -o thelounge -g thelounge \
"$pkgdir"/var/lib/thelounge
install -m644 -o thelounge -g thelounge \
"$pkgdir"/usr/lib/node_modules/$pkgname/dist/defaults/config.js \
"$pkgdir"/var/lib/thelounge/config.js
install -Dm755 "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname
}
sha512sums="
7695121a713a23688bc6f52dae2574bab1288eea930fd50d4dd85037233e9f23bd8e460980c69cdd14ea8648da4720d84e8196547b6a18e69d2f478b43d6e29a thelounge-4.4.1.tar.gz
cbf80e23b0af8f0185699d6b03816c645c51b85fff7f163d3cd3d00296ed816b6ab01529b359fbfd549a79e8adb72bbc83bc7a389cf13e0afd50636ff79a138e no-version-test.patch
f367d27ebcc412ff03c12ae98e50aeae5051fb5ffa9da6220f664c59993ed0e330b55b3b41fe941d546634901163d006e318891b4b886f6c49a93e0888fccd3e thelounge.initd
"

View file

@ -0,0 +1,19 @@
diff --git a/test/src/helperTest.ts b/test/src/helperTest.ts
index 2a8ddc8..22f0532 100644
--- a/test/src/helperTest.ts
+++ b/test/src/helperTest.ts
@@ -40,14 +40,6 @@ describe("Helper", function () {
describe("#getVersion()", function () {
const version = Helper.getVersion();
- it("should mention it is served from source code", function () {
- expect(version).to.include("source");
- });
-
- it("should include a short Git SHA", function () {
- expect(version).to.match(/\([0-9a-f]{7,11} /);
- });
-
it("should include a valid semver version", function () {
expect(version).to.match(/v[0-9]+\.[0-9]+\.[0-9]+/);
});

View file

@ -0,0 +1,14 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
name="thelounge"
command="/usr/bin/thelounge"
command_args="start"
command_user="thelounge:thelounge"
command_background=true
pidfile="/run/thelounge.pid"
depend() {
need net localmount
after firewall
}

View file

@ -0,0 +1,13 @@
#!/bin/sh
cat >&2 <<-EOF
*
* The configuration is in /var/lib/thelounge/config.js.
* To add users, use the cli:
* doas -u thelounge thelounge ..
* e.g.
* doas -u thelounge thelounge add myuser
*
EOF
exit 0

View file

@ -0,0 +1,6 @@
#!/bin/sh
addgroup -S thelounge 2>/dev/null
adduser -S -D -H -s /sbin/nologin -G thelounge -g thelounge thelounge 2>/dev/null
exit 0