79e71df201008c32155336af19b76b71f4486691
[grml-scripts.git] / usr_bin / grml-screen
1 #!/bin/dash
2 # Filename:      grml-screen
3 # Purpose:       wrapper for screen to start with appropriate configuration
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 # export variable USER for use withing GNU screen:
10   export USER=`id -un`
11
12 # fix tty permissions
13   TTY=`tty`
14   sudo chmod 660       $TTY
15   sudo chown $USER.tty $TTY
16
17 # now run screen with config
18   cd $HOME     # important for e.g. hardcopy-feature
19   # do we have a utf8 enabled terminal?
20   [ -x /usr/bin/vt-is-UTF8 ] && /usr/bin/vt-is-UTF8 -q && UTF='-U'
21   if [ `id -u` = 0 ] ; then
22     exec screen $UTF -c /etc/grml/screenrc
23   elif [ -r "$HOME/.screenrc" ] ; then
24     exec screen $UTF -c "$HOME/.screenrc"
25   else
26     exec screen $UTF -c /etc/grml/screenrc_grml
27   fi
28
29 ## END OF FILE #################################################################