diff options
author | INhBQfUQO2eFzulN | 2021-09-19 18:00:37 +0300 |
---|---|---|
committer | INhBQfUQO2eFzulN | 2021-09-19 18:00:37 +0300 |
commit | 8badd88a315e08ea98a901cb2c1b3fc629da5d7a (patch) | |
tree | cc08d8786d4bb5949b0cd5b5fa3b7ced6d43f70d | |
download | aur-8badd88a315e08ea98a901cb2c1b3fc629da5d7a.tar.gz |
Created new package
-rw-r--r-- | .SRCINFO | 23 | ||||
-rw-r--r-- | PKGBUILD | 71 | ||||
-rw-r--r-- | teddit.service | 9 | ||||
-rw-r--r-- | teddit.sh | 4 |
4 files changed, 107 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7638b1f131cc --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,23 @@ +pkgbase = teddit-git + pkgdesc = Alternative Reddit front-end focused on privacy + pkgver = r574.9e515c4 + pkgrel = 1 + url = https://codeberg.org/teddit/teddit + arch = any + license = AGPL + makedepends = git + makedepends = npm + makedepends = jq + depends = nodejs + optdepends = redis: works as a cache for Reddit API calls + optdepends = ffmpeg: video support + provides = teddit + conflicts = teddit + source = teddit-git::git+https://codeberg.org/teddit/teddit.git#branch=main + source = teddit.service + source = teddit.sh + sha256sums = SKIP + sha256sums = c66000c97266726382008e6e7a1b99719931ae87dfd0d239d15bb7c99beec7d1 + sha256sums = 4ba3bd09a3967176f24e6f6fd44af1251d5531d344c81a23ddfeb6e355a37ae6 + +pkgname = teddit-git diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..44155b1a75bd --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,71 @@ +# Maintainer: INhBQfUQO2eFzulN <281587887a at protonmail dot ch> + +_pkgname=teddit +pkgname=teddit-git +pkgver=r574.9e515c4 +pkgrel=1 +pkgdesc="Alternative Reddit front-end focused on privacy" +arch=('any') +url="https://codeberg.org/teddit/teddit" +license=('AGPL') +depends=('nodejs') +makedepends=('git' 'npm' 'jq') +optdepends=('redis: works as a cache for Reddit API calls' + 'ffmpeg: video support') +provides=("$_pkgname") +conflicts=("$_pkgname") +source=("$pkgname::git+$url.git#branch=main" + "teddit.service" + "teddit.sh") +sha256sums=('SKIP' + 'c66000c97266726382008e6e7a1b99719931ae87dfd0d239d15bb7c99beec7d1' + '4ba3bd09a3967176f24e6f6fd44af1251d5531d344c81a23ddfeb6e355a37ae6') + +pkgver() { + cd "$pkgname" + ( + set -o pipefail + git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) +} + +build() { + cd "${srcdir}/${pkgname}" + npm install --no-optional +} + +package() { + install -D -m644 teddit.service -t "$pkgdir/usr/lib/systemd/system" + + # Use a wrapper script as an entry point + install -D -m755 teddit.sh "$pkgdir/usr/bin/teddit" + cd "${srcdir}/${pkgname}" + install -d "${pkgdir}/opt/${_pkgname}" + cp -a * "${pkgdir}/opt/${_pkgname}" + cp "${pkgdir}/opt/${_pkgname}/config.js.template" "${pkgdir}/opt/${_pkgname}/config.js" + + # Non-deterministic race in npm gives 777 permissions to random directories. + # See https://github.com/npm/cli/issues/1103 for details. + find "${pkgdir}/usr" -type d -exec chmod 755 {} + + + # npm gives ownership of ALL FILES to build user + # https://bugs.archlinux.org/task/63396 + chown -R root:root "${pkgdir}" + + # Remove references to $pkgdir/$srcdir + find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i "/_where/d" + + local tmppackage="$(mktemp)" + local pkgjson="$pkgdir/opt/$_pkgname/package.json" + jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" >"$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + + find "$pkgdir" -type f -name package.json | while read pkgjson; do + local tmppackage="$(mktemp)" + jq 'del(.man)' "$pkgjson" >"$tmppackage" + mv "$tmppackage" "$pkgjson" + chmod 644 "$pkgjson" + done +} diff --git a/teddit.service b/teddit.service new file mode 100644 index 000000000000..73bbfc48d738 --- /dev/null +++ b/teddit.service @@ -0,0 +1,9 @@ +[Unit] +Description=Teddit Daemon +After=network.service + +[Service] +ExecStart=/usr/bin/teddit + +[Install] +WantedBy=multi-user.target diff --git a/teddit.sh b/teddit.sh new file mode 100644 index 000000000000..fe1a0104dd6e --- /dev/null +++ b/teddit.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd /opt/teddit/ && + exec node app.js |