summaryrefslogtreecommitdiff
path: root/libre/xbmc-libre-lts/xbmc.install
blob: 48f337c553931e54d45dfd75d24299931ebd1fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
post_install() {
  update_icons
  getent group xbmc > /dev/null || groupadd -g 420 xbmc
  if ! getent passwd xbmc > /dev/null; then
	  useradd -c 'XBMC user' -u 420 -g xbmc -G audio,video,network,optical -d /var/lib/xbmc -s /sbin/nologin xbmc
	  passwd -l xbmc > /dev/null
  fi
}

post_upgrade() {
  post_install $1
  if ! getent group xbmc | cut -d: -f3 | grep 420 > /dev/null 2>&1; then
	  groupmod -g 420 xbmc > /dev/null 2>&1
  fi
  if ! id -u xbmc | grep 420 > /dev/null 2>&1; then
	  usermod -u 420 xbmc > /dev/null 2>&1
	  if [[ $? -ne 0 ]]; then
		  echo "Changing uid of user xbmc failed"
		  echo "It is recommended that the uid is changed."
		  echo "Stop all processes running under the xbmc user and reinstall xbmc"
		  echo "or change the uid manually. (usermod -u 420 xbmc)"
	  fi
	  chown -R xbmc:xbmc /var/lib/xbmc
  fi
}

post_remove() {
  update_icons
  getent passwd xbmc > /dev/null 2>&1 && userdel xbmc
  getent group xbmc > /dev/null 2>&1 && groupdel xbmc
}

update_icons() {
  type -p gtk-update-icon-cache > /dev/null 2>&1 && usr/bin/gtk-update-icon-cache -qtf usr/share/icons/hicolor
  type -p update-desktop-database > /dev/null 2>&1 && usr/bin/update-desktop-database -q usr/share/applications
}