#!/bin/dash
# Filename:      grml-screen
# Purpose:       wrapper for screen to start with appropriate configuration
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
################################################################################

# export variable USER for use withing GNU screen:
  export USER=`id -un`

# fix tty permissions
  TTY=`tty`
  sudo chmod 660       $TTY
  sudo chown $USER.tty $TTY

# now run screen with config
  cd $HOME     # important for e.g. hardcopy-feature
  # do we have a utf8 enabled terminal?
  [ -x /usr/bin/vt-is-UTF8 ] && /usr/bin/vt-is-UTF8 -q && UTF='-U'
  if [ `id -u` = 0 ] ; then
    exec screen $UTF -c /etc/grml/screenrc
  elif [ -r "$HOME/.screenrc" ] ; then
    exec screen $UTF -c "$HOME/.screenrc"
  else
    exec screen $UTF -c /etc/grml/screenrc_grml
  fi

## END OF FILE #################################################################
