summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Fontenelle2019-06-16 18:06:24 -0300
committerRafael Fontenelle2019-06-16 18:07:12 -0300
commit9005036fe45de73662f067c0bac4ea0b87348438 (patch)
tree7d2fda612e9f151478cb44564842bb053f1af0af
parent1acacb0a9fe1fdea9afd2d68d10ff5f78a6c44d4 (diff)
downloadaur-9005036fe45de73662f067c0bac4ea0b87348438.tar.gz
Add DDNet Server systemd service, drop desktop
Instead of creating a .desktop file for the DDNet-Server executable, use a systemd unit file which runs the server instance as a user called "ddnet" and the service's data in "/var/lib/ddnet". ddnet-sysusers.conf is responsible for creating the user and group if they don't exist. It won't remove them upon package removal though, but one can use 'userdel ddnet' for that. ddnet-tmpfiles.conf is responsible for creating /var/lib/ddnet with the user and group newly created by sysusers.d config file. There will be stored autoexec_server.log, a "records" directory and any other persistent data. When starting the systemd unit file "ddnet-server.service", it runs the DDNet-Server executable with work directory "/var/lib/ddnet" as user "ddnet", which allows to store the persistent files in there. As a consequence of this change, "imagemagick" and "gendesk" are no longer needed for creating .png icon and .desktop files, so they were removed from makedepends array. .gitignore now includes *.conf and *.service to the exception list
-rw-r--r--.SRCINFO10
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD57
-rw-r--r--ddnet-server.service13
-rw-r--r--ddnet-sysusers.conf2
-rw-r--r--ddnet-tmpfiles.conf2
6 files changed, 39 insertions, 47 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a3e6636a0a92..127450208075 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = ddnet
pkgdesc = A Teeworlds modification with a unique cooperative gameplay.
pkgver = 12.5
- pkgrel = 2
+ pkgrel = 3
url = https://ddnet.tw
arch = x86_64
license = custom:BSD
@@ -10,8 +10,6 @@ pkgbase = ddnet
makedepends = cmake
makedepends = ninja
makedepends = python
- makedepends = imagemagick
- makedepends = gendesk
depends = sdl2
depends = freetype2
depends = opusfile
@@ -23,7 +21,13 @@ pkgbase = ddnet
optdepends = ddnet-skins: A collection with more than 700 custom tee skins.
optdepends = ddnet-maps-git: All the maps used on the official DDNet Servers.
source = https://ddnet.tw/downloads/DDNet-12.5.tar.xz
+ source = ddnet-server.service
+ source = ddnet-sysusers.conf
+ source = ddnet-tmpfiles.conf
sha256sums = d407c024e082142d26198370b7b53f9e09cb3ba9d291272c8717d2c98d750874
+ sha256sums = 9377a9d7c87abae166c8fa98cd79a61c74482f80f80bc930ae043349e9a84965
+ sha256sums = 70034f237270b38bf312238a26cfd322e212ca5714bfea4ae91e80c639ce8738
+ sha256sums = 043452f4de3c86d903973009bb3e59b3492a6669b86d0b1410e59a1476a87369
pkgname = ddnet
diff --git a/.gitignore b/.gitignore
index 1aace9926737..ddfe915b4f92 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,8 @@
!*.desktop
!*.png
!LICENSE
+!*.service
+!*.conf
# ... except files from PKGBUILD fields
!*.changelog
diff --git a/PKGBUILD b/PKGBUILD
index 35688064fa89..9271ef55c857 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,18 +3,22 @@
pkgname=ddnet
pkgver=12.5
-pkgrel=2
+pkgrel=3
pkgdesc="A Teeworlds modification with a unique cooperative gameplay."
arch=('x86_64')
url="https://ddnet.tw"
license=('custom:BSD' 'CCPL:by-nc-sa')
depends=('sdl2' 'freetype2' 'opusfile' 'curl' 'glew' 'wavpack' 'libwebsockets' 'pnglite')
-makedepends=('cmake' 'ninja' 'python' 'imagemagick' 'gendesk')
+makedepends=('cmake' 'ninja' 'python')
checkdepends=('gtest')
optdepends=('ddnet-skins: A collection with more than 700 custom tee skins.'
'ddnet-maps-git: All the maps used on the official DDNet Servers.')
-source=("https://ddnet.tw/downloads/DDNet-$pkgver.tar.xz")
-sha256sums=('d407c024e082142d26198370b7b53f9e09cb3ba9d291272c8717d2c98d750874')
+source=("https://ddnet.tw/downloads/DDNet-$pkgver.tar.xz"
+ "ddnet-server.service" "ddnet-sysusers.conf" "ddnet-tmpfiles.conf")
+sha256sums=('d407c024e082142d26198370b7b53f9e09cb3ba9d291272c8717d2c98d750874'
+ '9377a9d7c87abae166c8fa98cd79a61c74482f80f80bc930ae043349e9a84965'
+ '70034f237270b38bf312238a26cfd322e212ca5714bfea4ae91e80c639ce8738'
+ '043452f4de3c86d903973009bb3e59b3492a6669b86d0b1410e59a1476a87369')
# Set 1 to enable MySQL support and add dependencies
_enable_mysql=0
@@ -25,34 +29,8 @@ if [ $_enable_mysql -eq 1 ]; then
_mysql_opt="-DMYSQL=ON"
fi
-prepare() {
- [ -d build ] && rm -rf build; mkdir build
- [ -d prep ] && rm -rf prep; mkdir prep
- cd prep
-
- # Extract icons in .png from .ico (name must be lowercase)
- convert ../DDNet-$pkgver/other/icons/DDNet-Server.ico ddnet-server.png
-
- # Generate the server .desktop file
- gendesk --pkgname="DDNet-Server" --name="DDNet Server" \
- --pkgdesc="DDNet Server" --terminal=true \
- --icon="ddnet-server" --categories="Game;ArcadeGame" \
- --exec='sh -c "cd /usr/share/ddnet/data && DDNet-Server"'
-
- # Create icon files' structure, for installing in package(). How:
- # For each png file, check its dimensions (e.g. 128 x 128) using
- # the output of 'file' command. Then double-check the 's' as a
- # number, then install it into a "size/filename.png" notation
- for f in ddnet-server-?.png; do
- s=$(file $f | cut -d' ' -f5)
- if [ ! -z "${s##*[!0-9]*}" ]; then
- install -Dm644 $f ${s}x${s}/apps/${f/-[0-9]/}
- rm $f
- fi
- done
-}
-
build() {
+ [ -d build ] && rm -rf build; mkdir build
cd build
cmake ../DDNet-$pkgver \
-DCMAKE_BUILD_TYPE=Release \
@@ -70,17 +48,8 @@ check() {
package() {
DESTDIR="$pkgdir" ninja install -C build
-
- # Install desktop files and folder
- install -dvm755 "$pkgdir/usr/share/applications/"
- install -vm644 prep/DDNet-Server.desktop "$pkgdir/usr/share/applications/"
-
- # Install icon files and folders
- for f in $(find prep -type f -name '*.png'); do
- install -Dvm644 $f "$pkgdir/usr/share/icons/hicolor"/${f/prep\/}
- done
-
- # Install license file
- install -dm755 "$pkgdir/usr/share/licenses/$pkgname/"
- install -vm644 DDNet-$pkgver/license.txt "$pkgdir/usr/share/licenses/$pkgname/"
+ install -vDm644 DDNet-$pkgver/license.txt "$pkgdir/usr/share/licenses/$pkgname/license.txt"
+ install -vDm644 ddnet-server.service "$pkgdir/usr/lib/systemd/system/ddnet-server.service"
+ install -vDm644 "$srcdir/ddnet-sysusers.conf" "$pkgdir/usr/lib/sysusers.d/ddnet.conf"
+ install -vDm644 "$srcdir/ddnet-tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/ddnet.conf"
}
diff --git a/ddnet-server.service b/ddnet-server.service
new file mode 100644
index 000000000000..452fea2d4c9e
--- /dev/null
+++ b/ddnet-server.service
@@ -0,0 +1,13 @@
+[Unit]
+Description = DDNet Server
+After = network-online.target
+Wants = network-online.target
+
+[Service]
+ExecStart = /usr/bin/DDNet-Server
+WorkingDirectory = /var/lib/ddnet
+User = ddnet
+Group = ddnet
+
+[Install]
+WantedBy = multi-user.target
diff --git a/ddnet-sysusers.conf b/ddnet-sysusers.conf
new file mode 100644
index 000000000000..9d1ff5249d7d
--- /dev/null
+++ b/ddnet-sysusers.conf
@@ -0,0 +1,2 @@
+#Type Name ID GECOS Home directory Shell
+u ddnet - "DDNet user" /var/lib/ddnet
diff --git a/ddnet-tmpfiles.conf b/ddnet-tmpfiles.conf
new file mode 100644
index 000000000000..861bf8a37c86
--- /dev/null
+++ b/ddnet-tmpfiles.conf
@@ -0,0 +1,2 @@
+#Type Path Mode User Group Age Argument
+d /var/lib/ddnet 0755 ddnet ddnet