2015-01-01 19:29:56 +01:00
|
|
|
post_install() {
|
2015-01-01 19:31:11 +01:00
|
|
|
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
|
2015-01-01 19:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
post_upgrade() {
|
2015-01-01 19:31:11 +01:00
|
|
|
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
|
2015-01-01 19:29:56 +01:00
|
|
|
|
|
|
|
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
|
2015-01-04 21:27:57 +01:00
|
|
|
|
|
|
|
if [ "$(vercmp $2 1.8-1)" -lt 1 ]; then
|
|
|
|
if [[ -f /etc/X11/Xwrapper.config ]]; then
|
|
|
|
echo '-> It is no longer necessary to keep /etc/X11/Xwrapper.config for kodi to start properly.'
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
/bin/true
|
|
|
|
fi
|
2015-01-01 19:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
post_remove() {
|
2015-01-01 19:31:11 +01:00
|
|
|
getent passwd kodi > /dev/null 2>&1 && userdel kodi
|
|
|
|
getent group kodi > /dev/null 2>&1 && groupdel kodi
|
2015-01-01 19:29:56 +01:00
|
|
|
}
|
|
|
|
|
2015-01-04 01:29:47 +01:00
|
|
|
pre_install() {
|
|
|
|
/usr/bin/systemctl status xbmc.service &>/dev/null
|
|
|
|
if [[ $? -eq 0 ]]; then
|
|
|
|
# xbmc is running via this service
|
|
|
|
/usr/bin/systemctl stop xbmc.service &>/dev/null
|
|
|
|
else
|
|
|
|
/bin/true
|
|
|
|
fi
|
|
|
|
}
|