Bug#173357: Dexconf hacked with detect
Package: xserver-common
Version: 4.2.1-4
Hi,
This version only needs one debconf question for monitor size.
Rob.
#!/bin/sh
# /usr/local/sbin/easygui
# Adapted from Dexconf: Debian X Configurator
# Licensed under the GNU GPL, version 2 or (at your option) any later version.
#
DEXCONFTMPDIR="/tmp/gui-tmp-$$"
rm -rf $DEXCONFTMPDIR
mkdir -p $DEXCONFTMPDIR
cat > $DEXCONFTMPDIR/Header << SECTION
# XF86Config-4 (XFree86 server configuration file)
# Edit this file with caution, and see the XF86Config manual page.
# (Type "man XF86Config" at the shell prompt.)
SECTION
### SERVERFLAGS
cat > $DEXCONFTMPDIR/ServerFlags << SECTION
Section "ServerFlags"
EndSection
SECTION
### SERVERLAYOUT
cat > $DEXCONFTMPDIR/ServerLayout << SECTION
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
SECTION
printf "EndSection\n" >> $DEXCONFTMPDIR/ServerLayout
### FILES
cat > $DEXCONFTMPDIR/Files << SECTION
Section "Files"
FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/Speedo"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
EndSection
SECTION
### MODULE
cat > $DEXCONFTMPDIR/Module << SECTION
Section "Module"
Load "ddc"
Load "GLcore"
Load "dbe"
Load "dri"
Load "extmod"
Load "glx"
Load "record"
Load "xie"
Load "bitmap"
Load "freetype"
Load "speedo"
Load "type1"
Load "vbe"
Load "int10"
EndSection
SECTION
### KEYBOARD / INPUTDEVICE
# pc101 keyboard is rare, think it will work with pc104
cat > $DEXCONFTMPDIR/InputDeviceKeyboard << SECTION
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
EndSection
SECTION
### MOUSE / INPUTDEVICE
# This assumes that these statements are in modules.conf
# alias char-major-13 input
# above input mousedev hid usb-uhci
# Would need to test for arch first, as usb-uhci is only Intel
rm /dev/mouse;
/sbin/modprobe input;
if ((`dmesg | grep input | grep -c 'Mouse'` > 0));
then ln -s /dev/input/mice /dev/mouse;
MOUSE_PORT="/dev/input/mice";
MOUSE_PROTOCOL="ImPS/2";
else ln -s /dev/psaux /dev/mouse;
MOUSE_PORT="/dev/psaux";
MOUSE_PROTOCOL="PS/2";
fi
printf "Section \"InputDevice\"\n" > $DEXCONFTMPDIR/InputDeviceMouse
printf "\tIdentifier\t\"Configured Mouse\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
printf "\tDriver\t\t\"mouse\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
printf "\tOption\t\t\"CorePointer\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
printf "\tOption\t\t\"Device\"\t\t\"$MOUSE_PORT\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
printf "\tOption\t\t\"Protocol\"\t\t\"$MOUSE_PROTOCOL\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
printf "\tOption\t\t\"Emulate3Buttons\"\t\"true\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
case $MOUSE_PROTOCOL in
ImPS*) printf "\tOption\t\t\"ZAxisMapping\"\t\t\"4 5\"\n" >> $DEXCONFTMPDIR/InputDeviceMouse
esac
printf "EndSection\n" >> $DEXCONFTMPDIR/InputDeviceMouse
### DEVICE
# For the other drivers, need to know what video card appears
# in the cat /proc/pci output. Only nvidia has been tested.
case `cat /proc/pci | grep VGA` in
nvidia) DEVICE_DRIVER=nv;;
radeon|ati) DEVICE_DRIVER=ati;;
matrox) DEVICE_DRIVER=mga;;
voodoo) DEVICE_DRIVER=tdfx;;
*) echo
echo "Found this video card "
cat /proc/pci | grep 'VGA'
echo
echo "Some examples - video card=video driver, nvidia=nv"
echo "alliance=apm, matrox=mga, number nine=i128, voodoo=tdfx"
echo
echo "Available video drivers:"
echo "apm, ark, ati, chips, cirrus, cyrix, glint, i128, i740, i810"
echo "imstt, mga, neomagic, nv, rendition, s3virge, savage"
echo "siliconmotion, sis, tdfx, tga, trident, tseng, vga"
echo
read -p 'Enter video driver to use: ' DEVICE_DRIVER
echo;;
esac
printf "Section \"Device\"\n" > $DEXCONFTMPDIR/Device
printf "\tIdentifier\t\"Default Device\"\n" >> $DEXCONFTMPDIR/Device
printf "\tDriver\t\t\"$DEVICE_DRIVER\"\n" >> $DEXCONFTMPDIR/Device
printf "EndSection\n" >> $DEXCONFTMPDIR/Device
### MONITOR
# On i386 use read-edid, else ask debconf question
# Only 14" has been tested, got other ranges from debconf database
echo
read -p 'Enter your monitor size in inches [14/15/17/19]: ' MON_SIZE
echo
case $MON_SIZE in
14) HSYNC="32.0 - 64.0"; VSYNC="50.0 - 100.0";;
15) HSYNC="30.0 - 65.0"; VSYNC="50.0 - 100.0";;
17) HSYNC="31.0 - 70.0"; VSYNC="50.0 - 100.0";;
19) HSYNC="30.0 - 96.0"; VSYNC="50.0 - 140.0";;
*) HSYNC="32.0 - 64.0"; VSYNC="50.0 - 100.0";;
esac
printf "Section \"Monitor\"\n" > $DEXCONFTMPDIR/Monitor
printf "\tIdentifier\t\"Default Monitor\"\n">> $DEXCONFTMPDIR/Monitor
printf "\tHorizSync\t$HSYNC\n" >> $DEXCONFTMPDIR/Monitor
printf "\tVertRefresh\t$VSYNC\n" >> $DEXCONFTMPDIR/Monitor
printf "\tOption\t\t\"DPMS\"\n" >> $DEXCONFTMPDIR/Monitor
printf "EndSection\n" >> $DEXCONFTMPDIR/Monitor
### SCREEN
printf "Section \"Screen\"\n" > $DEXCONFTMPDIR/Screen
printf "\tIdentifier\t\"Default Screen\"\n" >> $DEXCONFTMPDIR/Screen
printf "\tDevice\t\t\"Default Device\"\n" >> $DEXCONFTMPDIR/Screen
printf "\tMonitor\t\t\"Default Monitor\"\n" >> $DEXCONFTMPDIR/Screen
printf "\tDefaultDepth\t16\n" >> $DEXCONFTMPDIR/Screen
for DEPTH in 8 15 16 24; do
printf "\tSubSection \"Display\"\n" >> $DEXCONFTMPDIR/Screen
printf "\t\tDepth\t\t$DEPTH\n" >> $DEXCONFTMPDIR/Screen
printf "\t\tModes\t\t\"800x600\" \"640x480\" \"1024x768\"\n" >> $DEXCONFTMPDIR/Screen
printf "\tEndSubSection\n" >> $DEXCONFTMPDIR/Screen
done
printf "EndSection\n" >> $DEXCONFTMPDIR/Screen
### DRI
cat > $DEXCONFTMPDIR/DRI << SECTION
Section "DRI"
Mode 0666
EndSection
SECTION
# all done, spit it out
rm -f /etc/X11/XF86Config-4
for SECTION in Header Files ServerFlags ServerLayout Module InputDeviceKeyboard InputDeviceMouse Device Monitor Screen DRI; do
cat $DEXCONFTMPDIR/$SECTION >> /etc/X11/XF86Config-4
printf "\n" >> /etc/X11/XF86Config-4
done
printf "# end of XF86Config\n" >> /etc/X11/XF86Config-4
rm -r $DEXCONFTMPDIR
exit 0
Reply to: