I_R=${INSTALL_ROOT}

FREENX_PROGS="nxclient nxnode nxkeygen nxnode-login nxserver nxprint nxsetup nxloadconfig"
FREENX_VARS="NX_DIR NX_HOME_DIR NX_SESS_DIR NX_ETC_DIR"

for var in ${FREENX_VARS}; do
   persistent_add $var
   eval "$(grep ^$var  ${SOURCE_DIRECTORY}/nxloadconfig)" 
done

mkdir  -p   ${I_R}${NX_HOME_DIR}  &&
mkdir  -p   ${I_R}${NX_ETC_DIR}  &&
mkdir  -p   ${I_R}${NX_SESS_DIR}/closed  &&
mkdir  -p   ${I_R}${NX_SESS_DIR}/running  &&
mkdir  -p   ${I_R}${NX_SESS_DIR}/failed  &&
chmod  700  ${I_R}/var/lib/nxserver  \
            ${I_R}/var/lib/nxserver/*  \
            ${I_R}${NX_SESS_DIR}/*  &&

for  i  in  ${FREENX_PROGS};  do
  install -m 755 -g root -o root  ${SOURCE_DIRECTORY}/$i  ${I_R}/usr/bin
done  &&

install -m 755  ${SOURCE_DIRECTORY}/node.conf.sample ${I_R}${NX_ETC_DIR}
