X Strike Force XFree86 SVN commit: r1953 - branches/debconf-overhaul/debian
Author: branden
Date: 2004-10-13 12:39:17 -0500 (Wed, 13 Oct 2004)
New Revision: 1953
Modified:
branches/debconf-overhaul/debian/xserver-xfree86.config.in
branches/debconf-overhaul/debian/xserver-xfree86.templates
Log:
Revert unrelated changes that got mixed in with the merge in r1952.
Modified: branches/debconf-overhaul/debian/xserver-xfree86.config.in
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.config.in 2004-10-13 17:32:42 UTC (rev 1952)
+++ branches/debconf-overhaul/debian/xserver-xfree86.config.in 2004-10-13 17:39:17 UTC (rev 1953)
@@ -26,16 +26,8 @@
CONFIG_LOG="/var/log/$THIS_PACKAGE.config.log"
-# Declare global variables unique to this script here. They can be (and often
-# are) re-initialized to empty values upon first use for clarity.
-UPGRADING=
-PRECONFIGURED=
-DO_DETECT_DISPLAY_HARDWARE=
-DETECTED_DISPLAY=
+AUTODETECT_VIDEO_CARD=
DEFAULT_MODES=
-PRIORITY=
-PRIORITY_CEILING=
-SKIP_XFREE86_X_SERVER_CONFIG=
NCARDS=0
NSERVERS=0
NDRIVERS=0
@@ -64,22 +56,20 @@
observe "$*"
}
-detect_display_adapter () {
- # syntax: detect_display_adapter
+discover_video () {
+ # syntax: discover_video
#
# This is a wrapper for the discover command that can distinguish Discover 1.x
- # and 2.x. It uses Discover to determine which X server (and XFree86 X server
- # driver, if applicable) to use for the detected display adapter. It returns
- # output in the following format:
+ # and 2.x. It returns output in the following format:
# vendor+model server driver
# For example:
# ATI Radeon 9000 XFree86 ati
# A tab character separates each field.
- local cmd detected_display discover_errorfile discover_test driver_file func \
+ local cmd discovered_video discover_errorfile discover_test driver_file func \
server_file vendor_model_file
- func="detect_display_adapter"
+ func="discover_video"
# Validate function arguments.
if [ -n "$*" ]; then
@@ -109,14 +99,14 @@
--data-version=${SOURCE_VERSION%-*} display"
eval $cmd >>$driver_file || debug_report_status "$CMD" "$?"
- detected_display=$(paste $vendor_model_file $server_file $driver_file)
+ discovered_video=$(paste $vendor_model_file $server_file $driver_file)
rm -f $vendor_model_file $server_file $driver_file
else
# must be Discover 1.x
- detected_display=$(discover --disable=serial,parallel \
+ discovered_video=$(discover --disable=serial,parallel \
--format="%V %M\t%S\t%D\n" video 2>/dev/null)
fi
- echo "$detected_display"
+ echo "$discovered_video"
else
warn "$func(): cannot use discover; failed with error message:" \
"$(cat "$discover_errorfile")"
@@ -439,17 +429,22 @@
set +e
trace "$func(): running \"$input_command $priority $template\" with default" \
"\"$default_answer\""
-
- db_get "$template"
- trace "$func(): existing value of $template answer is \"$RET\""
-
- # Are we supposed to clobber the existing answer with our default?
- if [ -n "$CLOBBER_DEFAULT" ]; then
- trace "$func(): setting value of $template to \"$default_answer\""
- db_set "$template" "$default_answer"
+ # are we re-configuring?
+ if [ -n "$RECONFIGURE" ]; then
+ # yes, we are reconfiguring
+ db_get "$template"
+ trace "$func(): (reconfiguring) preserving existing answer \"$RET\""
+ else
+ # not reconfiguring; has the question been seen before?
+ db_fget "$template" seen
+ if [ "$RET" = "true" ]; then
+ db_get "$template"
+ trace "$func(): (not reconfiguring) preserving existing answer \"$RET\""
+ else
+ trace "$func(): auto-answering with \"$default_answer\""
+ db_set $template "$default_answer"
+ fi
fi
-
- # Enqueue the question.
"$input_command" "$priority" "$template"
if [ $? -eq 30 ]; then
trace "$func(): not asking $template per exit status of $input_command"
@@ -543,18 +538,16 @@
esac
}
-configure_default_x_server () {
- # syntax: configure_default_x_server
+select_default_x_server () {
+ # syntax: select_default_x_server
#
# Ask debconf questions that determine the destination of the default X server
# symbolic link.
- #
- # Returns status 1 if the configuration file has been locally modified.
- local bailout choices default_x_server_package display_server_report func \
- line owners
+ local bailout choices default_x_server_package func owners \
+ videocard_server_report
- func="configure_default_x_server"
+ func="select_default_x_server"
# Validate function arguments.
if [ -n "$*" ]; then
@@ -616,7 +609,7 @@
if [ "$owners" != "$choices" ]; then
trace "$func(): \$owners does not equal \$choices: \"$owners\" != " \
"\"$choices\""
- db_subst shared/default-x-server choices "$owners"
+ db_subst shared/default-x-server choices $owners
db_fset shared/default-x-server seen false
fi
@@ -625,71 +618,79 @@
"will not be asked"
fi
- # Set a failsafe default answer for shared/default-x-server.
+ # set a failsafe default answer for shared/default-x-server
default_x_server_package="$THIS_PACKAGE"
- if [ "$DO_DETECT_DISPLAY_HARDWARE" = "true" ]; then
- if [ $NSERVERS -eq 0 ]; then
- trace "$func(): could not detect X server: no display adapter detected," \
- "or no server known for it"
- set_db_priority "high"
- run db_input "$PRIORITY" shared/no_known_x-server
- db_go
- elif [ $NSERVERS -eq 1 ]; then
- trace "$func(): detected X server: $SERVERS"
- if [ "$SERVERS" = "${THIS_SERVER##*/}" ]; then
- # The detected X server is the only one on the system, and the one we're
- # currently configuring; it's unlikely the user will want to use
- # something else.
- set_db_priority "low"
+ # if configuring for the first time, ask if user wants to autodetect
+ if [ -z "$RECONFIGURE" ]; then
+ if which discover >/dev/null 2>&1; then
+ set_db_priority "medium"
+ auto_answer db_input "$PRIORITY" \
+ xserver-xfree86/autodetect_video_card "true"
+ db_get xserver-xfree86/autodetect_video_card
+ AUTODETECT_VIDEO_CARD="$RET"
+ if [ "$AUTODETECT_VIDEO_CARD" = "true" ]; then
+ if [ $NSERVERS -eq 0 ]; then
+ trace "$func(): could not autodetect X server: no video card" \
+ "detected, or no server known for it"
+ set_db_priority "high"
+ run db_input "$PRIORITY" shared/no_known_x-server
+ db_go
+ elif [ $NSERVERS -eq 1 ]; then
+ trace "$func(): autodetected X server: $SERVERS"
+ if [ "$SERVERS" = "${THIS_SERVER##*/}" ]; then
+ # the autodetected X server is the only one on the system, and the
+ # one we're currently configuring; it's unlikely the user will want
+ # to use something else
+ set_db_priority "low"
+ else
+ trace "$func(): X server autodetected, but does not correspond" \
+ "to this package"
+ # we do not set shared/default-x-server here, because the
+ # autodetected X server might not be getting installed
+ fi
+ elif [ $NSERVERS -gt 1 ]; then
+ trace "$func(): could not autodetect X server: multiple servers for" \
+ "video cards"
+ videocard_server_report=$(echo "$DISCOVERED_VIDEO" \
+ | awk 'BEGIN { FS="\t"; printf " %-40s%20s\n .\n", "Detected Video Card", "Suggested X server" } { printf " %-50s%10s\n", $1, $2 } END { printf " .\n" }')
+ # can't do this until there is a way to embed newlines into debconf
+ # command streams :(
+ # db_subst shared/multiple_possible_x-servers detected_cards \
+ # "$videocard_server_report"
+ trace "$videocard_server_report"
+ set_db_priority "high"
+ run db_input "$PRIORITY" shared/multiple_possible_x-servers
+ db_go
+ fi
else
- trace "$func(): X server detected, but does not correspond to this" \
- "package"
- # We do not set shared/default-x-server here, because the detected X
- # server might not be getting installed.
+ trace "$func(): user declined video card autodetection"
fi
- elif [ $NSERVERS -gt 1 ]; then
- trace "$func(): could not detect X server: $NSERVERS distinct X servers" \
- "are required to operate the $NCARDS detected display devices"
- display_server_report=$(echo "$DETECTED_DISPLAY" \
- | awk 'BEGIN { FS="\t"; printf " %-40s%20s\n .\n", "Detected display device", "Suggested X server" } { printf " %-50s%10s\n", $1, $2 } END { printf " .\n" }')
- # We can't do this db_subst until there is a way to embed newlines into
- # debconf command streams. :(
- # db_subst shared/multiple_possible_x-servers detected_adapters \
- # "$display_server_report"
- echo "$display_server_report" | while read line; do
- trace "$func(): $line"
- done
-
- set_db_priority "high"
- run db_input "$PRIORITY" shared/multiple_possible_x-servers
- db_go
+ else
+ trace "$func(): could not autodetect X server: discover not found"
fi
else
- trace "$func(): not using detected display server (if any) as default;" \
- "user declined display adapter detection"
+ trace "$func(): not prompting for video card autodetection; reconfiguring"
fi
+ # now the default-x-server question may be asked
db_fget shared/default-x-server seen
trace "$func(): seen flag of shared/default-x-server is $RET"
-
- # Ask the default-x-server question. Permit auto_answer() to clobber the
- # existing value of the question if we are reconfiguring.
- CLOBBER_DEFAULT="$DO_DETECT_DISPLAY_HARDWARE" auto_answer db_input \
- "$PRIORITY" shared/default-x-server "$default_x_server_package"
+ auto_answer db_input $PRIORITY shared/default-x-server \
+ "$default_x_server_package"
}
-configure_display_device () {
- # syntax: configure_display_device
+configure_video_device () {
+ # syntax: configure_video_device
#
# Ask debconf questions that determine the contents of the "Device" section of
# the XF86Config-4 file.
local default_bus_id default_driver default_identifier default_use_fbdev \
- display_driver_report driver_dir driver_list fb_type func line lspci_id \
- pci_bus pci_device pci_domain pci_function
+ driver_dir driver_list fb_type func lspci_id pci_bus pci_device pci_domain \
+ pci_function videocard_driver_report
- func="configure_display_device"
+ func="configure_video_device"
# Validate function arguments.
if [ -n "$*" ]; then
@@ -701,9 +702,9 @@
driver_dir=/usr/X11R6/lib/modules/drivers
- # Build list of available display drivers, omitting the atimisc, r128, and
- # radeon sub-modules (the ati driver knows when and how to load these). v4l
- # is not a display driver, and dummy is for advanced users.
+ # Build list of available video drivers, omitting the atimisc, r128, and
+ # radeon sub-modules (the ati driver knows when and how to load these).
+ # v4l is not a display driver, and dummy is for advanced users.
#
# We won't find any drivers if we're being pre-configured and the package is
# not currently unpacked to the system (e.g., fresh install). In that event,
@@ -714,7 +715,7 @@
| sed 's/ /, /g')"
if [ -z "$driver_list" ]; then
- trace "$func(): no display driver modules found in $driver_dir"
+ trace "$func(): no video driver modules found in $driver_dir"
fi
# Set a hard-coded module list (if necessary) and default driver module on an
@@ -768,50 +769,50 @@
;;
esac
- trace "$func(): available display driver list set to \"$driver_list\""
+ trace "$func(): available video driver list set to \"$driver_list\""
- # Use detected driver if user elected to detect the display adapter.
- if [ "$DO_DETECT_DISPLAY_HARDWARE" = "true" ]; then
- if [ $NDRIVERS -eq 0 ]; then
- trace "$func(): could not detect X server driver: no display adapter" \
- "detected, or no driver known for it"
- elif [ $NDRIVERS -eq 1 ]; then
- trace "$func(): detected X server driver: $DRIVERS"
- set_db_priority "low"
- default_driver="$DRIVERS"
- elif [ $NDRIVERS -gt 1 ]; then
- trace "$func(): could not detect X server driver: multiple drivers for" \
- "display adapter"
- display_driver_report=$(echo "$DETECTED_DISPLAY" \
- | awk 'BEGIN { FS="\t"; printf " %-30s%30s\n .\n", "Detected display device", "Suggested driver module" } { printf " %-50s%10s\n", $1, $3 } END { printf " .\n" }')
- # can't do this until there is a way to embed newlines into debconf
- # command streams :(
- # db_subst shared/multiple_possible_x-drivers detected_adapters \
- # "$display_driver_report"
- echo "$display_server_report" | while read line; do
- trace "$func(): $line"
- done
-
- set_db_priority "high"
- run db_input "$PRIORITY" xserver-xfree86/multiple_possible_x-drivers
- db_go
+ # attempt to autodetect
+ if which discover >/dev/null 2>&1; then
+ if [ "$AUTODETECT_VIDEO_CARD" = "true" ]; then
+ if [ $NDRIVERS -eq 0 ]; then
+ trace "$func(): could not autodetect X server driver: no video card" \
+ "detected, or no driver known for it"
+ elif [ $NDRIVERS -eq 1 ]; then
+ trace "$func(): autodetected X server driver: $DRIVERS"
+ set_db_priority "low"
+ default_driver="$DRIVERS"
+ elif [ $NDRIVERS -gt 1 ]; then
+ trace "$func(): could not autodetect X server driver: multiple" \
+ "drivers for video cards"
+ videocard_driver_report=$(echo "$DISCOVERED_VIDEO" \
+ | awk 'BEGIN { FS="\t"; printf " %-30s%30s\n .\n", "Detected Video Card", "Suggested driver module" } { printf " %-50s%10s\n", $1, $3 } END { printf " .\n" }')
+ # can't do this until there is a way to embed newlines into debconf
+ # command streams :(
+ # db_subst shared/multiple_possible_x-drivers detected_cards \
+ # "$videocard_driver_report"
+ trace "$videocard_driver_report"
+ set_db_priority "high"
+ run db_input "$PRIORITY" xserver-xfree86/multiple_possible_x-drivers
+ db_go
+ fi
+ else
+ trace "$func(): user declined video card autodetection"
fi
else
- trace "$func(): not using detected display driver (if any) as default;" \
- "user declined display adapter detection"
+ trace "$func(): could not autodetect X server driver: discover not found"
fi
db_subst xserver-xfree86/config/device/driver choices "$driver_list"
auto_answer db_input "$PRIORITY" \
xserver-xfree86/config/device/driver "$default_driver"
- # Determine adapter identifier; try to set a sensible default.
+ # card identifier; try to set a sensible default
default_identifier=
if [ -n "$NDRIVERS" ] && [ -n "$NCARDS" ] && [ $NDRIVERS -eq 1 ] \
&& [ $NCARDS -eq 1 ]; then
if which discover >/dev/null 2>&1; then
- if [ "$DO_DETECT_DISPLAY_HARDWARE" = "true" ]; then
- default_identifier=$(echo "$DETECTED_DISPLAY" | cut -f1)
+ if [ "$AUTODETECT_VIDEO_CARD" = "true" ]; then
+ default_identifier=$(echo "$DISCOVERED_VIDEO" | cut -f1)
fi
fi
fi
@@ -843,10 +844,10 @@
set_db_priority "low"
default_bus_id=
- # Some PowerPCs need to be told where to find the display device even if there
- # is only one in the machine (broken PCI bus code in the XFree86 X server,
- # most likely). If there are multiple display devices, we need to configure
- # one as the primary head.
+ # Some PowerPCs need to be told where to find the video card even if there is
+ # only one in the machine (broken PCI bus code in the XFree86 X server, most
+ # likely). If there are multiple video cards, we need to configure one as the
+ # primary head.
if [ "$ARCH" = "powerpc" ] || [ "$MULTIHEAD" = "yes" ]; then
if [ "$ARCH" = "powerpc" ]; then
trace "$func(): PowerPC system detected; setting BusID question" \
@@ -867,20 +868,14 @@
# proper BusID form per XF86Config-4(5x). Recent versions of lspci don't
# say "Class " before the PCI class identifier when the -n option is used.
if lspci -X >/dev/null 2>&1; then
- lspci -Xn | grep -E "(Class )?0300:" | while read line; do
- trace "$func(): lspci -Xn reports: $line"
- done
-
+ trace "$(lspci -Xn | grep -E "(Class )?0300:")"
default_bus_id=$(LC_ALL=C lspci -Xn | grep -E "(Class )?0300:" \
| sort -n | head -n 1 | cut -d\ -f1)
if [ -z "$default_bus_id" ]; then
- trace "$func(): lspci -Xn reported no display devices on system"
+ trace "$func(): lspci -Xn reported no video cards on system"
fi
else
- lspci -n | grep -E "(Class )?0300:" | while read line; do
- trace "$func(): lspci -n reports: $line"
- done
-
+ trace "$(lspci -n | grep -E "(Class )?0300:")"
lspci_id=$(LC_ALL=C lspci -n | grep -E "(Class )?0300:" | sort -n \
| head -n 1 | cut -d\ -f1)
if [ -n "$lspci_id" ]; then
@@ -907,11 +902,11 @@
warn "$func(): unrecognized output from lspci: \"$lspci_id\""
fi
else
- trace "$func(): lspci -n reported no display devices on system"
+ trace "$func(): lspci -n reported no video cards on system"
fi
fi
else
- trace "$func(): cannot detect BusID; lspci command not available"
+ trace "$func(): cannot autodetect BusID; lspci command not available"
fi
fi
@@ -940,12 +935,9 @@
# Use fbcon kernel interface?
- # This is a question "without a reasonable default", at least at the outset,
- # so jack the priority up accordingly.
+ # For architectures that can use VGA BIOS-equipped video cards on the primary
+ # head, we initially assume fbcon is not in use (but see below).
set_db_priority "high"
-
- # For architectures that can use VGA BIOS-equipped display devices on the
- # primary head, we initially assume fbcon is not in use (but see below).
case "$ARCH" in
alpha|hurd-i386|i386|amd64)
default_use_fbdev=false
@@ -975,10 +967,6 @@
# Other framebuffers do support UseFBDev.
default_use_fbdev=true
fi
- else
- trace "$func(): /proc/fb exists but reports no framebuffer type;" \
- "assuming fbcon not in use"
- default_use_fbdev=false
fi
else
trace "$func(): /proc/fb does not exist; assuming fbcon not in use"
@@ -989,13 +977,13 @@
default_use_fbdev=false
fi
- # Re-set the default answer to false if need be.
+ # re-set the default answer to false if need be
run db_get xserver-xfree86/config/device/use_fbdev
if [ "$RET" = "true" ] && [ "$default_use_fbdev" = "false" ]; then
trace "$func(): xserver-xfree86/config/device/use_fbdev is \"true\" but" \
"/proc/fb does not exist, is empty, or reports a framebuffer type" \
- "with which UseFBDev cannot be used; forcing value to \"false\""
- db_set xserver-xfree86/config/device/use_fbdev "false"
+ "with which UseFBDev cannot be used; setting template to \"false\""
+ db_set xserver-xfree86/config/device/use_fbdev false
fi
auto_answer db_input "$PRIORITY" xserver-xfree86/config/device/use_fbdev \
@@ -1040,10 +1028,6 @@
"XkbModel"
default_model=type5
elif [ "$RET" = "xfree86" ]; then
- # TODO: m68k and PowerPC Macs running 2.2 should use macintosh_old;
- # m68k and PowerPC Macs running 2.4 should check
- # /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes;
- # m68k and PowerPC Macs running 2.6 should use macintosh
if [ "$ARCH" = "powerpc" ]; then
trace "$func(): PowerPC architecture detected and \"xfree86\" rules" \
"being used; using \"macintosh\" as default XkbModel"
@@ -1127,8 +1111,7 @@
output="$input"
;;
*input/mice)
- # This already *is* the input layer; obviously we don't want to transform
- # this one.
+ # Obviously we don't want to transform this one.
output="$input"
;;
*adbmouse|*amigamouse|*atarimouse|*atibm|*atixl|*sunmouse)
@@ -1148,9 +1131,6 @@
"not have happened! kernel: \"$kernel\" version:" \
"\"$version\""
;;
- *)
- internal_error "$func(): invalid argument \"$input\""
- ;;
esac
trace "$func(): mapping \"$input\" to \"$output\""
@@ -1164,9 +1144,9 @@
# Ask debconf questions that determine the contents of the "InputDevice"
# section (using the "mouse" driver) of the XF86Config-4 file.
- local detected_port detected_protocol default_port default_protocol \
- do_detect_mouse func mdetect_output mouse_port_choices \
- mouse_protocol_choices subarch template using_devfs
+ local autodetected_port autodetected_protocol default_port default_protocol \
+ func mdetect_output mouse_port_choices mouse_protocol_choices subarch \
+ using_devfs
func="configure_mouse"
@@ -1177,8 +1157,8 @@
# priority of xserver-xfree86/config/inputdevice/mouse/{port,protocol}
set_db_priority "high"
- detected_port=
- detected_protocol=
+ autodetected_port=
+ autodetected_protocol=
# determine if we're using devfs
if [ -c /dev/.devfsd ]; then
@@ -1197,7 +1177,7 @@
fi
# Attempt to set a reasonable default for the mouse port in the event
- # detection doesn't work.
+ # autodetection doesn't work.
case "$ARCH" in
alpha)
# Assume Alpha machines use PS/2 mice.
@@ -1259,8 +1239,8 @@
;;
esac
else
- trace "$func(): cannot detect m68k subarchitecture; /proc/hardware" \
- "does not exist or is not readable"
+ trace "$func(): cannot autodetect m68k subarchitecture;" \
+ "/proc/hardware does not exist or is not readable"
fi
;;
mips|mipsel)
@@ -1278,7 +1258,7 @@
elif grep -q 'pmac-generation.*NewWorld' /proc/cpuinfo; then
default_port="/dev/input/mice"
else
- trace "$func(): cannot detect whether Power Macintosh is" \
+ trace "$func(): cannot autodetect whether Power Macintosh is" \
"OldWorld or NewWorld; something amiss with /proc/cpuinfo?"
fi
;;
@@ -1287,8 +1267,8 @@
;;
esac
else
- trace "$func(): cannot detect PowerPC subarchitecture; /proc/cpuinfo" \
- "does not exist or is not readable"
+ trace "$func(): cannot autodetect PowerPC subarchitecture;" \
+ "/proc/cpuinfo does not exist or is not readable"
fi
;;
sparc)
@@ -1299,81 +1279,79 @@
;;
esac
- # If we are configuring for the first time or reconfiguring, ask if user wants
- # to attempt mouse detection.
- if [ -z "$UPGRADING" ] && [ -z "$PRECONFIGURED" ]; then
+ # if configuring for the first time, ask if user wants to autodetect
+ if [ -z "$RECONFIGURE" ]; then
while :; do
- # Bail out if detection tool not available.
+ # Bail out if autodetection tool not available.
if ! which mdetect >/dev/null 2>&1; then
- trace "$func(): cannot attempt to detect mouse port and protocol;" \
- "mdetect command not available"
+ trace "$func(): not autodetecting mouse port and protocol; mdetect" \
+ "command not available"
break
fi
- auto_answer db_input "$PRIORITY" xserver-xfree86/autodetect_mouse "true"
+ auto_answer db_input "$PRIORITY" \
+ xserver-xfree86/autodetect_mouse "false"
db_get xserver-xfree86/autodetect_mouse
- do_detect_mouse="$RET"
- if [ "$do_detect_mouse" = "true" ]; then
+ if [ "$RET" = "true" ]; then
mdetect_output=$(run mdetect -x)
if [ -n "$mdetect_output" ]; then
if [ $(echo "$mdetect_output" | wc -l) -ne 2 ]; then
trace "$func(): bug in mdetect; did not return two lines of output"
break
fi
- detected_port=$(echo "$mdetect_output" | head -n 1)
- detected_protocol=$(echo "$mdetect_output" | tail -n 1)
- trace "$func(): mdetect returned port \"$detected_port\";" \
- "protocol \"$detected_protocol\""
- if [ -n "$detected_port" ]; then
- # /dev/input/mouse* means we detected a USB pointer; we will store
- # /dev/input/mice instead.
- if expr "$detected_port" : "/dev/input/mouse.*" >/dev/null \
+ autodetected_port=$(echo "$mdetect_output" | head -n 1)
+ autodetected_protocol=$(echo "$mdetect_output" | tail -n 1)
+ trace "$func(): mdetect returned port \"$autodetected_port\";" \
+ "protocol \"$autodetected_protocol\""
+ if [ -n "$autodetected_port" ]; then
+ # /dev/input/mouse* means we autodetected a USB pointer; we will
+ # store /dev/input/mice instead.
+ if expr "$autodetected_port" : "/dev/input/mouse.*" >/dev/null \
2>&1; then
- detected_port="/dev/input/mice"
+ autodetected_port="/dev/input/mice"
fi
else
trace "$func(): bug in mdetect: returned nothing for mouse port"
break
fi
- if [ -z "$detected_protocol" ]; then
+ if [ -z "$autodetected_protocol" ]; then
trace "$func(): bug in mdetect: returned nothing for mouse protocol"
break
fi
else
- trace "$func(): mdetect returned no output; unable to detect mouse"
+ trace "$func(): mdetect returned no output; unable to autodetect" \
+ "mouse"
# permit user to retry, but set to false in the case question doesn't
# get asked (for noninteractive configuration)
db_set xserver-xfree86/autodetect_mouse "false"
fi
- if [ -n "$detected_port" ] && [ -n "$detected_protocol" ]; then
+ if [ -n "$autodetected_port" ] && [ -n "$autodetected_protocol" ]; then
set_db_priority "medium"
break # port and protocol determined
fi
else
- trace "$func(): user declined mouse detection"
- break # bail out; detection not desired
+ trace "$func(): user declined mouse autodetection"
+ break # bail out; autodetection not desired
fi
done
else
- trace "$func(): not prompting for mouse detection; upgrading"
+ trace "$func(): not prompting for mouse autodetection; reconfiguring"
fi
# Map legacy device ports to the input subsystem depending on the kernel
# version.
default_port=$(get_mouse_port_by_linux_version "$default_port")
- detected_port=$(get_mouse_port_by_linux_version "$detected_port")
+ autodetected_port=$(get_mouse_port_by_linux_version "$autodetected_port")
trace "$func(): mouse port choices are \"$mouse_port_choices\""
trace "$func(): default port is \"$default_port\""
- trace "$func(): detected port is \"$detected_port\""
+ trace "$func(): autodetected port is \"$autodetected_port\""
- # Ask what mouse port we should use, clobbering the existing answer if we
- # tried to detect the mouse.
db_subst xserver-xfree86/config/inputdevice/mouse/port choices \
"$mouse_port_choices"
- CLOBBER_DEFAULT="$do_detect_mouse" auto_answer db_input "$PRIORITY" \
+ auto_answer db_input "$PRIORITY" \
xserver-xfree86/config/inputdevice/mouse/port \
- "${detected_port:-$default_port}"
+ "${autodetected_port:-$default_port}"
db_get xserver-xfree86/config/inputdevice/mouse/port
case "$RET" in
@@ -1402,23 +1380,24 @@
default_protocol="OSMouse"
;;
esac
-
- # Ask what mouse protocol we should use, clobbering the existing answer if we
- # tried to detect the mouse.
db_subst xserver-xfree86/config/inputdevice/mouse/protocol choices \
"$mouse_protocol_choices"
- CLOBBER_DEFAULT="$do_detect_mouse" auto_answer db_input "$PRIORITY" \
- xserver-xfree86/config/inputdevice/mouse/protocol \
- "${detected_protocol:-$default_protocol}"
+ if ! expr "$mouse_protocol_choices" : ".*,.*" >/dev/null 2>&1; then
+ trace "$func(): \$mouse_protocol_choices has only one value; setting" \
+ "xserver-xfree86/config/inputdevice/mouse/protocol to" \
+ "\"$default_protocol\""
+ db_set xserver-xfree86/config/inputdevice/mouse/protocol "$default_protocol"
+ else
+ auto_answer db_input "$PRIORITY" \
+ xserver-xfree86/config/inputdevice/mouse/protocol \
+ "${autodetected_protocol:-$default_protocol}"
+ fi
# The Hurd's mouse device doesn't support button emulation or a Z axis, per
# Michael Banck (see Debian Bug #259080).
if [ "$ARCH" = "hurd-i386" ]; then
- for template in xserver-xfree86/config/inputdevice/mouse/emulate3buttons \
- xserver-xfree86/config/inputdevice/mouse/zaxismapping; do
- trace "architecture is $ARCH; forcing $template to \"false\""
- db_set "$template" "false"
- done
+ db_set xserver-xfree86/config/inputdevice/mouse/emulate3buttons "false"
+ db_set xserver-xfree86/config/inputdevice/mouse/zaxismapping "false"
fi
set_db_priority "low"
@@ -1435,11 +1414,10 @@
# Ask debconf questions that determine the contents of the "Monitor" section
# of the XF86Config-4 file.
+ local default_horiz_sync default_identifier default_vert_refresh \
+ edid_dump edid_horiz_sync edid_id edid_vert_refresh func
# $DEFAULT_MODES is global; keep it that way, because we need its value in
# other functions, like configure_display_modes_and_depth().
- local default_horiz_sync default_identifier default_vert_refresh \
- default_selection_method do_detct_monitor edid_dump edid_horiz_sync \
- edid_id edid_vert_refresh func template
func="configure_monitor"
@@ -1452,25 +1430,45 @@
default_horiz_sync="28-50"
default_vert_refresh="43-75"
- # Trace the existing monitor configuration.
- for template in xserver-xfree86/config/monitor/identifier \
- xserver-xfree86/config/monitor/horiz-sync \
- xserver-xfree86/config/monitor/vert-refresh; do
- db_fget "$template" seen
- trace "$func(): seen flag of $template is \"$RET\""
- db_get "$template"
- trace "$func(): value of $template is \"$RET\""
- done
+ db_fget xserver-xfree86/config/monitor/identifier seen
+ if [ "$RET" = "false" ]; then
+ trace "$func(): xserver-xfree86/config/monitor/identifier has not been seen"
+ fi
- # If we are configuring for the first time or reconfiguring, ask if user wants
- # to attempt monitor detection.
- if [ -z "$UPGRADING" ] && [ -z "$PRECONFIGURED" ]; then
+ db_get xserver-xfree86/config/monitor/identifier
+ trace "$func(): xserver-xfree86/config/monitor/identifier is already set to" \
+ "\"$RET\""
+
+ # The horiz-sync and vert-refresh questions may have answers even though they
+ # haven't been seen; autodetection, pre-loading, and the simple and medium
+ # selection methods can fill them in.
+
+ db_fget xserver-xfree86/config/monitor/horiz-sync seen
+ if [ "$RET" = "false" ]; then
+ trace "$func(): xserver-xfree86/config/monitor/horiz-sync has not been seen"
+ fi
+
+ db_get xserver-xfree86/config/monitor/horiz-sync
+ trace "$func(): xserver-xfree86/config/monitor/horiz-sync is already set to" \
+ "\"$RET\""
+
+ db_fget xserver-xfree86/config/monitor/vert-refresh seen
+ if [ "$RET" = "false" ]; then
+ trace "$func(): xserver-xfree86/config/monitor/vert-refresh has not been" \
+ "seen"
+ fi
+
+ db_get xserver-xfree86/config/monitor/vert-refresh
+ trace "$func(): xserver-xfree86/config/monitor/vert-refresh is already set" \
+ "to \"$RET\""
+
+ # if configuring for the first time, ask if user wants to autodetect
+ if [ -z "$RECONFIGURE" ]; then
if which get-edid >/dev/null 2>&1; then
auto_answer db_input "$PRIORITY" xserver-xfree86/autodetect_monitor \
"false"
db_get xserver-xfree86/autodetect_monitor
- do_detect_monitor="$RET"
- if [ "$do_detect_monitor" = "true" ]; then
+ if [ "$RET" = "true" ]; then
set +e
edid_dump=$( (get-edid | parse-edid) 2>/dev/null)
set -e
@@ -1507,13 +1505,14 @@
trace "$func(): get-edid returned an error"
fi
else
- trace "$func(): user declined monitor detection"
+ trace "$func(): user declined monitor autodetection"
fi
else
- trace "$func(): could not detect monitor frequencies; get-edid not found"
+ trace "$func(): could not autodetect monitor frequencies; get-edid not" \
+ "found"
fi
else
- trace "$func(): not prompting for monitor detection; upgrading"
+ trace "$func(): not prompting for monitor autodetection; reconfiguring"
fi
# priority of xserver-xfree86/config/monitor/identifier
@@ -1539,32 +1538,30 @@
*) default_identifier="Generic Monitor" ;;
esac
fi
- # This question requires input validation. Clobber the existing answer if we
- # tried to detect the monitor.
- CLOBBER_DEFAULT="$do_detect_monitor" MAY_BE_NULL= auto_answer \
- validate_string_db_input "$PRIORITY" \
+ # this question requires input validation
+ MAY_BE_NULL= auto_answer validate_string_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/identifier "$default_identifier"
# Set priority of xserver-xfree86/config/monitor/selection-method based on
# whether or not we were able to retrieve the monitor's sync ranges via EDID.
#
- # If we did get monitor sync range information via EDID, set the default
- # selection method to "Advanced". Otherwise, ask the user if the monitor is
+ # If we did get monitor sync range information via EDID, pre-answer the
+ # selection method with "Advanced". Otherwise, ask the user if the monitor is
# an LCD.
if [ -n "$edid_horiz_sync" ] && [ -n "$edid_vert_refresh" ]; then
trace "$func(): \$edid_horiz_sync: \"$edid_horiz_sync\";" \
"\$edid_vert_refresh: \"$edid_vert_refresh\"; setting question" \
"priority to low"
set_db_priority "low"
- default_section_method="Advanced"
+ db_subst xserver-xfree86/config/monitor/selection-method default "Advanced"
else
trace "$func(): at least of one of hsync \"$edid_horiz_sync\" or vrefresh" \
"\"$edid_vert_refresh\" is null; setting question priority to medium"
set_db_priority "medium"
- # Flat panels are more and more common, so set the default selection method
+ # Flat panels are more and more common, so set the selection method default
# to "Medium".
- default_selection_method="Medium"
+ db_subst xserver-xfree86/config/monitor/selection-method default "Medium"
# Ask whether the monitor is an LCD, and eliminate the "Simple" selection
# method from the list of choices if it is.
@@ -1582,10 +1579,8 @@
trace "$func(): question priority for monitor selection method and related" \
"questions is $PRIORITY"
+ run db_input "$PRIORITY" xserver-xfree86/config/monitor/selection-method
- CLOBBER_DEFAULT="$do_detect_monitor" auto_answer db_input "$PRIORITY" \
- xserver-xfree86/config/monitor/selection-method "$default_selection_method"
-
db_get xserver-xfree86/config/monitor/selection-method
trace "$func(): using \"$RET\" selection method"
case "$RET" in
@@ -1634,8 +1629,8 @@
# set the sync ranges based on the hsync and vrefresh values used by the
# selected mode, plus a little bit of "headroom" to allow other modes to
# be used (as long as they don't push the hardware much harder than the
- # selected one) and a margin of error (e.g., if the display driver or
- # display device overdrives the monitor just a little bit).
+ # selected one) and a margin of error (e.g., if the video driver or video
+ # card overdrives the monitor just a little bit).
case "$RET" in
"640x480 @ 60Hz")
db_set xserver-xfree86/config/monitor/horiz-sync "28-33"
@@ -1684,7 +1679,7 @@
DEFAULT_MODES="1024x768"
;;
"1152x768 @ 54.8Hz")
- # This is a 15" PowerBook G4 mode; its display hardware (LCD) is also
+ # This is a 15" PowerBook G4 mode; its video hardware (LCD) was also
# capable of 896x600 and 720x480 pixels at a 3:2 aspect ratio and
# 1024x768, 800x600, and 640x480 pixels at a 4:3 aspect ratio, so give
# its horizontal and vertical ranges a little more "headroom" than
@@ -1802,28 +1797,17 @@
esac
;;
Advanced)
- # These questions require input validation. Clobber the existing answers
- # if we tried to detect the monitor.
- CLOBBER_DEFAULT="$do_detect_monitor" auto_answer \
- validate_monitor_frequency_db_input "$PRIORITY" \
+ auto_answer validate_monitor_frequency_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/horiz-sync "$default_horiz_sync"
- CLOBBER_DEFAULT="$do_detect_monitor" auto_answer \
- validate_monitor_frequency_db_input "$PRIORITY" \
+ auto_answer validate_monitor_frequency_db_input "$PRIORITY" \
xserver-xfree86/config/monitor/vert-refresh "$default_vert_refresh"
;;
- *)
- internal_error "$func(): template" \
- "xserver-xfree86/config/monitor/selection-method has" \
- "invalid value \"$RET\""
- ;;
esac
db_get xserver-xfree86/config/monitor/horiz-sync
trace "$func(): horizontal sync configured to \"$RET\""
db_get xserver-xfree86/config/monitor/vert-refresh
trace "$func(): vertical refresh configured to \"$RET\""
-
- trace "$func(): \$DEFAULT_MODES is \"$DEFAULT_MODES\""
}
configure_display_modes_and_depth () {
@@ -1842,11 +1826,11 @@
warn "$func(): called with bogus arguments $@"
fi
- # Configure available display modes. For certain drivers we will override any
+ # Configure available video modes. For certain drivers we will override any
# existing value of $DEFAULT_MODES, because they only support certain modes.
# Otherwise, the existing value of $DEFAULT_MODES is preserved.
db_get xserver-xfree86/config/device/driver
- trace "$func(): configured display device driver is \"$RET\""
+ trace "$func(): \"xserver-xfree86/config/device/driver\" is \"$RET\""
case "$RET" in
newport)
default_depth=8
@@ -1864,7 +1848,7 @@
;;
esac
- trace "$func(): default color depth is $default_depth and default display" \
+ trace "$func(): default color depth is $default_depth and default video" \
"modes are \"$DEFAULT_MODES\""
set_db_priority "medium"
@@ -1893,12 +1877,11 @@
warn "$func(): called with bogus arguments $@"
fi
+ # server modules to load
+ db_get xserver-xfree86/config/device/driver
set_db_priority "low"
- run db_input "$PRIORITY" xserver-xfree86/config/modules
+ db_input "$PRIORITY" xserver-xfree86/config/modules
db_go
-
- db_get xserver-xfree86/config/modules
- trace "$func(): server module list configured to \"$RET\""
}
configure_files () {
@@ -1916,12 +1899,8 @@
warn "$func(): called with bogus arguments $@"
fi
- set_db_priority "low"
run db_input "$PRIORITY" xserver-xfree86/config/write_files_section
db_go
-
- db_get xserver-xfree86/config/write_files_section
- trace "$func(): writing of default files section configured to \"$RET\""
}
configure_dri () {
@@ -1939,20 +1918,14 @@
warn "$func(): called with bogus arguments $@"
fi
- set_db_priority "low"
run db_input "$PRIORITY" xserver-xfree86/config/write_dri_section
db_go
-
- db_get "$PRIORITY" xserver-xfree86/config/write_dri_section
- trace "$func(): writing of default DRI section configured to \"$RET\""
}
configure_xfree86_x_server () {
# syntax: configure_xfree86_x_server
#
# Ask debconf questions that determine what XF86Config-4 will look like.
- #
- # Returns status 1 if the configuration file has been locally modified.
local bailout func
@@ -2006,7 +1979,7 @@
# also require enabling debconf "back" support in each of the following
# functions.
- configure_display_device
+ configure_video_device
configure_keyboard
configure_mouse
configure_monitor
@@ -2021,26 +1994,14 @@
trace "beginning configuration; arguments: $@"
# Analyze script arguments.
-
-# First, determine whether we have been preconfigured by an external tool.
-db_get xserver-xfree86/preconfigured
-PRECONFIGURED="$RET"
-
-# If we are reconfiguring, warn the user that accepting hardware detection will
-# clobber defaults. This overrides the effect of the "preconfigured" template.
-if [ "$1" = "reconfigure" ]; then
+if [ "$1" = "reconfigure" ] || [ -n "$2" ]; then
+ # If we are reconfiguring, or already have installed the package at least
+ # once before, we should not let auto_answer stomp on existing answers to
+ # debconf questions.
trace "reconfiguring package"
- run db_fset xserver-xfree86/detection_clobbers_defaults seen false
- run db_input xserver-xfree86/detection_clobbers_defaults
- run db_go
-# If we have been preconfigured, note the fact.
-elif [ "$PRECONFIUGRED" != "true" ]; then
- trace "using pre-configured settings"
-# If the package has been configured previously, but we have *not* been
-# preconfigured and are *not* reconfiguring, we are upgrading.
-elif [ -n "$2" ]; then
- trace "upgrading package"
- UPGRADING=true
+ RECONFIGURE=true
+else
+ RECONFIGURE=
fi
# migrate from old select-type templates
@@ -2132,61 +2093,33 @@
fi
fi
-# Collect information about installed display adapter(s), if possible and
-# desired by the user. This is at the top level instead of inside a function
-# because the choice of both X server (configure_default_x_server) and the
-# XFree86 X server driver (configure_display_device) can be influenced by this
-# information.
-trace "determining whether to detect display adapter with discover"
-if [ -z "$UPGRADING" ] && [ -z "$PRECONFIGURED" ]; then
- if which discover >/dev/null 2>&1; then
- set_db_priority "medium"
- auto_answer db_input "$PRIORITY" xserver-xfree86/autodetect_video_card \
- "true"
- db_get xserver-xfree86/autodetect_video_card
- DO_DETECT_DISPLAY_HARDWARE="$RET"
-
- if [ "$DO_DETECT_DISPLAY_HARDWARE" = "true" ]; then
- DETECTED_DISPLAY=$(detect_display_adapter)
- if [ -n "$DETECTED_DISPLAY" ]; then
- trace "discover reports the following:"
- echo "$DETECTED_DISPLAY" | while read LINE; do
- trace "$LINE"
- done
- trace "end of discover report"
- NCARDS=$(echo "$DETECTED_DISPLAY" | wc -l | tr -d '[:blank:]')
- SERVERS=$(echo "$DETECTED_DISPLAY" | cut -f2 | grep -v unknown \
- | sort -u)
- if [ -n "$SERVERS" ]; then
- NSERVERS=$(echo "$SERVERS" | wc -l | tr -d '[:blank:]')
- fi
- DRIVERS=$(echo "$DETECTED_DISPLAY" | cut -f3 | grep -v unknown \
- | sort -u)
- if [ -n "$DRIVERS" ]; then
- NDRIVERS=$(echo "$DRIVERS" | wc -l | tr -d '[:blank:]')
- fi
- if [ $NCARDS -gt 1 ]; then
- MULTIHEAD=yes
- fi
- else
- trace "discover returned no data"
- fi
- else
- trace "user declined display adapter detection"
+# collect information about installed video card(s), if possible
+if which discover >/dev/null 2>&1; then
+ DISCOVERED_VIDEO=$(discover_video)
+ if [ -n "$DISCOVERED_VIDEO" ]; then
+ NCARDS=$(echo "$DISCOVERED_VIDEO" | wc -l | tr -d '[:blank:]')
+ SERVERS=$(echo "$DISCOVERED_VIDEO" | cut -f2 | grep -v unknown | sort -u)
+ if [ -n "$SERVERS" ]; then
+ NSERVERS=$(echo "$SERVERS" | wc -l | tr -d '[:blank:]')
fi
+ DRIVERS=$(echo "$DISCOVERED_VIDEO" | cut -f3 | grep -v unknown | sort -u)
+ if [ -n "$DRIVERS" ]; then
+ NDRIVERS=$(echo "$DRIVERS" | wc -l | tr -d '[:blank:]')
+ fi
+ if [ $NCARDS -gt 1 ]; then
+ MULTIHEAD=yes
+ fi
else
- trace "cannot attempt to detect display adapter; discover command not" \
- "available"
+ trace "discover reported nothing"
fi
else
- trace "not attempting to detect display adapter; we are upgrading or have" \
- "been preconfigured"
+ trace "discover command not available"
fi
# Determine the default X server, and make sure it corresponds to this package.
SKIP_XFREE86_X_SERVER_CONFIG=
-if configure_default_x_server; then
+if select_default_x_server; then
# is this the selected X server?
db_get shared/default-x-server
if [ "$RET" != "$THIS_PACKAGE" ]; then
@@ -2196,37 +2129,33 @@
SKIP_XFREE86_X_SERVER_CONFIG=yes
fi
else
- trace "not configuring default X server; configuration file has local" \
- "modifications"
- # If we are not upgrading -- that is, we are configuring for the first time or
- # explicitly reconfiguring, warn the user that the local files have been
- # modified.
- if [ -z "$UPGRADING" ]; then
- trace "warning user of the above"
+ if [ -n "$RECONFIGURE" ]; then
warn "not reconfiguring default X server; manual modifications have been" \
"made -- please see /usr/share/doc/xfree86-common/FAQ.gz or" \
"/usr/share/doc/xfree86-common/FAQ.xhtml.gz"
+ else
+ trace "not configuring default X server; manual modifications have been" \
+ "made -- please see /usr/share/doc/xfree86-common/FAQ.gz or" \
+ "/usr/share/doc/xfree86-common/FAQ.xhtml.gz"
fi
fi
-# Configure the XFree86 X server.
+# configure XFree86 X server
-# Do not be tempted to move this into the "if configure_default_x_server" block
+# Do not be tempted to move this into the "if select_default_x_server" block
# above; we want to permit the user to reconfigure the XF86Config-4 file even if
# the choice of default X server is being handled manually.
if [ -z "$SKIP_XFREE86_X_SERVER_CONFIG" ]; then
if ! configure_xfree86_x_server; then
- trace "not configuring XFree86 X server; configuration file has local" \
- "modifications"
- # If we are not upgrading -- that is, we are configuring for the first time
- # or explicitly reconfiguring, warn the user that the local files have been
- # modified.
- if [ -z "$UPGRADING" ]; then
- trace "warning user of the above"
+ if [ -n "$RECONFIGURE" ]; then
warn "not reconfiguring XFree86 X server; manual modifications have" \
"been made -- please see /usr/share/doc/xfree86-common/FAQ.gz or" \
"/usr/share/doc/xfree86-common/FAQ.xhtml.gz"
+ else
+ trace "not configuring XFree86 X server; manual modifications have" \
+ "been made -- please see /usr/share/doc/xfree86-common/FAQ.gz" \
+ "or /usr/share/doc/xfree86-common/FAQ.xhtml.gz"
fi
fi
fi
Modified: branches/debconf-overhaul/debian/xserver-xfree86.templates
===================================================================
--- branches/debconf-overhaul/debian/xserver-xfree86.templates 2004-10-13 17:32:42 UTC (rev 1952)
+++ branches/debconf-overhaul/debian/xserver-xfree86.templates 2004-10-13 17:39:17 UTC (rev 1953)
@@ -1,27 +1,3 @@
-Template: xserver-xfree86/preconfigured
-Type: boolean
-Default: false
-Description: internal use only
- This template is never shown to the user and does not require translation.
- .
- Separately packaged XFree86 X server configuration tools should set this
- question to "true" to suppress efforts by the XFree86 X server packages to
- detect reasonable defaults for other templates.
-
-Template: xserver-xfree86/detection_clobbers_defaults
-Type: note
-_Description: Hardware detection overwrites configured defaults.
- You are reconfiguring this package; please note that if you answer
- affirmatively to questions about hardware detection for video hardware,
- mouse, and monitor, that the detected values (if any) will replace the
- default configured values.
- .
- This is unlike normal package reconfiguration, in which a package that is
- being reconfigured uses its currently configured parameters as defaults.
- .
- If you want to preserve your existing configuration as closely as possible,
- you should decline hardware detection.
-
Template: xserver-xfree86/autodetect_video_card
Type: boolean
Default: true
Reply to: