Fixed system integration (especially systemd + capabilities.

This commit is contained in:
s3lph 2018-10-19 23:48:36 +02:00
parent 94841da875
commit eb6c2b3f65
5 changed files with 32 additions and 23 deletions

View file

@ -93,7 +93,7 @@ build_archlinux:
- mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
- rm -rf matemat/usr/bin
- sed -re "s/__VERSION__/${MATEMAT_VERSION}/g" -i PKGBUILD
- sudo -u nobody makepkg
- sudo -u nobody makepkg -c
- mv matemat-${MATEMAT_VERSION}-1-any.pkg.tar.xz "matemat-${MATEMAT_VERSION}+${CI_COMMIT_REF_NAME}-1-any.pkg.tar.xz"
artifacts:
paths:

View file

@ -2,7 +2,7 @@
# Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
pkgname=matemat
pkgver=__VERSION__
pkgver=0.1
pkgrel=1
arch=('any')
@ -18,6 +18,12 @@ depends=(
'file'
)
backup=(
'etc/matemat.conf'
)
install=$pkgname.install
pkgdir=matemat/
package() {
cp -r ../matemat/* ../pkg/matemat/
}

View file

@ -1,10 +1,6 @@
post_install() {
set -e
if [[ "$1" == "configure" ]]; then
if ! getent group matemat >/dev/null; then
groupadd --system matemat
fi
@ -14,11 +10,14 @@ post_install() {
fi
chown matemat:matemat -R /var/lib/matemat
find /var/lib/matemat -type d -exec chmod 0750 {}
find /var/lib/matemat -type f -exec chmod 0640 {}
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/matemat
fi
find /var/lib/matemat -type d -exec chmod 0750 {} \;
find /var/lib/matemat -type f -exec chmod 0640 {} \;
}
pre_remove() {
systemctl stop matemat.service
userdel matemat
}

View file

@ -3,8 +3,10 @@ Description=matemat
After=networking.target
[Service]
Exec=/usr/lib/matemat/matemat /etc/matemat.conf /usr/lib/matemat/matemat.conf
ExecStart=/usr/bin/python -m matemat /etc/matemat.conf /usr/lib/matemat/matemat.conf
User=matemat
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target

View file

@ -3,8 +3,10 @@ Description=matemat
After=networking.target
[Service]
Exec=/usr/lib/matemat/matemat /etc/matemat.conf /usr/lib/matemat/matemat.conf
ExecStart=/usr/bin/python3 -m matemat /etc/matemat.conf /usr/lib/matemat/matemat.conf
User=matemat
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target