post_install() {
  useradd -r -d /opt/NX/home/nx -s /usr/lib/neatx/nxserver-login-wrapper nx &> /dev/null
  mkdir -p ~nx/.ssh
  cp /usr/share/neatx/authorized_keys.nomachine ~nx/.ssh/authorized_keys
  chmod 600 ~nx/.ssh/authorized_keys
  chown -R nx ~nx
  post_remove
}

pre_remove() {
  rm -rf ~nx
}

post_remove() {
  sed  -e '/\/opt\/NX\/lib/d' -i etc/ld.so.conf
  ldconfig
}
