#!/bin/bash
# This script exists because I'm getting tired of 
# sysadmins who don't care that the standard distribution
# of vnc uses twm, which is a useless destkop.
# Put  a generic xstartup file in $BIRCH/local/admin/xstartup,
# and newuser will automatically add this file to copy
# it to the user's $HOME/.vnc directory, if they don't 
# already have and xstartup file.

STARTUPFILE=$BIRCH/local/admin/xstartup
if [ -f $STARTUPFILE ]; then
   cd $HOME
   if [ ! -d .vnc ] ; then
      echo "Creating $HOME/.vnc directory"
      mkdir .vnc
      chmod 700 .vnc
   fi

   if [ ! -f .vnc/xstartup ]; then
      echo "Creating $HOME/.vnc/xstartup"
      cp -p $STARTUPFILE $HOME/.vnc
      chmod 700 $HOME/.vnc/xstartup
      
      # Oddly, I tried the symbolic link approach, 
      # but on Solaris, the file isn't read by vncserver or Xvnc,
      # so you get a blank desktop. 
      # cd $HOME/.vnc
      # ln -s $STARTUPFILE xstartup
   fi
fi