summaryrefslogtreecommitdiff
path: root/sabutil
blob: 2449033ee924857482a048062e3193c83178e049 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
#!/bin/bash

# Initial version by wolfden.
# Later changes by Enlik <poczta-sn at gazeta.pl>.

# last change: 9.03.2012
# most important changes to last version:
# - abort if non root where needs root permissions
# - fix fdisk -l pasting
# - support for xorg.conf.d
# - reorder options and add rcupdate_pastebin

USER=$(whoami)
HOMEDIR=${HOME:-/tmp}

function menu
{
    local selection=""
    until  [[ "$selection" = "0" ]] ; do
        echo "Current Operating System:"
	cat /etc/kogaion-release
	echo ""
        echo "Current Edition:"
	cat /etc/kogaion-edition
        echo
        echo "Pick a choice from menu below:"

        echo ""
        echo "1 - Backup & edit xorg.conf and xorg.conf.d"
        echo "2 - Restore xorg.conf and xorg.conf.d from backup"
        echo "3 - Regenerate Kogaion xorg.conf"
        echo "4 - Backup & edit grub.cfg"
        echo "5 - Restore grub.cfg from backup"
        echo "----------------------------------------"
        echo "View and AutoPaste:"
        echo " "
        echo "01 - Pastebin Xorg configuration files"
        echo "02 - Pastebin Xorg.0.log"
        echo "03 - Pastebin ~/.xsession-errors"
        echo "04 - Pastebin grub.cfg (bootmanager settings)"
        echo "05 - Pastebin /var/log/dmesg"
        echo "06 - Pastebin system and hardware info"
        echo "07 - Pastebin fdisk -l (list the partition tables)"
        echo "08 - Pastebin rc-update show (show enabled services and the runlevels)"
        echo "09 - Pastebin rc.log"
        echo "10 - Pastebin /var/log/messages"
        echo "11 - Pastebin kdm.log"
        echo ""
        echo "0 - Exit"
        echo ""
        echo -n "Enter selection: "
        read selection
        echo ""

        case $selection in
            1 ) xorg_backup ; press_enter ; xorg_edit; press_enter ;;
            2 ) xorg_restore ; press_enter ;;
            3 ) xorg_regen ; press_enter ;;
            4 ) grub_backup ; press_enter ; nano -w /boot/grub/grub.cfg; press_enter ;;
            5 ) grub_restore ; press_enter ;;
            01 ) xorg_pastebin ; press_enter ;;
            02 ) xorg0log_pastebin ; press_enter ;;
            03 ) xsessionerrors_pastebin ; press_enter ;;
            04 ) grub_pastebin ; press_enter ;;
            05 ) dmesg_pastebin ; press_enter ;;
            06 ) system_pastebin ; press_enter ;;
            07 ) fdisk_pastebin ; press_enter ;;
            08 ) rcupdate_pastebin ; press_enter ;;
            09 ) rclog_pastebin ; press_enter ;;
            10 ) messages_pastebin ; press_enter ;;
            11 ) kdm_pastebin ; press_enter ;;

            0 ) ;;
            * ) echo "Please be sensible - choose a number that exists in the menu"; press_enter
        esac
    done

}

function press_enter
{
    echo ""
    echo -n "Press Enter to continue"
    read
    clear
}

function is_root
{
    if [[ $USER != "root" ]]; then
        echo "You need to be root to do this." >&2
        return 1
    fi
    return 0
}

function xorg_regen
{
    is_root || return

    if [[ ! -f "/etc/X11/xorg.conf.kogaion" ]]; then
        cat > /etc/X11/xorg.conf.kogaion <<EOF
Section "Module"
    SubSection  "extmod"
       Option    "omit xfree86-dga"
    EndSubSection
    Load        "i2c"
    Load        "ddc"
    Load        "synaptics"
    Load        "vbe"
#   Load        "dri"
EndSection


Section "ServerFlags"
     Option     "AllowMouseOpenFail" "true"
EndSection

Section "InputDevice"
    Identifier          "Synaptics1"
    Driver              "synaptics"
    Option              "SendCoreEvents"        "true"
    Option              "Device"                "/dev/psaux"
    Option              "Protocol"              "auto-dev"
    Option              "HorizScrollDelta"      "0"
    Option              "SHMConfig"             "on"
    # For ALPS/MacBook TouchPads
    #Option             "MaxSpeed"              "0.7"
    #Option             "MinSpeed"              "0.18"
    #Option             "AccelFactor"           "0.08"
    #Option             "TopEdge"               "120"
    #Option             "LeftEdge"              "120"
    #Option             "BottomEdge"            "830"
    #Option             "RightEdge"             "650"
    #Option             "FingerLow"             "25"
    #Option             "FingerHigh"            "30"
    # MacBook touchpad
    #Option             "MaxTapTime"            "180"
    #Option             "MaxTapMove"            "220"
    #Option             "MaxDoubleTapTime"      "180"
    #Option             "VertScrollDelta"       "20"
    #Option             "HorizScrollDelta"      "50"
    #Option             "TapButton2"            "3"
    #Option             "TapButton3"            "2"
    #Option             "VertTwoFingerScroll"   "1"

    # Do you keep moving the mouse while typing? Try this trick.
    #synclient TouchpadOff=1 disable your synaptics touchpad
    #synclient TouchpadOff=0 enable your synaptics touchpad
EndSection


# **********************************************************************
# Monitor section
# **********************************************************************

# Any number of monitor sections may be present

Section "Monitor"
    Identifier  "Generic Monitor"
    VertRefresh 43 - 60
    HorizSync   28 - 80
EndSection

# **********************************************************************
# Graphics device section
# **********************************************************************

# Any number of graphics device sections may be present

Section "Device"
    Identifier  "VESA"
    Driver      "vesa" # do not remove vesa
    #Option "RenderAccel" "on"
    #Option "XAANoOffscreenPixmaps"
    #Option "BusType" "PCI"
    #Option "ColorTiling" "on"
    #Option "EnablePageFlip" "on"
    # UseEvents is causing segmentation faults with
    # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers
    #Option "UseEvents" "True"
EndSection


# **********************************************************************
# Screen sections.
# **********************************************************************

Section "Screen"

# The Identifier, Device and Monitor lines must be present

    Identifier  "Screen 1"
    Device      "VESA"
    Monitor     "Generic Monitor"
    #Option "AddARGBGLXVisuals" "true"

# The favoured Depth and/or Bpp may be specified here

    DefaultDepth 24

    SubSection "Display"
        Depth           8
        ViewPort        0 0
        #Modes          "1024x768" "800x600" "640x480"
    EndSubsection

    SubSection "Display"
        Depth           16
        ViewPort        0 0
        #Modes          "1024x768" "800x600" "640x480"
    EndSubsection

    SubSection "Display"
        Depth           24
        ViewPort        0 0
        #Modes          "1024x768" "800x600" "640x480"
    EndSubsection


EndSection


Section "ServerLayout"
# The Identifier line must be present

    Identifier  "Main Layout"
    Screen 0    "Screen 1"
    InputDevice "Mouse1" "CorePointer"
    #InputDevice "Synaptics1" "SendCoreEvents"

EndSection

Section "DRI"
    Mode 0666
EndSection

Section "Extensions"
   #Option "Composite" "Enable"
EndSection
EOF
    fi

    mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.old
    /sbin/gpu-configuration

    echo "Note: you may want to look to /etc/X11/xorg.conf.d (if it exists), too."
}

function xorg_backup
{
    is_root || return

    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
        echo "/etc/X11/xorg.conf.BKUP already exists, so new backup wasn't made - aborting."
        echo "Now off we go to edit the file...."
        return
    elif [[ -e /etc/X11/xorg.conf.d.BKUP ]]; then
        echo "/etc/X11/xorg.conf.d.BKUP backup already exists, so new backup wasn't made - aborting."
        return
    fi

    # Delete backup file. If there's no xorg.conf, no stale xorg.conf.BKUP will be kept.
    # So xorg_restore will not made new (unexpected) xorg.conf from xorg.conf.BKUP.
    rm -f /etc/X11/xorg.conf.BKUP
    if [[ -f /etc/X11/xorg.conf ]]; then
	echo "Making backup of xorg.conf as /etc/X11/xorg.conf.BKUP"
	cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BKUP
    else
	echo "There's no /etc/X11/xorg.conf so it couldn't be backed up."
    fi

    if [[ -e /etc/X11/xorg.conf.d ]]; then
	echo "Making backup of /etc/X11/xorg.conf.d/*"
	if [[ ! -d /etc/X11/xorg.conf.d ]]; then
	    echo "!!!"
	    echo "/etc/X11/xorg.conf.d is not a directory!"
	    return
	fi
        mkdir -p /etc/X11/xorg.conf.d.BKUP
        rm -f /etc/X11/xorg.conf.d.BKUP/* # dotfiles and subdirectories (who keeps them there?!) are left untouched
        cp /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf.d.BKUP/ # and not copied (that's fine)
        echo "/etc/X11/xorg.conf.d/* files are backed up in /etc/X11/xorg.conf.d.BKUP/"
    else
	echo "There's no /etc/X11/xorg.conf.d (directory) so it couldn't be backed up."
    fi

    echo ""
    echo "INTEL graphics users please read the url below before proceding"
    echo ""
    echo "http://gentoo-wiki.com/HOWTO_Intel_Onboard_Graphics_Notebooks_Native_Resolution"
}

function xorg_restore
{
    is_root || return

    echo "Are you sure? This will replace your /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/*.conf."
    echo "[Y/n]"
    local reply
    read reply
    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
        echo "OK, aborting."
        return
    fi

    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
        echo "xorg.conf backup (/etc/X11/xorg.conf.BKUP) exists, whew!"
        cp /etc/X11/xorg.conf.BKUP /etc/X11/xorg.conf
        echo ""
        echo "The original xorg.conf has been restored"
    else
        echo "UH OH!! The backup /etc/X11/xorg.conf.BKUP hasn't been made."
        echo "If you think you need the file, don't panic, you can copy it from the Live DVD/CD."
    fi

    echo ""

    if [[ -d /etc/X11/xorg.conf.d.BKUP ]] \
	&& (shopt -s nullglob; f=(/etc/X11/xorg.conf.d.BKUP/*.conf); [[ ${#f[*]} -ne 0 ]] )
    then
        echo "The backup /etc/X11/xorg.conf.d.BKUP (directory) exists and contails .conf files."
        mkdir -p /etc/X11/xorg.conf.d
	# similar notes as for xorg_backup, but files like .disabled are not removed
        rm -f /etc/X11/xorg.conf.d/*.conf
        cp /etc/X11/xorg.conf.d.BKUP/* /etc/X11/xorg.conf.d/
        echo "Your settings are now restored to /etc/X11/xorg.conf.d/."
    fi
}

function grub_backup
{
    is_root || return

    echo "Note: to modify GRUB configuration, you should edit /etc/default/grub"
    echo " or a file in /etc/grub.d and then run grub-mkconfig -o /boot/grub/grub.cfg"
    echo " (/boot/grub/grub.cfg shouldn't be edited by hand)."
    echo ""

    if [[ -f /boot/grub/grub.cfg.BKUP ]]; then
        echo "grub.cfg backup already exists, so the new one wasn't made."
        echo "Now off we go to edit the file...."
    else
	echo "Making backup of grub.cfg as /boot/grub/grub.cfg.BKUP"
        cp /boot/grub/grub.cfg /boot/grub/grub.cfg.BKUP
        echo ""
    fi
}

function grub_restore
{
    is_root || return

    echo "Are you sure? This will replace your /boot/grub/grub.cfg."
    echo "[Y/n]"
    local reply
    read reply
    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
        echo "OK, aborting."
        return
    fi

    if [[ -f /boot/grub/grub.cfg.BKUP ]]
    then
        echo "grub.cfg backup (/boot/grub/grub.cfg.BKUP) exists, whew!"
        cp /boot/grub/grub.cfg.BKUP /boot/grub/grub.cfg
        echo ""
        echo "The original grub.cfg has been restored"
    else
        echo "UH OH!! The backup script /boot/grub/grub.cfg.BKUP hasn't been made."
        echo "Don't panic, you can use the Kogaion installer to repair GRUB."
    fi
}

function horner
{

# Quick system info gatherer written for Sabayon GNU/Linux and
# adapted for Kogaion and Argent GNU/Linux
#(http://kogaion.ro)
# Copyright 2008 Richard Edward Horner
# Last modified 2008-11-26
# Please send all comments, suggestions, bugs and patches to (rich AT
#richhorner DOT com)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

HOSTNAME=`hostname`
RELEASE=`cat /etc/kogaion-release`
CPU=`uname -p`
KERNEL=`uname -r`
KERN_ARCH=`uname -m`
DISK=`df -lT --exclude-type=tmpfs --exclude-type=rootfs | awk 'BEGIN { total = 0; used = 0 } { if (NR > 1) { total += $3; used += $4 } } END { printf "%.1f/%.1fGB", used / 1000000, total / 1000000 }'`
MEMORY=`cat /proc/meminfo | awk '{ if ($1 == "MemTotal:") { memtot = $2/1000 } else if ($1 == "MemFree:") { memfree = $2/1000 } } END { printf "%d/%dM", memfree, memtot }'`
DAYS=`cat /proc/uptime | awk '{ printf "%.1f", $1/86400 }'`
PROCS=`ps aux | awk 'END { print NR - 2 }'`
RENDERER=`glxinfo | awk -F : '{ if ($1 == "OpenGL renderer string") print $2 }'`

echo "Sysinfo for '$HOSTNAME': $RELEASE with $KERN_ARCH kernel $KERNEL
on $CPU, HD: $DISK, MEM: $MEMORY, Renderer: $RENDERER, $PROCS procs,
up $DAYS days"

}

# echo -e "\a[pastebunz debug ON]" >&2;
# function pastebunz { sed 's/^/[pb] '/ | less; }

# pastebunz seems to have some limit on max pasted lines, so this would be handy...
function files_pastebin_linelimit
{
    # args: limit file_to_pastebin [file_to_pastebin] ...
    # example: file_pastebin_linelimit 30 file1 "file name2" file3
    # first arg: 0 means no limit
    # By Enlik <sn at ubucentrum.net>
    local TMPFILE=~/newbietmp
    local LINESLIMIT
    local LLIMIT_H

    if [[ $# -le 1 ]]; then
        echo "Error: no files to paste (in files_pastebin_linelimit)." >&2
        return 2
    fi

    let LINESLIMIT=$1
    shift
    # If there is a limit of lines, we need to make space for file name and blank
    # lines to be pasted. Otherwise we have as much space as we want.
    if [[ $LINESLIMIT -eq 0 ]]; then
        LLIMIT_H="+1"
    else
        LLIMIT_H=$(( LINESLIMIT - 3 ))
    fi

    >"$TMPFILE" || {
        echo "Oh no! I can't create temporary file... Aborting." >&2
        return 3
    }

    for file in "$@"; do
        echo " --- file: $file ---"
        echo " "
        if [[ -r $file ]]; then
            # This tail guarantees that LAST file name is visible (unless the limit is really small, <= 2 lines)
            # (previous one(s) can be wiped by tail due to limit of lines).
            # The file name is always visible if there's only one specified
            # as argument (unless the limit value is really small, as above).
            # All file names are always visible if there's no limit
            # of lines, or the limit is big enough.
            cat "$file" 2>&1 | tail -n $LLIMIT_H
    elif [[ -e $file ]]; then
	    echo "THIS FILE COULDN'T BE READ."
	else
	    echo "THIS FILE DOESN'T EXIST."
	fi
        echo " "
    done >> "$TMPFILE"
    if [[ $LINESLIMIT -eq 0 ]]; then
        cat "$TMPFILE" | pastebunz
    else
        tail -n $LINESLIMIT "$TMPFILE" | pastebunz
    fi
    echo "** Please see the link above! **"

    rm "$TMPFILE"
    return 0
}

function files_pastebin
{
    files_pastebin_linelimit 0 "$@"
}

function system_pastebin
{
    echo -n "Please wait, it is going to take a while..."
    local PASTE_TMP=/tmp/sabutil-tmp

    >"$PASTE_TMP" || {
	echo "Oh no! I can't create temporary file... Aborting."
        return 1
    }

    echo "
    sh /sbin/logscript.sh
    " >> "$PASTE_TMP"
    sh "/sbin/logscript.sh" >> "$PASTE_TMP"

    cat "$PASTE_TMP"
    cat "$PASTE_TMP" | pastebunz
    echo "*** Please see the link above. ***"
    rm "$PASTE_TMP"
}

function xorg0log_pastebin
{
    tail -n 150 /var/log/Xorg.0.log
    files_pastebin_linelimit 150 /var/log/Xorg.0.log
}

function xsessionerrors_pastebin
{
    cat "$HOMEDIR/.xsession-errors" | tail -n 10
    files_pastebin_linelimit 150 "$HOMEDIR/.xsession-errors"
    if [[ $USER = "root" ]]; then
        echo
        echo "Notice: root's .xsession-errors file has been pasted."
        echo "To get .xsession-errors from your regular account on which"
        echo "you are logged using GDM, KDM or so (which is probably what you want),"
        echo "run this script as that user, not root, or pastebin .xsession-errors"
        echo "from YOUR home directory manually."
        echo
    fi
}

function dmesg_pastebin
{
    cat /var/log/dmesg
    files_pastebin_linelimit 150 /var/log/dmesg
}

function grub_pastebin
{
    cat /boot/grub/grub.cfg
    files_pastebin /boot/grub/grub.cfg
}

function fdisk_pastebin
{
    is_root || return # fdisk -l

    local PASTE_TMP=/tmp/sabutil-tmp

    >"$PASTE_TMP" || {
	echo "Oh no! I can't create temporary file... Aborting."
	return 1
    }

    (
    echo "
    fdisk -l
    ";
    fdisk -l;
    ) > "$PASTE_TMP"

    cat "$PASTE_TMP"
    cat "$PASTE_TMP" | pastebunz
    echo "*** Please see the link above. ***"
    rm "$PASTE_TMP"
}

function messages_pastebin
{
    tail -n 150 /var/log/messages
    files_pastebin_linelimit 150 /var/log/messages
}

function kdm_pastebin
{
    cat /var/log/kdm.log
    files_pastebin_linelimit 150 /var/log/kdm.log
}

function rclog_pastebin
{
    if [[ -f /var/log/rc.log ]]; then
        cat /var/log/rc.log | tail -n 10
        files_pastebin_linelimit 150 /var/log/rc.log
    else
        echo "You Don't Have rc.log enabled in your /etc/rc.log"
        echo " To enable, edit /etc/rc.log change NO to YES for rc_logger= "
        echo ""
    fi
}

function rcupdate_pastebin
{
    local PASTE_TMP=/tmp/sabutil-tmp

    >"$PASTE_TMP" || {
	echo "Oh no! I can't create temporary file... Aborting."
	return 1
    }

    (
    echo "
    rc-update show
    ";
    rc-update show
    ) > "$PASTE_TMP"

    cat "$PASTE_TMP"
    cat "$PASTE_TMP" | pastebunz
    echo "*** Please see the link above. ***"
    rm "$PASTE_TMP"
}

function xorg_pastebin
{
    echo "These files will be pasted (don't worry if any of them don't exist):"
    ls -l /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*
    files_pastebin /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf
}

function xorg_edit
{
    is_root &> /dev/null || echo "You are not root. You will only be able to view files."

    local xorgfiles=() file
    if (shopt -s nullglob; f=(/etc/X11/xorg.conf.d/*.conf); [[ ${#f[*]} -ne 0 ]] ); then
	xorgfiles=( /etc/X11/xorg.conf.d/* ) # let's put all non-dot files; warning for non-conf is below
    fi

    if [[ -f /etc/X11/xorg.conf ]]; then
            xorgfiles+=( /etc/X11/xorg.conf )
    fi

    if [[ ${#xorgfiles[*]} -eq 0 ]]; then
        echo "I can't find any Xorg configuration files."
        echo "There's no /etc/X11/xorg.conf or .conf files in /etc/X11/xorg.conf.d/ directory."
        echo "Xorg uses autodected settings."
    else
        echo "These files affect your Xorg configuration."
        echo "See http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d for more informations."
        echo "Select a file to edit or type q and press Enter to quit."
        select file in "${xorgfiles[@]}"; do
            if [[ -n $file ]]; then
            # Not sure about files that don't start with a number and a hyphen - are they used?
                if [[ ${file##*.} != "conf" ]]; then
                    echo "Warning: this file has no .conf suffix and thus will be ignored by Xorg."
                    press_enter
                fi
                nano -w "$file"
                echo "Select a file to edit or type q and press Enter to quit."
            elif [[ $REPLY = "q" || $REPLY = "Q" ]]; then
                break
            fi
        done
    fi
}

clear

if [[ $1 = "menu" ]]; then
    if [[ $EUID -ne 0 ]]; then
        echo "This script should be run as root, or by someone in the root group. Some commands will not work for you." 1>&2
	echo ""
    fi
    menu
elif [[ $1 = "--help" || $1 = "-h" ]]; then
    echo "usage:"
    echo "$0 - will print some basic system infos"
    echo "$0 menu - will show you menu"
else
    horner
    echo ""
    echo "Specify --help or -h to get help."
 fi