3 # Purpose: wrapper for startx on grml [providing new xconfiguration tool]
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 ################################################################################
10 # usage: DEBUG=1 grml-x ..... 2>/tmp/grml-x-debug.log
11 if [[ $DEBUG -gt 0 ]]; then
16 # functions and color {{{
17 # use colors only if not booted with nocolor bootoption
18 if ! grep -q nocolor /proc/cmdline ; then
19 autoload colors ; colors
20 [ -r /etc/grml_colors ] && . /etc/grml_colors
23 # some functions like getBootParam
24 if [ -r /etc/grml/script-functions -a -r /etc/grml/sh-lib ] ; then
25 source /etc/grml/script-functions
26 source /etc/grml/sh-lib
28 echo 'Error: sourcing function files failed. Exiting.'
32 check4root &>/dev/null && ROOT='1' || ROOT=''
38 [ -n "$XINITRC" ] || XINITRC="$HOME/.xinitrc"
41 # make sure we don't leave any temp files {{{
43 [ -n "$1" ] && EXIT="$1" || EXIT="1"
44 print "$bg[black]$fg[red]${bold_color}Exiting...${reset_color}">&2
51 # warn if running as user root {{{
52 if [ -n "$ROOT" ] ; then
53 print "$bg[black]$fg[red]${bold_color}E: Refusing to run as root, please start \"sudo -u grml grml-x $@\" instead${reset_color}"
57 fstabuser=$(grep ':x:1000:' /etc/passwd)
58 fstabuser=${fstabuser%%[:]*}
61 # usage information {{{
64 if [[ $1 != '' ]] ; then echo 1>&2 "\n$1" ; fi
65 print "$bg[black]$fg[red]$bold_color"
68 $PROGRAMNAME windowmanager
72 XINITRC=~/.xinitrc $PROGRAMNAME fluxbox
73 $PROGRAMNAME -display 8 fluxbox
75 More information on grml-x can be found in the manual page: man grml-x
77 print "${reset_color}"
85 if [ "$(readlink /etc/X11/X)" = /bin/true ] ; then
86 print "$bold_color$fg[red]Fatal: /etc/X11/X is a symlink to /bin/true."
87 print "Fix it via running 'ln -sf /usr/bin/Xorg /etc/X11/X'"
90 if [ -z "$NOSTART" ] ; then
92 if [ -x /etc/init.d/xorg-common ] ; then
93 sudo /etc/init.d/xorg-common start
95 if [ -x /etc/init.d/xfree86-common ] ; then
96 sudo /etc/init.d/xfree86-common start
100 if [ -z "$DISPLAY" ] ; then
101 print "$bold_color$fg[green]Now trying to run startx.$reset_color"
102 startx $XINITRC -- $XOPTS
105 print "$bold_color$fg[green]Now trying to run startx on display $DISPLAY.$reset_color"
106 startx $XINITRC -- :$DISPLAY $XOPTS
110 print "$bold_color$fg[blue]Not running startx as requested via option.$reset_color"
119 if [ -z "$ROOT" ] ; then
120 if [[ $(tty) == /dev/pts/* ]] ; then
121 print "It seems you are running $PROGRAMNAME from inside GNU screen.
122 Notice that this might fail if running as user grml!
123 Please exit screen and try to run $PROGRAMNAME again."
126 print "Problems with the module used for X? Try to use grml-x-legacy:
127 $PROGRAMNAME-legacy -module radeon ...
128 $PROGRAMNAME-legacy -module vesa ...
130 Do you want to deactivate a present synaptics touchpad? Run:
131 $PROGRAMNAME-legacy -nosynaptics ...
133 Your monitor is very old and/or does not support DDC-probing?
134 $PROGRAMNAME-legacy -noddc ...
136 Do you want to create a x configuration file but do not start X?
137 $PROGRAMNAME-legacy -nostart ...
139 Monitor frequency too high or too low? Just specify hsync/vsync manually:
140 $PROGRAMNAME-legacy -hsync 30-65 ...
141 $PROGRAMNAME-legacy -hsync 30-65 -vsync 50-60 ...
143 Want to adjust the resolution? Use the mode-switch:
144 $PROGRAMNAME-legacy -mode 1024x768 ...
145 $PROGRAMNAME-legacy -mode '1280x1024 1024x768' ...
147 Problems? Use vesa with resolution 1024x768:
148 $PROGRAMNAME-legacy -module vesa -mode 1024x768 ...
150 Still problems with X? Use the fallback option:
151 $PROGRAMNAME-legacy -fallback ...
153 To adjust resolution while running X execute:
156 More information on grml-x can be found in the manual page: man grml-x
158 Report bugs, send wishes and feedback to the grml team:
159 http://grml.org/bugs/ - contact (at) grml.org
161 print -n "$reset_color"
165 # parameter handling {{{
166 if [ "$#" -ne 1 ] ; then
174 if [ -n "$WINDOWMANAGER" ] ; then
175 if ! [ -x "$(which $WINDOWMANAGER)" ] ; then
176 print "$bg[black]$fg[red]${bold_color}Fatal: windowmanager $fg[blue]$WINDOWMANAGER$fg[red] not executable, startx will not work.${reset_color}">&2
179 if [ -w "$XINITRC" ] ; then
180 sed -i "s|^[^#]*exec.*| exec $WINDOWMANAGER|g" $XINITRC
182 echo -e "#!/bin/sh\n exec $WINDOWMANAGER" >> $XINITRC
188 ## END OF FILE #################################################################
189 # vim:foldmethod=marker expandtab ai ft=zsh sw=2