summaryrefslogtreecommitdiff
path: root/extra/freenx/freenx.install
blob: 0f3260166a0b6619170dcae96b793f12c06bb7db (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
post_install() {
  # Make sure the group and user "nx" exists on this system and have the correct values
  if grep -q "^nx:" /etc/group &> /dev/null ; then
    groupmod -g 85 -n nx nx &> /dev/null
  else
    groupadd -g 85 nx &> /dev/null
  fi

  if grep -q "^nx:" /etc/passwd 2> /dev/null ; then
    usermod -s /usr/bin/nxserver -c "NX user" -d /var/lib/nxserver/home/nx -u 85 -g nx nx &> /dev/null
  else
    useradd -s /usr/bin/nxserver -c "NX user" -d /var/lib/nxserver/home/nx -u 85 -g nx -r nx &> /dev/null
  fi 

  # setting up freenx
  echo 'Generating keys ...'
  /usr/lib/nx/bin/nxsetup --install 2>&1 >/dev/null

  echo "ATTENTION FREENX:"
  echo "For correct setup please take a look at the wiki:"
  echo "http://wiki.archlinux.org/index.php/FreeNX"
}

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

  if grep -q "^nx:" /etc/passwd 2> /dev/null ; then
    usermod -s /usr/bin/nxserver -c "NX user" -d /var/lib/nxserver/home/nx -u 85 -g nx nx &> /dev/null
  else
    useradd -s /usr/bin/nxserver -c "NX user" -d /var/lib/nxserver/home/nx -u 85 -g nx -r nx &> /dev/null
  fi

  # setting up freenx
  echo "Rerunning nxsetup ..."
  /usr/lib/nx/bin/nxsetup --install 2>&1 >/dev/null

  if [ "`vercmp $2 0.7.3-10.1`" -lt 0 ]; then
    # important upgrade notice
    echo "*** config file location has been moved ***"
    echo "Please apply your local settings from /opt/NX/etc/node.conf.pacsave"
    echo "into /etc/nxserver/node.conf. A new key set is required."
    echo "Please copy to your clients the new client key:"
    echo "\"/var/lib/nxserver/home/nx/.ssh/client.id_dsa.key\""
    echo "When you have FreeNX server running clean up with \"rm -rf /opt/NX\"."
  fi
}

# arg 1:  the old package version
pre_remove() {
  /usr/lib/nx/bin/nxsetup --uninstall --purge 2>&1 >/dev/null
#  usr/sbin/groupdel nx &>/dev/null
    userdel nx &> /dev/null
    groupdel nx &> /dev/null || /bin/true
}