2 # Filename: grml-quickconfig
3 # Purpose: get fast access to some basic grml-scripts
4 # Authors: Michael Schierl <schierlm-public@gmx.de>, Alexander Wirt <formorer@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Fre Jun 22 23:05:01 CEST 2007 [mika]
8 ################################################################################
10 # menu with quick config options
13 use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
15 # enable alternate charset support (needed for screen)
18 open (my $fh, '/proc/cmdline');
22 my $color = 1 unless $cmdline =~ /nocolor/;
24 # variables for nice display
26 $W = "\e[0;32;1m"; # White
27 $N = "\x0f\e[0m"; # Normal
28 $M = "\e[0;35;1m"; # Magenta (for commands)
29 $B = "\e[0;34;1m\x0e"; # Blue, line drawing characters
35 $HLINE=$B."x".$N; # A single horizontal line drawing character
49 # x and Return are handled manually
74 print "Press a key: ".$M;
75 ReadMode 4; # Turn off controls keys
77 # HACK: this is necessary because startx/Xorg sets the console where it outputs
78 # to non-blocking mode
79 $flags = fcntl(STDIN, F_GETFL, 0) or die "Can't get flags for STDIN: $!\n";
80 $flags = fcntl(STDIN, F_SETFL, $flags & ~O_NONBLOCK) or die "Can't set flags for STDIN: $!\n";
82 while (not defined ($x = ReadKey(0))) {}
83 ReadMode 0; # Reset tty mode before exiting
91 while($command eq "") {
94 ${B}lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk${N}
95 $HLINE Welcome to ${M}grml-quickconfig${M} $HLINE
96 $HLINE Press a highlighted key to perform an action, or press $HLINE
97 $HLINE ${W}Return${N} or ${W}q${N} to go back to the shell. $HLINE
98 ${B}tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu${N}
99 $HLINE Set keyboard layout (${M}grml-lang${N}): ${W}d${N}e ${W}a${N}t ${W}c${N}h ${W}u${N}s $HLINE
100 $HLINE Configure ${W}n${N}etwork (${M}grml-network${N}) $HLINE
101 $HLINE -> Configure ${W}e${N}thernet card directly (${M}netcardconfig${N}) $HLINE
102 ${B}tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu${N}
103 $HLINE Show ${W}i${N}nformation about grml (${M}grml-info${N}) $HLINE
104 $HLINE Start ${W}x${N} (${M}grml-x${N}) $HLINE
105 $HLINE Show an application ${W}m${N}enu (${M}pdmenu${N}) $HLINE
106 $HLINE Install grml to ${W}h${N}ard disk (${M}grml2hd${N}) $HLINE
107 ${B}mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj${N}
113 if (defined($menu_commands{$x})) {
114 $command = $menu_commands{$x};
115 } elsif ($x eq "\n" || $x eq ' ') {
117 } elsif ($x eq "x") {
120 ${B}lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk${N}
121 $HLINE Select a window manager (unsorted list): $HLINE
122 $HLINE Press any other key to return to the main menu. $HLINE
123 ${B}tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu${N}
124 $HLINE ${W}d${N}wm ${W}e${N}vilwm ${W}f${N}luxbox f${W}v${N}wm fvwm${W}2${N} fvwm-${W}c${N}rystal ${W}d${N}wm ${N}$HLINE
125 $HLINE ${W}o${N}penbox pe${W}k${N}wm ${W}p${N}wm3 ${W}t${N}wm ${W}r${N}atpoison w${W}9${N}wm ${W}w${N}indowlab ${N}$HLINE
126 $HLINE wm${W}i${N}i wmi-${W}n${N}g ${N}$HLINE
127 ${B}mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj${N}
133 if (defined($windowmanagers{$x})) {
134 $command = "su - grml -c 'grml-x ".$windowmanagers{$x}."'";
136 print "Unknown key, not bound to a windowmanager.\n";
137 print "Returning to main menu.\n";
140 print "Unknown key.\n";
144 # reenable input buffering
145 system "stty", 'icanon', 'eol', '^@';
147 if ($command eq "exit") {
150 print $W . "Running command: " . $M . $command . $N . $/;
154 print "Happy hacking!\n";
156 ## END OF FILE #################################################################
157 # vim: ai expandtab ft=perl