assign-cgroups-git/PKGBUILD
2022-08-01 21:11:02 -07:00

51 lines
1.3 KiB
Bash

# Maintainer: Edward Shen <code@eddie.sh>
pkgname=assign-cgroups
pkgver=0.2.2
pkgrel=1
pkgdesc="Automatic per-GUI-application cgroup assignment"
arch=('i686' 'x86_64')
url="https://github.com/alebastr/sway-systemd"
license=('MIT')
depends=('python' 'python-dbus-next' 'python-i3ipc' 'python-psutil' 'python-xlib')
source=("$pkgname-$pkgver.tar.gz::https://github.com/alebastr/sway-systemd/archive/v$pkgver.tar.gz")
sha512sums=('3fc9bcd07b9480f1b10da27f37c5a54ec4367f4ea6ac79337359bc20a2da07d15c22a8c4ca947efc08443802cfa26108bb37c8aaebca52bdc57cb6c43df21566')
package() {
cd "sway-systemd-$pkgver"
cat > "$pkgname.service" << EOF
[Unit]
Description=Automatic per-GUI-application cgroup assignment
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
ExecStart=/usr/bin/$pkgname.py
Slice=session.slice
NoNewPrivileges=yes
PrivateTmp=yes
DevicePolicy=closed
ProtectSystem=strict
ProtectHome=read-only
ProtectKernelTunables=yes
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
MemoryDenyWriteExecute=yes
LockPersonality=yes
# The following cannot be enabled as we need access to cgroups
# PrivateDevices=yes
# ProtectKernelModules=yes
[Install]
WantedBy=default.target
EOF
install -Dm755 "src/$pkgname.py" -t "$pkgdir/usr/bin"
install -Dm644 "$pkgname.service" -t "$pkgdir/usr/lib/systemd/user"
}