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 - mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
- rm -rf matemat/usr/bin - rm -rf matemat/usr/bin
- sed -re "s/__VERSION__/${MATEMAT_VERSION}/g" -i PKGBUILD - 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" - mv matemat-${MATEMAT_VERSION}-1-any.pkg.tar.xz "matemat-${MATEMAT_VERSION}+${CI_COMMIT_REF_NAME}-1-any.pkg.tar.xz"
artifacts: artifacts:
paths: paths:

View file

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

View file

@ -1,24 +1,23 @@
post_install() { post_install() {
set -e if ! getent group matemat >/dev/null; then
groupadd --system matemat
if [[ "$1" == "configure" ]]; then
if ! getent group matemat >/dev/null; then
groupadd --system matemat
fi
if ! getent passwd matemat >/dev/null; then
useradd --system --create-home --gid matemat --home-dir /var/lib/matemat --shell /usr/bin/nologin matemat
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 fi
if ! getent passwd matemat >/dev/null; then
useradd --system --create-home --gid matemat --home-dir /var/lib/matemat --shell /usr/bin/nologin matemat
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 {} \;
}
pre_remove() {
systemctl stop matemat.service
userdel matemat
} }

View file

@ -3,8 +3,10 @@ Description=matemat
After=networking.target After=networking.target
[Service] [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 User=matemat
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -3,8 +3,10 @@ Description=matemat
After=networking.target After=networking.target
[Service] [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 User=matemat
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target