added formal PKGBUILD and postinstall scripts

This commit is contained in:
graysky 2015-01-01 13:29:56 -05:00
parent bcde5236e4
commit dc2127c06c
2 changed files with 76 additions and 0 deletions

29
PKGBUILD Normal file
View File

@ -0,0 +1,29 @@
# Maintainer: graysky <graysky AT archlinux DOT us>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# Contributor: [vEX] <niechift.dot.vex.at.gmail.dot.com>
# Contributor: Zeqadious <zeqadious.at.gmail.dot.com>
# Contributor: BlackIkeEagle < ike DOT devolder AT gmail DOT com >
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
# Contributor: Maxime Gauduin <alucryd@gmail.com>
pkgname=kodi-standalone-service
pkgver=1.5
pkgrel=2
pkgdesc="Systemd service and user to autostart kodi at boot"
arch=('any')
url="https://wiki.archlinux.org/index.php/Xbmc#Autostarting_at_boot"
license=('GPL')
depends=('systemd' 'xorg-server' 'xorg-xinit' 'kodi')
replaces=('xbmc-standalone-service')
install=readme.install
source=("https://github.com/graysky2/$pkgname/archive/v$pkgver.tar.gz")
sha256sums=('10d3077b99d9a2511c3fc38e3ce73436d9de05c765ea4c9c44ca7b8bcd607f85')
package() {
install -Dm644 "$srcdir/$pkgname-$pkgver/init/kodi.service" "$pkgdir/usr/lib/systemd/system/kodi.service"
install -Dm755 "$srcdir/$pkgname-$pkgver/common/kodi-standalone2" "$pkgdir/usr/bin/kodi-standalone2"
install -dm 700 "$pkgdir"/var/lib/kodi
chown 420:420 "$pkgdir"/var/lib/kodi
}

47
readme.install Normal file
View File

@ -0,0 +1,47 @@
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
}
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
if [[ -d /var/lib/xbmc ]]; then
echo "If you are upgrading from xbmc->kodi and wish to keep your"
echo "settings, simply follow these steps after the install:"
echo
echo "cp -a /var/lib/xbmc/.xbmc/* /var/lib/kodi/.kodi"
echo "chown -R kodi:kodi /var/lib/kodi"
fi
}
post_remove() {
getent passwd kodi > /dev/null 2>&1 && userdel kodi
getent group kodi > /dev/null 2>&1 && groupdel kodi
}
post_message() {
echo "Users of Xorg >=1.16 wishing to autostart kodi standalone"
echo "must create or modify /etc/X11/Xwrapper.config to contain"
echo "the following 2 lines:"
echo
echo "allowed_users = anybody"
echo "needs_root_rights = yes"
}