summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Poulin2019-01-27 22:59:29 -0500
committerGitHub2019-01-27 22:59:29 -0500
commit2ede2652216938af25ab5103719866048ae2bb91 (patch)
tree77d1c71337ebc175cd7d5f7488d9f2cfd2328fa9
parent52b1d519f8afd84aa8e9dfc8214b737013b0a231 (diff)
parent15df7cb810d9d58c32aaefcb47f64feba1b55892 (diff)
downloadaur-2ede2652216938af25ab5103719866048ae2bb91.tar.gz
Merge pull request #9 from brunnre8/master
Remove install file and harden sytemd unit a bit
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD68
-rw-r--r--install10
-rw-r--r--system.service3
-rw-r--r--sysusers.d1
-rw-r--r--tmpfiles.d5
6 files changed, 55 insertions, 53 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 42d6c665b51..d3758ef81b4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,21 +1,24 @@
pkgbase = thelounge
- pkgdesc = Web-based IRC client - Official community fork of Shout
- pkgver = 2.7.1
+ pkgdesc = Modern self-hosted web IRC client
+ pkgver = 3.0.0
pkgrel = 1
- url = https://thelounge.github.io/
- install = install
+ url = https://thelounge.chat/
arch = any
license = MIT
makedepends = npm
depends = nodejs
- noextract = thelounge-2.7.1.tgz
+ noextract = thelounge-3.0.0.tgz
backup = etc/thelounge/config.js
- source = http://registry.npmjs.org/thelounge/-/thelounge-2.7.1.tgz
+ source = https://registry.npmjs.org/thelounge/-/thelounge-3.0.0.tgz
source = system.service
source = user.service
- sha256sums = 4b4970caba850042244798008afd334dd2ddd7e25339c864837ce11ba4703021
- sha256sums = SKIP
- sha256sums = SKIP
+ source = sysusers.d
+ source = tmpfiles.d
+ sha256sums = 33786d3f8f8c4906da8cf484642d63d678561a40ed0d0628d0f34bcb5b6f124e
+ sha256sums = c92210f6ac8f01c1cd01b6b26793094cd2feea583ed21fab3564d6bcafdc7a20
+ sha256sums = 055f7e05e9e2528474526ceea864502112e27024c89c997b26ddace86c24dbc6
+ sha256sums = 30fab63b8a4ffcfdda4c5b8d7c66822a323c4f1de6ca62b77fe9500f4befc0a5
+ sha256sums = 4060efc92346c7193e699ffe1b802d85dc45daa7b5260ecdf70a6b993c30b01a
pkgname = thelounge
diff --git a/PKGBUILD b/PKGBUILD
index fbae2035248..a4747236f91 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,46 +1,48 @@
# Maintainer: Maxime Poulin <maxpoulin64@gmail.com>
-pkgname='thelounge'
-_npmname='thelounge'
-pkgver=2.7.1
+# Contributor: Reto Brunner <brunnre8@gmail.com>
+pkgname=thelounge
+pkgver=3.0.0
pkgrel=1
-pkgdesc="Modern self-hosted web IRC client"
+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'
+ "https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz"
+ 'system.service'
+ 'user.service'
+ 'sysusers.d'
+ 'tmpfiles.d'
)
+noextract=("$pkgname-$pkgver.tgz")
+sha256sums=('33786d3f8f8c4906da8cf484642d63d678561a40ed0d0628d0f34bcb5b6f124e'
+ 'c92210f6ac8f01c1cd01b6b26793094cd2feea583ed21fab3564d6bcafdc7a20'
+ '055f7e05e9e2528474526ceea864502112e27024c89c997b26ddace86c24dbc6'
+ '30fab63b8a4ffcfdda4c5b8d7c66822a323c4f1de6ca62b77fe9500f4befc0a5'
+ '4060efc92346c7193e699ffe1b802d85dc45daa7b5260ecdf70a6b993c30b01a')
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 /etc/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 '{}' +
}
diff --git a/install b/install
deleted file mode 100644
index b6ac4f39e6c..00000000000
--- a/install
+++ /dev/null
@@ -1,10 +0,0 @@
-post_install() {
- groupadd thelounge &>/dev/null
- useradd -g thelounge -d /etc/thelounge -s /bin/false thelounge &> /dev/null
- chown -R thelounge:thelounge /etc/thelounge &> /dev/null
-}
-
-pre_remove() {
- getent passwd thelounge &>/dev/null && userdel thelounge &> /dev/null
-}
-
diff --git a/system.service b/system.service
index 7332d3563e7..82017182aa9 100644
--- a/system.service
+++ b/system.service
@@ -8,7 +8,8 @@ Group=thelounge
Type=simple
Environment=THELOUNGE_HOME=/etc/thelounge
ExecStart=/usr/bin/thelounge start
-ProtectSystem=yes
+ProtectSystem=strict
+ReadWritePaths=/etc/thelounge
ProtectHome=yes
NoNewPrivileges=yes
PrivateTmp=yes
diff --git a/sysusers.d b/sysusers.d
new file mode 100644
index 00000000000..91491df15cc
--- /dev/null
+++ b/sysusers.d
@@ -0,0 +1 @@
+u thelounge - "thelounge" /etc/thelounge
diff --git a/tmpfiles.d b/tmpfiles.d
new file mode 100644
index 00000000000..39bab2147da
--- /dev/null
+++ b/tmpfiles.d
@@ -0,0 +1,5 @@
+#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