Skip to the content of the web site.

Linux | LogonScript

#!/bin/bash
#ROOTUSER_NAME=root
PATH=/bin:/usr/bin

#username=`id -nu`              # Or...   username=`whoami`
#if [ "$username" = "$ROOTUSER_NAME" ];then
# killall -9 X
# exit 0
#fi

mount |grep /home/$USER>/dev/null
mount_test1=$?
mount |grep /mnt/profile/$USER>/dev/null
mount_test2=$?

#debug
#echo $mount_test1
#echo $mount_test2

#if [ "$mount_test1" != "0" ]; then
#  echo "prepare to exit" #debug
#  killall -9 X
#  exit 0
#fi

#if [ "$mount_test2" != "0" ]; then
#  echo "prepare to exit" #debug
#  killall -9 X
#  exit 0
#fi

(
if [ -d /mnt/profile/$USER/Linux ];then
   echo "10"; sleep 1
   echo "# Copying Profile Settings"
   # rsync, although it conserves bandwidth is unfortunately too slow as it
   # takes too much time making checksums for the files
   #rsync -W --block-size=300 -rpqgo /mnt/profile/$USER/Linux/ /home/$USER
   cd /mnt/profile/$USER/Linux
   cp -f -R -d -u $(/bin/ls -A /mnt/profile/$USER/Linux) /home/$USER
chown $USER.$USER -R /home/$USER
   echo "30"
 else
  mkdir /mnt/profile/$USER/Linux
fi


# we want diskspace to auto start in gnome
if [ ! -e "/home/$USER/.gnome2/session-manual" ]; then
  echo "60"
  cp /etc/X11/gdm/session-manual /home/$USER/.gnome2/
  chown $USER.$USER /home/$USER/.gnome2/session-manual
  chmod 644 /home/$USER/.gnome2/session-manual
  echo "70"
fi
echo "# Finishing login"
echo "80"
echo "90"; sleep 1
echo "100"

) |

zenity --progress --pulsate --auto-close --title="Logging In" --text="Checking Mount Points ..." --percentage=0

if [ "$?" != 0 ] ; then
  zenity --error --text="Profile update cancelled. Please contact your local consulting office for further assistance."
  exit 1
else
  exit 0
fi

I added the last part so that gnome would start the diskspace applet automatically. It's kind of a hack hopefully I can implement something better through gconf. I added a pretty zenity dialog so that the user would no what was happening. Furthermore, I removed the rsync part and replaced it with cp for the same reason I removed it in the logout script.

-- DavidCollie - 24 Sep 2004