Skip to content

Commit

Permalink
Remove install file and split config/data dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
brunnre8 committed Dec 25, 2018
1 parent 1c9c989 commit c4f5490
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 52 deletions.
17 changes: 10 additions & 7 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
pkgbase = thelounge
pkgdesc = Web-based IRC client - Official community fork of Shout
pkgdesc = Modern self-hosted web IRC client
pkgver = 2.7.1
pkgrel = 1
url = https://thelounge.github.io/
install = install
pkgrel = 2
url = https://thelounge.chat/
arch = any
license = MIT
makedepends = npm
Expand All @@ -13,9 +12,13 @@ pkgbase = thelounge
source = http://registry.npmjs.org/thelounge/-/thelounge-2.7.1.tgz
source = system.service
source = user.service
sha256sums = 4b4970caba850042244798008afd334dd2ddd7e25339c864837ce11ba4703021
sha256sums = SKIP
sha256sums = SKIP
source = sysusers.d
source = tmpfiles.d
md5sums = f2be61e721cc677fb624687cf1e8944c
md5sums = e52c5db8dece96c773718b402e4679ad
md5sums = 7493ff3e6bb98daae42b26bf97173ed3
md5sums = bf9da927d1432ec00a8dc0b7183745fc
md5sums = 456c3d6d70aa33da967f79d215621dba

pkgname = thelounge

68 changes: 35 additions & 33 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
# Maintainer: Maxime Poulin <[email protected]>
pkgname='thelounge'
_npmname='thelounge'
# Contributor: Reto Brunner <[email protected]>
pkgname=thelounge
pkgver=2.7.1
pkgrel=1
pkgdesc="Modern self-hosted web IRC client"
pkgrel=2
pkgdesc='Modern self-hosted web IRC client'
url='https://thelounge.chat/'
arch=('any')
license=('MIT')
depends=('nodejs')
makedepends=('npm')
install=install
backup=('etc/thelounge/config.js')
source=(
"https://registry.npmjs.org/$_npmname/-/$_npmname-$pkgver.tgz"
"system.service"
"user.service"
)
noextract=("$_npmname-$pkgver.tgz")
sha256sums=(
'4b4970caba850042244798008afd334dd2ddd7e25339c864837ce11ba4703021'
'SKIP'
'SKIP'
"http://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz"
'system.service'
'user.service'
'sysusers.d'
'tmpfiles.d'
)
noextract=("$pkgname-$pkgver.tgz")
md5sums=('f2be61e721cc677fb624687cf1e8944c'
'e52c5db8dece96c773718b402e4679ad'
'7493ff3e6bb98daae42b26bf97173ed3'
'bf9da927d1432ec00a8dc0b7183745fc'
'456c3d6d70aa33da967f79d215621dba')

package() {
local _etc="$pkgdir/etc/$pkgname"
export NODE_ENV=production

npm install -g --prefix "$pkgdir/usr" "$srcdir/$_npmname-$pkgver.tgz"

echo "/etc/thelounge" > "$pkgdir/usr/lib/node_modules/$_npmname/.thelounge_home"

install -dm700 "$_etc" "$_etc/users"
install -Dm600 \
"$pkgdir/usr/lib/node_modules/$_npmname/defaults/config.js" \
"$_etc/config.js"

install -Dm644 "$srcdir/system.service" \
"$pkgdir/usr/lib/systemd/system/$pkgname.service"
install -Dm644 "$srcdir/user.service" \
"$pkgdir/usr/lib/systemd/user/$pkgname.service"

grep -FRlZ "$startdir" "$pkgdir" | \
xargs -0 -- sed -i "s|$startdir|/tmp/build|g"
export NODE_ENV=production

npm install -g --user root --prefix "$pkgdir/usr" "$pkgname-$pkgver.tgz" --cache "${srcdir}/npm-cache"

echo /var/lib/thelounge > "$pkgdir/usr/lib/node_modules/$pkgname/.thelounge_home"

# add default config
install -Dm 644 "$pkgdir/usr/lib/node_modules/$pkgname/defaults/config.js" "$pkgdir/etc/thelounge/config.js"

# services
install -Dm644 "$srcdir/system.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
install -Dm644 "$srcdir/user.service" "$pkgdir/usr/lib/systemd/user/$pkgname.service"

# setting up system user
install -Dm644 "${srcdir}/sysusers.d" "${pkgdir}/usr/lib/sysusers.d/thelounge.conf"
install -Dm644 "${srcdir}/tmpfiles.d" "${pkgdir}/usr/lib/tmpfiles.d/thelounge.conf"

# Non-deterministic race in npm gives 777 permissions to random directories.
# See https://github.com/npm/npm/issues/9359 for details.
find "$pkgdir/usr" -type d -exec chmod 755 '{}' +
}
10 changes: 0 additions & 10 deletions install

This file was deleted.

5 changes: 3 additions & 2 deletions system.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ After=network.target
User=thelounge
Group=thelounge
Type=simple
Environment=THELOUNGE_HOME=/etc/thelounge
Environment=THELOUNGE_HOME=/var/lib/thelounge
ExecStart=/usr/bin/thelounge start
ProtectSystem=yes
ProtectSystem=strict
ReadWritePaths=/etc/thelounge /var/lib/thelounge
ProtectHome=yes
NoNewPrivileges=yes
PrivateTmp=yes
Expand Down
1 change: 1 addition & 0 deletions sysusers.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
u thelounge - "thelounge" /etc/thelounge
8 changes: 8 additions & 0 deletions tmpfiles.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Type Path Mode UID GID Age Argument
d /etc/thelounge 0755 thelounge thelounge
d /etc/thelounge/users 0755 thelounge thelounge
z "/etc/thelounge/users/*" 0640 thelounge thelounge
z /etc/thelounge/config.js - thelounge thelounge
d /var/lib/thelounge 0755 thelounge thelounge
L /var/lib/thelounge/users - thelounge thelounge - /etc/thelounge/users
L /var/lib/thelounge/config.js - thelounge thelounge - /etc/thelounge/config.js

0 comments on commit c4f5490

Please sign in to comment.