Envy

 view release on metacpan or  search on metacpan

etc/login/profile.part2  view on Meta::CPAN

# can write your own login scripts.  This is just an example.
#---------------------------------------------------------------
HOSTNAME=`hostname`
case `basename $SHELL` in
	ksh) PS1=$HOSTNAME:'$PWD$ '
             PS2='>'
             ENV=$HOME/.shrc
             FPATH=
             CDPATH=
	     export PS1 PS2 ENV FPATH CDPATH
	     ;;
	bash)
	     PS1='\[]2;\h:\W\][\u@\h] \w% '
	     INPUTRC=$ETOP/etc/login/bash.inputrc
	     export INPUTRC
	     export PS1
	     ;;
	zsh) PROMPT='%{]2;%m:%2c%}%U[%n@%m] %2c%#%u ' 
	     HISTSIZE=300
	     DIRSTACKSIZE=30
	     export PROMPT
	     export HISTSIZE
	     export DIRSTACKSIZE
	     ;;
	sh )
esac

#-----------------------------------------------------------------------
# Custom profile
#-----------------------------------------------------------------------
module() {
        eval `envy.pl $*`;
	echo "*** Type 'envy' instead of module ***";
}
envy() { eval `envy.pl $*`; }

ENVY_CONTEXT=site
f=$ETOP/etc/login/profile.site; test -f $f && . $f
ENVY_CONTEXT=custom
f=$HOME/.custom/.profile; test -f $f && . $f
f=$HOME/.custom/profile; test -f $f && . $f
f=$HOME/.shrc; test -f $f && . $f

#-----------------------------------------------------------------------
# X Windows
#-----------------------------------------------------------------------
export LPDEST PRINTER DISPLAY

chname=$HOME/.console.host
prtname=$HOME/.myprinter
stash_hostname() {
  /bin/rm -f $chname $prtname
  echo $HOSTNAME > $chname
  if [ x$LPDEST = x ]; then
    LPDEST=`ypmatch $HOSTNAME default_printer`
    PRINTER=LPDEST
  fi
  echo $LPDEST > $prtname
}

ENVY_CONTEXT=desktop
if [ $tty -eq 1 -a `tty` = '/dev/console' ]; then
  if [ -f /etc/motd ] ; then cat /etc/motd; fi
  stash_hostname

  if [ -f $HOME/.custom/win.name ]; then win=`cat $HOME/.custom/win.name`; fi
  if [ x$win = x ]; then win=fvwm95; fi
  if [ '!' -r $ETOP/etc/desktop/$win ]; then
    echo "Can't read $ETOP/etc/desktop/$win";
    win=fvwm95
  fi
  if [ '!' -r $ETOP/etc/desktop/$win ]; then
    echo "Can't read $ETOP/etc/desktop/$win";
    echo
    echo "Don't know how to start XWindows session"
  else
    . $ETOP/etc/desktop/$win
  fi

elif [ x$DISPLAY$DTUSERSESSION != x ]; then  # Exceed or CDE ?
  stash_hostname;
  envy load openwin;  #try the obvious

else
  # probably login through xterm or somesuch
  if [ -f $chname ]; then
    DISPLAY=`cat $chname`:0.0
  fi
  if [ -f $prtname ]; then
    LPDEST=`cat $prtname`
    PRINTER=$LPDEST
  fi
  echo "You may need to set your DISPLAY and LPDEST.  For example:"
  echo "export DISPLAY=$DISPLAY"
  echo "export LPDEST=$LPDEST"
fi



( run in 1.097 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )