summaryrefslogtreecommitdiff
path: root/extra/lxdm/lxdm.install
blob: 8d42de90f3b74812f8836d2dcfd3cfec40179548 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pkgname=lxdm

post_install() {
  # make sure the group and user "lxdm" exist on this system and have the correct values
  if grep -q "^lxdm:" /etc/group &> /dev/null ; then
    groupmod -g 121 -n lxdm lxdm &> /dev/null
  else
    groupadd -g 121 lxdm &> /dev/null
  fi

  if grep -q "^lxdm:" /etc/passwd 2> /dev/null ; then
    usermod -s /sbin/nologin -c "LXDE Display Manager user" -d /var/lib/lxdm -u 121 -g lxdm lxdm &> /dev/null
  else
    useradd -s /sbin/nologin -c "LXDE Display Manager user" -d /var/lib/lxdm -u 121 -g lxdm -m -r lxdm &> /dev/null
  fi 
  passwd -l lxdm > /dev/null

#  chown root:lxdm /etc/lxdm/{lxdm.conf,xinitrc} > /dev/null
  chown root:lxdm /etc/lxdm/lxdm.conf > /dev/null
  chown -R root:lxdm /var/lib/lxdm > /dev/null
  chown -R root:lxdm /var/run/lxdm > /dev/null

cat << EOF
>>> To make the LXDM as your default DM,
>>> put, 'lxdm' or '@lxdm' (without quotes) on DAEMONS in /etc/rc.conf
>>>
>>> You can also use /etc/inittab,
>>> just add 'x:5:respawn:/usr/sbin/lxdm >& /dev/null' (without quotes)
>>> in the end of the file /etc/inittab
>>> and uncoment the line on the top 'id:5:initdefault:'.
EOF
}

post_upgrade() {
  # make sure the group and user "lxdm" exist on this system and have the correct values
  if grep -q "^lxdm:" /etc/group &> /dev/null ; then
    groupmod -g 121 -n lxdm lxdm &> /dev/null
  else
    groupadd -g 121 lxdm &> /dev/null
  fi

  if grep -q "^lxdm:" /etc/passwd 2> /dev/null ; then
    usermod -s /sbin/nologin -c "LXDE Display Manager user" -d /var/lib/lxdm -u 121 -g lxdm lxdm &> /dev/null
  else
    useradd -s /sbin/nologin -c "LXDE Display Manager user" -d /var/lib/lxdm -u 121 -g lxdm -m -r lxdm &> /dev/null
  fi 
  passwd -l lxdm > /dev/null

#  chown root:lxdm /etc/lxdm/{lxdm.conf,xinitrc} > /dev/null
  chown root:lxdm /etc/lxdm/lxdm.conf > /dev/null
  chown -R root:lxdm /var/lib/lxdm > /dev/null
  chown -R root:lxdm /var/run/lxdm > /dev/null
}

post_remove() {
  # Removing lxdm group+user
  getent passwd lxdm >/dev/null 2>&1 && userdel lxdm #|| /bin/true
  getent group lxdm >/dev/null 2>&1 && groupdel lxdm #|| /bin/true
}