#!/bin/sh

# errors shouldn't cause script to exit
set +e 

# add rserver user account
useradd -r rstudio-server

# create softlink to admin script in /usr/sbin
ln -f -s ${CMAKE_INSTALL_PREFIX}/bin/rstudio-server /usr/sbin/rstudio-server

# write installed indicator then cooperatively suspend active sessions 
# (so they have a chance to get the update)
mkdir -p /etc/rstudio
sh -c "echo `date +%s` > /etc/rstudio/installed"
rstudio-server suspend-all

# add and register init.d script and (re) start the server
cp ${CMAKE_INSTALL_PREFIX}/extras/init.d/redhat/rstudio-server /etc/init.d/
chmod +x /etc/init.d/rstudio-server
chkconfig --add rstudio-server
service rstudio-server stop
service rstudio-server start

# add pam profile
if [ ! -e /etc/pam.d/rstudio ]
then
   cp /etc/pam.d/login /etc/pam.d/rstudio
fi

# clear error termination state
set -e

#!/bin/sh

# errors shouldn't cause script to exit
set +e 

# add rserver user account
useradd -r rstudio-server

# create softlink to admin script in /usr/sbin
ln -f -s ${CMAKE_INSTALL_PREFIX}/bin/rstudio-server /usr/sbin/rstudio-server

# write installed indicator then cooperatively suspend active sessions 
# (so they have a chance to get the update)
mkdir -p /etc/rstudio
sh -c "echo `date +%s` > /etc/rstudio/installed"
rstudio-server suspend-all

# add and register init.d script and (re) start the server
cp ${CMAKE_INSTALL_PREFIX}/extras/init.d/redhat/rstudio-server /etc/init.d/
chmod +x /etc/init.d/rstudio-server
chkconfig --add rstudio-server
service rstudio-server stop
service rstudio-server start

# add pam profile
if [ ! -e /etc/pam.d/rstudio ]
then
   cp ${CMAKE_INSTALL_PREFIX}/extras/pam/redhat/rstudio /etc/pam.d/
fi

# clear error termination state
set -e

Revert "default rstudio pam profile to /etc/pam.d/login"
Revert "default rstudio pam profile to /etc/pam.d/login"

This reverts commit 9013103fd92847456a27954b79e3f11d1b23eb65.
