Add kodi-standalone-service

This commit is contained in:
Travis Burtrum 2018-12-28 02:33:44 -05:00
parent c6603be969
commit 83607694d2
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Maintainer: graysky <graysky AT archlinux DOT us>
pkgname=kodi-standalone-service
pkgver=1.94
pkgrel=1
pkgdesc="Systemd service to run kodi in stand-alone mode without a DE"
# Do NOT attempt to use this package on Arch ARM! This is only for x86_64.
# You have been warned.
arch=('x86_64')
url="https://github.com/graysky2/kodi-standalone-service"
license=('GPL')
depends=('systemd' 'xorg-server' 'xorg-xinit' 'kodi' 'polkit')
replaces=('xbmc-standalone-service')
install=readme.install
source=("https://github.com/graysky2/$pkgname/archive/v$pkgver.tar.gz")
sha256sums=('c2796a8520fbb366263f38df007e9b292a26870e71b7c166465a18e210a90a96')
package() {
install -Dm644 "$srcdir/$pkgname-$pkgver/init/kodi.service" \
"$pkgdir/usr/lib/systemd/system/kodi.service"
install -dm 700 "$pkgdir"/var/lib/kodi
chown 420:420 "$pkgdir"/var/lib/kodi
}
# vim:set ts=2 sw=2 et:

View File

@ -0,0 +1,42 @@
post_install() {
getent group kodi > /dev/null || groupadd -g 420 kodi
if ! getent passwd kodi > /dev/null; then
useradd -c 'kodi user' -u 420 -g kodi -G audio,video,network,optical \
-d /var/lib/kodi -s /usr/bin/nologin kodi
passwd -l kodi > /dev/null
[[ ! -d /var/lib/kodi/.kodi ]] &&
mkdir /var/lib/kodi/.kodi &&
chown -R kodi:kodi /var/lib/kodi/.kodi
fi
echo "==> Some drivers including Xorg's native modesetting may require the addition"
echo "==> of /etc/X11/Xwrapper.config for X to initialize. If kodi.service fails to"
echo "==> start, create that file containing the following single line:"
echo "==> needs_root_rights = yes"
echo "==> See: https://wiki.archlinux.org/index.php/Xorg#Rootless_Xorg_.28v1.16.29"
}
post_upgrade() {
post_install $1
if ! getent group kodi | cut -d: -f3 | grep 420 > /dev/null 2>&1; then
groupmod -g 420 kodi > /dev/null 2>&1
fi
if ! id -u kodi | grep 420 > /dev/null 2>&1; then
usermod -u 420 kodi > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "==> Changing uid of user kodi failed."
echo "==> It is recommended that the uid is changed."
echo "==> Stop all processes running under the kodi user and reinstall kodi"
echo "==> or change the uid manually. (usermod -u 420 kodi)"
fi
chown -R kodi:kodi /var/lib/kodi
fi
}
post_remove() {
echo "==> Delete the kodi user if you are certain no processes are running under it."
echo "==> userdel kodi"
echo "==> groupdel kodi"
}
# vim:set ts=2 sw=2 et: