~ubuntu-branches/ubuntu/hardy/xorg/hardy-proposed

« back to all changes in this revision

Viewing changes to debian/xserver-xorg.postinst.in

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen, Julien Cristau
  • Date: 2007-12-18 01:19:37 UTC
  • Revision ID: james.westby@ubuntu.com-20071218011937-kg5txb5yafc1bs9b
Tags: 1:7.3+8ubuntu1
* Merge with Debian unstable, remaining changes:
  - apport/xorg-server.py, debian/x11-common.install:
    + apport hook for xorg-server crashes
  - local/Failsafe/*, x11-common.install:
    + Bulletproof-X.
  - control:
    + Change maintainer address.
    + xserver-xorg: Recommends displayconfig-gtk
    + Move xorg-docs Recommends to Suggests, because xorg-docs is in
      universe.
    + Add "xserver-xorg-driver-all" transitional package to make
      dapper->hardy upgrades work.
  - control, rules:
    + Add a dependency to x11-common for each binary built to save
      disk/livecd space.
    + Symlink the doc directories to x11-common, explicitly remove the
      doc directories on upgrade for the now symlinked doc directories.
  - local/xserver-wrapper.c:
    + Stop handling -config specifically in the wrapper, as Xorg now
      handles this itself.
  - local/dexconf, control:
    + Added support for vmmouse_detect (if present) to override mouse
      driver with vmware. Depends on mdetect.
  - local/dexconf:
    + Add extra bits for ps3fb xorg.conf.
  - scripts/vars.{amd64,i386}:
    + Install both xserver-xorg-video-intel AND xserver-xorg-video-i810,
      instead of OR.
  - scripts/vars.i386:
    + Add xserver-xorg-video-amd and xserver-xorg-video-psb.
  - scripts/vars.lpia:
    + Copied from vars.i386.
  - local/Xsession:
    + If ~/.xsession-errors is bigger than 0.5MiB, truncate it to the last
      0.5MiB to avoid having it grow indefinitively. (This does not happen
      with gdm anyway since gdm cleans the file on login).
  - xserver-xorg.postinst.in:
    + Make sure to ask video driver on sparc even if autodetected. Some
      cards still require weird overrides (ati -> fbdev) that are not
      100% known in all combinations.
    + Skip video card autodetection if xforcevesa is set.

[ Julien Cristau ]
* Deregister old debconf questions before calling dexconf.  dexconf calls
  db_stop, and we can't use debconf after that.  Add a comment to that
  effect above the dexconf call in debian/xserver-xorg.postinst.in, to try
  to prevent future mistakes.  Thanks, Michael Vogt!

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
THIS_PACKAGE=xserver-xorg
15
15
THIS_SCRIPT=postinst
16
16
 
17
 
LAPTOP=""
18
 
if [ -n "$(which laptop-detect)" ]; then
19
 
    if laptop-detect >/dev/null; then
20
 
        LAPTOP=true
21
 
    fi
22
 
fi
23
 
 
24
17
#INCLUDE_SHELL_LIB#
25
18
 
26
19
if [ -e /etc/default/xorg ]; then
95
88
  set -e
96
89
}
97
90
 
98
 
validate_monitor_frequency_expr () {
99
 
  # syntax: validate_monitor_frequency_expr expression
100
 
  #
101
 
  # Confirm that the given expression is a valid monitor frequency expression
102
 
  # per xorg.conf(5).  Note that this does *not* handle (comma-delimited)
103
 
  # tuples.  We expect a single value or range with an optional unit suffix.
104
 
  #
105
 
  # Note: We don't check to see if the latter value in a range is actually
106
 
  # greater than the former, and we don't check to see if any of the numeric
107
 
  # values actually make sense.  I.e., 0 Hz may not actually be valid as far as
108
 
  # the X server is concerned, but 10000 Hz might be okay whereas 10000 kHz
109
 
  # might not be.  It would take quite a bit of code to sort all that out.  We
110
 
  # only take some of the bullets out of the user's gun -- not all of them.
111
 
  #
112
 
  # Return true (0) if the expression is valid, and false (1) if it is not.
113
 
 
114
 
  _func="validate_monitor_frequency_expr"
115
 
 
116
 
  # Validate function arguments.
117
 
  if [ $# -ne 1 ]; then
118
 
    internal_error "$_func(): called with wrong number of arguments; expected" \
119
 
                   "1, got $@"
120
 
  fi
121
 
 
122
 
  _regex='^[[:space:]]*0*[0-9]+(\.[0-9]+)?(-0*[0-9]+(\.[0-9]+)?)?([[:space:]]*[kM]?Hz)?$'
123
 
 
124
 
  if echo "$1" | grep -Eiq "$_regex"; then
125
 
    return 0
126
 
  else
127
 
    return 1
128
 
  fi
129
 
}
130
 
 
131
 
validate_monitor_frequency_db_input () {
132
 
  # syntax: validate_monitor_frequency_db_input priority template
133
 
  #
134
 
  # validate monitor frequency input
135
 
 
136
 
  _func="validate_monitor_frequency_db_input"
137
 
 
138
 
  # Validate function arguments.
139
 
  if [ $# -ne 2 ]; then
140
 
    internal_error "$_func(): called with wrong number of arguments; expected" \
141
 
                   "2, got $@"
142
 
  fi
143
 
 
144
 
  _priority=$1
145
 
  _template=$2
146
 
  db_get "$_template"
147
 
  _safe="$RET"
148
 
  set +e
149
 
  while :; do
150
 
    db_input "$_priority" "$_template"
151
 
    # is the question going to be asked?
152
 
    if [ $? -eq 30 ]; then
153
 
      break # no; bail out of validation loop
154
 
    fi
155
 
    db_go
156
 
    db_get "$_template"
157
 
    # This is a string, and needs input validation; a regex match will have to
158
 
    # do.  We force the first character to be a number to avoid hideous problems
159
 
    # in the debconf dialog frontend in 0.3.83 (it needs to be one anyway).  We
160
 
    # need to handle multiple expressions, delimited by commas.  See
161
 
    # xorg.conf(5) for more information.
162
 
    if expr "$RET" : ".*,.*" >/dev/null 2>&1; then
163
 
      _expr_is_valid=true
164
 
        echo "$RET" | tr -s ',' '\n' | while read _freq_expr; do
165
 
          if ! validate_monitor_frequency_expr "$_freq_expr"; then
166
 
            _expr_is_valid=
167
 
          fi
168
 
        done
169
 
        if [ -n "$_expr_is_valid" ]; then
170
 
          break
171
 
        fi
172
 
    else
173
 
      if validate_monitor_frequency_expr "$RET"; then
174
 
        break
175
 
      fi
176
 
    fi
177
 
 
178
 
    # we only get to this point if the input was invalid; restore the known
179
 
    # good value in case we are interrupted before the user provides a
180
 
    # valid one
181
 
    db_set "$_template" "$_safe"
182
 
    db_fset "$_template" seen false
183
 
    # now show the user the error message
184
 
    db_fset xserver-xorg/config/monitor/range_input_error seen false
185
 
    db_input critical xserver-xorg/config/monitor/range_input_error
186
 
    db_go
187
 
  done
188
 
  set -e
189
 
}
190
 
 
191
91
CONFIG_DIR="/etc/X11"
192
92
CONFIG_AUX_DIR=/var/lib/x11
193
93
SERVER_SYMLINK="$CONFIG_DIR/X"
928
828
        USE_FBDEV=true
929
829
      fi
930
830
    fi
931
 
    # Make sure to force UseFBDev with Rage 128 or stuff will go bad in some
932
 
    # old Macs.
933
 
    if echo "$DEVICE_IDENTIFIER" | grep -q "Rage 128"; then
934
 
      USE_FBDEV=true
935
 
    fi
936
831
  fi
937
832
 
938
833
  if [ -n "$XORG_USE_FBDEV" ] && [ "$XORG_USE_FBDEV" = "no" ]; then
1170
1065
  rm -f $CONFIG_AUX_DIR/.migrateconfig
1171
1066
fi
1172
1067
 
1173
 
if [ -n "$DEBUG_XORG_PACKAGE" ]; then
1174
 
  XRESPROBE_DEBUG="yes"
1175
 
fi
1176
 
 
1177
1068
#DEBHELPER#
1178
1069
 
1179
 
xresprobeint() {
1180
 
  PRIORITY="medium"
1181
 
  db_input $PRIORITY xserver-xorg/autodetect_monitor || debug_echo "db_get xserver-xorg/autodetect_monitor"
1182
 
  db_go
1183
 
  db_get xserver-xorg/autodetect_monitor || debug_echo "db_get xserver-xorg/autodetect_monitor"
1184
 
  # well, you'd better like the values you get, eh?
1185
 
  if [ "$RET" = "true" ]; then
1186
 
    AUTODETECT_VIDEO="yes"
1187
 
  fi
1188
 
  if [ -n "$AUTODETECT_VIDEO" ] && [ -z "$UPGRADE" ]; then
1189
 
    # clean vars
1190
 
    RESOLUTIONS=
1191
 
    HORIZ_SYNC=
1192
 
    VERT_REFRESH=
1193
 
 
1194
 
    # clear out all values
1195
 
    for i in horiz-sync vert-refresh use_sync_ranges \
1196
 
             selection-method screen-size; do
1197
 
      db_reset xserver-xorg/config/monitor/$i
1198
 
    done
1199
 
 
1200
 
    for i in modes; do
1201
 
      db_reset xserver-xorg/config/display/$i
1202
 
    done
1203
 
    # Support preseeding of this one even when autodetecting; will mean
1204
 
    # people get the wrong default presented on second and subsequent
1205
 
    # low-priority reconfigures, though. Too bad.
1206
 
    for i in default_depth; do
1207
 
      db_fget xserver-xorg/config/display/$i seen
1208
 
      if [ "$RET" = false ]; then
1209
 
        db_reset xserver-xorg/config/display/$i
1210
 
      fi
1211
 
    done
1212
 
    
1213
 
    db_get xserver-xorg/config/device/driver || debug_echo "db_get xserver-xorg/config/device/driver"
1214
 
    DEVICE_DRIVER="$RET"
1215
 
    db_get xserver-xorg/config/device/identifier || debug_echo "db_get xserver-xorg/config/device/driver"
1216
 
    DEVICE_IDENTIFIER="$RET"
1217
 
 
1218
 
    if which fbset >/dev/null 2>&1; then
1219
 
      if [ "$DEVICE_DRIVER" = "fbdev" ] && [ "$ARCH" = "hppa" ] && [ -r /dev/fb0 ]; then
1220
 
        HPPAFBOUT="$(fbset)"
1221
 
        HPPARES="$(echo "$HPPAFBOUT" | grep ^mode | sed -e 's/^mode "//g' -e 's/"//g')"
1222
 
        HPPADEPTH="$(echo "$HPPAFBOUT" | grep ^[[:space:]]*geometry | awk '{print $NF}')"
1223
 
        PROBE_DUMP="$(echo -e "res: $HPPARES\ndepth: $HPPADEPTH")"
1224
 
      fi
1225
 
    fi
1226
 
 
1227
 
    # first install, we attempt a probe
1228
 
    if which xresprobe >/dev/null 2>&1; then
1229
 
      set +e
1230
 
      PROBE_DUMP="$(xresprobe "$DEVICE_DRIVER")"
1231
 
      set -e
1232
 
    fi
1233
 
 
1234
 
    # Set proper vars.
1235
 
    RESOLUTIONS="$(echo "$PROBE_DUMP" | grep "^res:" | sed -e 's/^res: //g')"
1236
 
    HORIZ_SYNC="$(echo "$PROBE_DUMP" | grep "^freq:" | sed -e 's/^freq: //g' | cut -d " " -f 1)"
1237
 
    VERT_REFRESH="$(echo "$PROBE_DUMP" | grep "^freq:" | sed -e 's/^freq: //g' | cut -d " " -f 2)"
1238
 
    DISPLAY_TYPE="$(echo "$PROBE_DUMP" | grep "^disptype:" | sed -e 's/^disptype: //g')"
1239
 
    DISPLAY_DEPTH="$(echo "$PROBE_DUMP" | grep "^depth:" | sed -e 's/^depth: //g')"
1240
 
 
1241
 
    if [ -n "$XORG_SYNC_RANGES" ]; then
1242
 
      debug_echo "writing sync ranges due to XORG_SYNC_RANGES"
1243
 
      MONITOR_SYNC_RANGES="yes"
1244
 
    fi
1245
 
  
1246
 
    # nv, savage, trident and via will take the panel resolution from a BIOS table,
1247
 
    # but  then fail to infer sane sync ranges from these, so mode validation will
1248
 
    # fail when it uses the standard VGA sync ranges.  hack around this by producing
1249
 
    # a sane sync range for the resolution in the config file when they're almost
1250
 
    # certain to be using LVDS.
1251
 
    if [ "$DEVICE_DRIVER" = "nv" ] || [ "$DEVICE_DRIVER" = "savage" ] || \
1252
 
       [ "$DEVICE_DRIVER" = "trident" ] || [ "$DEVICE_DRIVER" = "via" ] || \
1253
 
       [ "$DEVICE_DRIVER" = "siliconmotion" ] || \
1254
 
       [ "$DEVICE_DRIVER" = "chips" ] || [ "$DEVICE_DRIVER" = "tdfx" ] || \
1255
 
       [ "$DEVICE_DRIVER" = "neomagic" ]; then
1256
 
      if [ "$DISPLAY_TYPE" = "lcd/lvds" ]; then
1257
 
        debug_echo "known-bad laptop chipset detected; writing sync ranges"
1258
 
        MONITOR_SYNC_RANGES="yes"
1259
 
      fi
1260
 
    fi
1261
 
 
1262
 
    if [ "$DEVICE_DRIVER" = "s3" ]; then
1263
 
      debug_echo "known-bad chipset detected; writing sync ranges"
1264
 
      MONITOR_SYNC_RANGES="yes"
1265
 
    fi
1266
 
 
1267
 
    if [ "$DEVICE_DRIVER" = "ati" ]; then
1268
 
      # r128 is in the same 'special' list, AFAICT.
1269
 
      if [ "$DISPLAY_TYPE" = "lcd/lvds" ]; then
1270
 
        if [ "$DEVICE_IDENTIFIER" = "ATI Technologies Inc Rage Mobility M3 (AGP)" ] || \
1271
 
           [ "$DEVICE_IDENTIFIER" = "ATI Technologies Inc Rage Mobility M4 (AGP)" ] || \
1272
 
           echo "$DEVICE_IDENTIFIER" | grep -q "Rage 128"; then
1273
 
          MONITOR_SYNC_RANGES="yes"
1274
 
          debug_echo "r128 laptop chipset detected; writing sync ranges"
1275
 
        fi
1276
 
      else
1277
 
        # ddc via i2c on ati/powerpc seems to be too flaky to be relied upon
1278
 
        if [ "$ARCHITECTURE" = "powerpc" ]; then
1279
 
          MONITOR_SYNC_RANGES="yes"
1280
 
          debug_echo "ati chipset on powerpc detected; writing sync ranges"
1281
 
        fi
1282
 
      fi
1283
 
    fi
1284
 
 
1285
 
    if [ "$DEVICE_DRIVER" = "i810" ]; then
1286
 
      # and i810, but *not* i830
1287
 
      if [ "$DISPLAY_TYPE" = "lcd/lvds" ]; then
1288
 
        if [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82810 CGC [Chipset Graphics Controller]" ] || \
1289
 
           [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82810 DC-100 CGC [Chipset Graphics Controller]" ] || \
1290
 
           [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82810E DC-133 CGC [Chipset Graphics Controller]" ] || \
1291
 
           [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82815 CGC [Chipset Graphics Controller]" ]; then
1292
 
          MONITOR_SYNC_RANGES="yes"
1293
 
          debug_echo "i810 laptop chipset detected; writing sync ranges"
1294
 
        fi
1295
 
      fi
1296
 
    fi
1297
 
  else
1298
 
    # reconfiguring. debconf should have sane defaults
1299
 
    db_get xserver-xorg/config/display/modes || debug_echo "db_get xserver-xorg/config/display/modes"
1300
 
    RESOLUTIONS=$(echo "$RET" | sed -e 's/,//g')
1301
 
    db_get xserver-xorg/config/monitor/horiz-sync || debug_echo "db_get xserver-xorg/config/monitor/horiz-sync"
1302
 
    HORIZ_SYNC="$RET"
1303
 
    db_get xserver-xorg/config/monitor/vert-refresh || debug_echo "db_get xserver-xorg/config/monitor/vert-refresh"
1304
 
    VERT_REFRESH="$RET"
1305
 
    db_get xserver-xorg/config/monitor/use_sync_ranges || debug_echo "db_get xserver-xorg/config/monitor/use_sync_ranges"
1306
 
    if [ "$RET" = "true" ]; then
1307
 
      MONITOR_SYNC_RANGES="yes"
1308
 
      debug_echo "preserving sync ranges from debconf"
1309
 
    fi
1310
 
  fi
1311
 
 
1312
 
 
1313
 
  # Resolution hell:
1314
 
  # we need to know if we probed resolutions, if so add them to debconf template
1315
 
  # as choices, so that we don't lose them across updates or reconfiguration.
1316
 
  PRIORITY="high"
1317
 
  if [ -n "$AUTODETECT_VIDEO" ]; then
1318
 
    NRES=0
1319
 
    for i in $RESOLUTIONS; do
1320
 
      NRES="$(expr $NRES + 1)"
1321
 
    done
1322
 
 
1323
 
    if [ "$NRES" -gt "0" ]; then
1324
 
      # got RESOLUTIONS. Lower question priority
1325
 
      PRIORITY=medium
1326
 
      DCRESOLUTIONS="$(for i in $DCRESOLUTIONS $RESOLUTIONS; do echo $i; done | sort -t x -k1,1nr -k2,2nr -u)"
1327
 
      DCRESOLUTIONS="$(echo $DCRESOLUTIONS | sed -e 's/ /, /g')"
1328
 
    fi
1329
 
 
1330
 
    # if we're not running an internal panel and we don't have a list of sync
1331
 
    # ranges, X isn't going to be able to figure it out; give it a hand
1332
 
    if [ -z "$UPGRADE" ]; then
1333
 
      if ! [ "$DISPLAY_TYPE" = "lcd/lvds" ]; then
1334
 
        if [ -z "$HORIZ_SYNC" ] || [ -z "$VERT_REFRESH" ]; then
1335
 
          # the actual default sync ranges are calculated further down
1336
 
          MONITOR_SYNC_RANGES="yes"
1337
 
          debug_echo "no sync ranges available from DDC; writing own ranges"
1338
 
        fi
1339
 
      fi
1340
 
    fi
1341
 
  fi
1342
 
 
1343
 
  if [ -n "$UPGRADE" ]; then
1344
 
    # drop priority on upgrades
1345
 
    PRIORITY="medium"
1346
 
  fi
1347
 
 
1348
 
  db_metaget xserver-xorg/config/display/modes choices
1349
 
  DEFRESOLUTIONS="$(echo @DEFAULT_DCRESOLUTIONS@ | sed -e 's/, / /g')"
1350
 
  if [ -n "$RET" ]; then
1351
 
    DCRESOLUTIONS="$RET"
1352
 
    DCRESOLUTIONS="$(echo $DCRESOLUTIONS | sed -e 's/, / /g')"
1353
 
  else
1354
 
    DCRESOLUTIONS=$DEFRESOLUTIONS
1355
 
  fi
1356
 
  if [ -n "$RESOLUTIONS" ]; then
1357
 
    DCRESOLUTIONS="$(for i in $DCRESOLUTIONS $DEFRESOLUTIONS $RESOLUTIONS; do echo $i; done | sort -t x -k1,1nr -k2,2nr -u)"
1358
 
  fi
1359
 
  # set the old choice + the probed ones (if any).
1360
 
  DCRESOLUTIONS="$(echo $DCRESOLUTIONS | sed -e 's/ /, /g')"
1361
 
  db_subst xserver-xorg/config/display/modes choices "$DCRESOLUTIONS"
1362
 
  if [ -n "$RESOLUTIONS" ]; then
1363
 
    RESOLUTIONS="$(echo $RESOLUTIONS | sed -e 's/ /, /g')"
1364
 
    db_set xserver-xorg/config/display/modes "$RESOLUTIONS"
1365
 
  fi
1366
 
  db_input $PRIORITY xserver-xorg/config/display/modes || debug_echo "db_input $PRIORITY xserver-xorg/config/display/modes"
1367
 
  db_go
1368
 
 
1369
 
  db_subst xserver-xorg/config/monitor/selection-method choices "Simple, Medium, Advanced"
1370
 
  db_subst xserver-xorg/config/monitor/selection-method default "Medium"
1371
 
 
1372
 
  if [ -n "$AUTODETECT_VIDEO" ]; then
1373
 
    if [ -n "$HORIZ_SYNC" ] && [ -n "$VERT_REFRESH" ]; then
1374
 
      # monitor frequencies detected, we set them as defaults and we switch to Advanced mode.
1375
 
      # there is no need to get crazy feeding "Medium"
1376
 
      db_set xserver-xorg/config/monitor/horiz-sync "$HORIZ_SYNC"
1377
 
      db_set xserver-xorg/config/monitor/vert-refresh "$VERT_REFRESH"
1378
 
      db_set xserver-xorg/config/monitor/selection-method "Advanced"
1379
 
    else
1380
 
      # if we are here we did not detect the frequencies, but we have the resolution.
1381
 
      # get the highest resolution.
1382
 
      db_get xserver-xorg/config/display/modes || debug_echo "db_get xserver-xorg/config/display/modes"
1383
 
      if [ -n "$RET" ]; then
1384
 
        # Only do this if the user selects at least one mode to write to the 
1385
 
        # conf file. If not, then the section won't be written by dexconf
1386
 
        # and the server will pick the highest mode it can figure out
1387
 
        MAXRES="$(echo $RET | sed -e 's/,//g')"
1388
 
        MAXRES="$(for i in $MAXRES; do echo $i; done | sort -t x -k1,1nr -k2,2nr -u | head -n 1)"
1389
 
        # set a sane default for mode-list
1390
 
        MAXRES="$MAXRES @ 60Hz"
1391
 
        db_set xserver-xorg/config/monitor/mode-list "$MAXRES"
1392
 
        # apparently all the known resolution/horiz-sync combinantion have a ratio that
1393
 
        # can go from 19 to 21. Only one exception was 18. We can safely assume a ratio of 20
1394
 
        # for default setup. DDC should do the rest.
1395
 
        HMAX=$(echo "$MAXRES" | cut -d "x" -f 1)
1396
 
        HMAX=$(expr "$HMAX" / 20)
1397
 
        # set sane defaults as fallback, in case there is no mode-list match otherwise we
1398
 
        # prefer a well known match.
1399
 
        HORIZ_SYNC="28-$HMAX"
1400
 
        VERT_REFRESH="43-60"
1401
 
        db_set xserver-xorg/config/monitor/horiz-sync "$HORIZ_SYNC"
1402
 
        db_set xserver-xorg/config/monitor/vert-refresh "$VERT_REFRESH"
1403
 
        db_set xserver-xorg/config/monitor/selection-method "Advanced"
1404
 
      fi
1405
 
    fi
1406
 
  fi
1407
 
 
1408
 
  db_input low xserver-xorg/config/monitor/selection-method || debug_echo "db_input low xserver-xorg/config/monitor/selection-method"
1409
 
  db_go
1410
 
 
1411
 
  db_get xserver-xorg/config/monitor/selection-method
1412
 
  case "$RET" in
1413
 
    Simple)
1414
 
      db_input low xserver-xorg/config/monitor/screen-size || debug_echo "db_input low xserver-xorg/config/monitor/screen-size"
1415
 
      db_go
1416
 
      db_get xserver-xorg/config/monitor/screen-size
1417
 
      case "$RET" in
1418
 
        'Up to 14 inches (355 mm)')
1419
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-33"
1420
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1421
 
          ;;
1422
 
        '15 inches (380 mm)')
1423
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-50"
1424
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-75"
1425
 
          ;;
1426
 
        '17 inches (430 mm)')
1427
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-70"
1428
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-160"
1429
 
          ;;
1430
 
        '19-20 inches (480-510 mm)')
1431
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-100"
1432
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-160"
1433
 
          ;;
1434
 
        '21 inches (530 mm) or more')
1435
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-130"
1436
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-160"
1437
 
          ;;
1438
 
      esac
1439
 
      ;;
1440
 
    Medium)
1441
 
      db_input low xserver-xorg/config/monitor/mode-list || true
1442
 
      db_go
1443
 
      if [ -n "$MAXRES" ]; then
1444
 
        RET="$MAXRES"
1445
 
      else
1446
 
        db_get xserver-xorg/config/monitor/mode-list
1447
 
      fi
1448
 
      case "$RET" in
1449
 
        "640x480 @ 60Hz")
1450
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-33"
1451
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1452
 
          ;;
1453
 
        "640x480 @ 72Hz")
1454
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-38"
1455
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1456
 
          ;;
1457
 
        "800x600 @ 60Hz")
1458
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-38"
1459
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1460
 
          ;;
1461
 
        "800x600 @ 72Hz")
1462
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-48"
1463
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1464
 
          ;;
1465
 
        "800x600 @ 85Hz")
1466
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-54"
1467
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1468
 
          ;;
1469
 
        "832x624 @ 75Hz")
1470
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-50"
1471
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1472
 
          ;;
1473
 
        "1024x768 @ 60Hz")
1474
 
          db_set xserver-xorg/config/monitor/horiz-sync "28-49"
1475
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1476
 
          ;;
1477
 
        "1024x768 @ 70Hz")
1478
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-57"
1479
 
          db_set xserver-xorg/config/monitor/vert-refresh "43-72"
1480
 
          ;;
1481
 
        "1024x768 @ 75Hz")
1482
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-60"
1483
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1484
 
          ;;
1485
 
        "1152x768 @ 54.8Hz")
1486
 
          # This is a 15" PowerBook G4 mode; its video hardware (LCD) was also
1487
 
          # capable of 896x600 and 720x480 pixels at a 3:2 aspect ratio and
1488
 
          # 1024x768, 800x600, and 640x480 pixels at a 4:3 aspect ratio, so give
1489
 
          # its horizontal and vertical ranges a little more "headroom" than
1490
 
          # that required by this specific mode to accomodate the others.
1491
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-50"
1492
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-72"
1493
 
          ;;
1494
 
        "1152x864 @ 60Hz")
1495
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-68"
1496
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-70"
1497
 
          ;;
1498
 
        "1152x864 @ 75Hz")
1499
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-68"
1500
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1501
 
          ;;
1502
 
        "1280x768 @ 60Hz")
1503
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-65"
1504
 
          db_set xserver-xorg/config/monitor/vert-refresh "30-60"
1505
 
          ;;
1506
 
        "1280x800 @ 60Hz")
1507
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-67"
1508
 
          db_set xserver-xorg/config/monitor/vert-refresh "30-60"
1509
 
          ;;
1510
 
        "1280x960 @ 60Hz")
1511
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-60"
1512
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1513
 
          ;;
1514
 
        "1280x960 @ 85Hz")
1515
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-92"
1516
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1517
 
          ;;
1518
 
        "1280x1024 @ 60Hz")
1519
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-65"
1520
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1521
 
          ;;
1522
 
        "1400x1050 @ 60Hz")
1523
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-67"
1524
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1525
 
          ;;
1526
 
        "1400x1050 @ 75Hz")
1527
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-85"
1528
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-80"
1529
 
          ;;
1530
 
        "1600x1024 @ 85Hz")
1531
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-70"
1532
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-90"
1533
 
          ;;
1534
 
        "1600x1200 @ 60Hz")
1535
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-75"
1536
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1537
 
          ;;
1538
 
        "1600x1200 @ 75Hz")
1539
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-94"
1540
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1541
 
          ;;
1542
 
        "1600x1200 @ 85Hz")
1543
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-107"
1544
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1545
 
          ;;
1546
 
        "1680x1050 @ 60Hz")
1547
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-90"
1548
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-60"
1549
 
          ;;
1550
 
        "1792x1344 @ 75Hz")
1551
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-107"
1552
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-85"
1553
 
          ;;
1554
 
        "1792x1344 @ 60Hz")
1555
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-84"
1556
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1557
 
          ;;
1558
 
        "1856x1392 @ 60Hz")
1559
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-87"
1560
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1561
 
          ;;
1562
 
        "1856x1392 @ 75Hz")
1563
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-113"
1564
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1565
 
          ;;
1566
 
        "1920x1200 @ 60Hz")
1567
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-75"
1568
 
          db_set xserver-xorg/config/monitor/vert-refresh "30-60"
1569
 
          ;;
1570
 
        "1920x1440 @ 60Hz")
1571
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-90"
1572
 
          db_set xserver-xorg/config/monitor/vert-refresh "50-75"
1573
 
          ;;
1574
 
        "1920x1440 @ 75Hz")
1575
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-130"
1576
 
          db_set xserver-xorg/config/monitor/vert-refresh "60-160"
1577
 
          ;;
1578
 
        "1920x1440 @ 85Hz")
1579
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-130"
1580
 
          db_set xserver-xorg/config/monitor/vert-refresh "60-160"
1581
 
          ;;
1582
 
        "2048x1536 @ 60Hz")
1583
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-100"
1584
 
          db_set xserver-xorg/config/monitor/vert-refresh "60-85"
1585
 
          ;;
1586
 
        "2048x1536 @ 75Hz")
1587
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-125"
1588
 
          db_set xserver-xorg/config/monitor/vert-refresh "60-100"
1589
 
          ;;
1590
 
        "2048x1536 @ 85Hz")
1591
 
          db_set xserver-xorg/config/monitor/horiz-sync "30-140"
1592
 
          db_set xserver-xorg/config/monitor/vert-refresh "60-160"
1593
 
          ;;
1594
 
      esac
1595
 
      ;;
1596
 
    Advanced)
1597
 
      validate_monitor_frequency_db_input low xserver-xorg/config/monitor/horiz-sync || true
1598
 
      validate_monitor_frequency_db_input low xserver-xorg/config/monitor/vert-refresh || true
1599
 
      db_go
1600
 
      ;;
1601
 
  esac
1602
 
 
1603
 
  # don't write sync ranges if it's exactly what we picked up from DDC
1604
 
  db_get xserver-xorg/config/monitor/horiz-sync
1605
 
  USER_HSYNC="$RET"
1606
 
  db_get xserver-xorg/config/monitor/vert-refresh
1607
 
  USER_VREFRESH="$RET"
1608
 
  if [ -z "$UPGRADE" ]; then
1609
 
    if [ -n "$AUTODETECT_VIDEO" ]; then
1610
 
       if ! [ "$USER_HSYNC" = "$HORIZ_SYNC" ] || \
1611
 
          ! [ "$USER_VREFRESH" = "$VERT_REFRESH" ]; then
1612
 
        MONITOR_SYNC_RANGES="yes"
1613
 
        debug_echo "writing out user-customised sync ranges"
1614
 
       fi
1615
 
    else
1616
 
      # always write them out if we refused probing for some reason
1617
 
      MONITOR_SYNC_RANGES="yes"
1618
 
      debug_echo "not probing; writing out sync ranges"
1619
 
    fi
1620
 
    # we don't do anything here because we're just upgrading; leave it alone.
1621
 
  fi
1622
 
 
1623
 
  if [ -n "$MONITOR_SYNC_RANGES" ]; then
1624
 
    db_set xserver-xorg/config/monitor/use_sync_ranges true
1625
 
  fi
1626
 
  db_input low xserver-xorg/config/monitor/use_sync_ranges || debug_echo "db_input low xserver-xorg/config/monitor/use_sync_ranges"
1627
 
 
1628
 
  case "$DEVICE_DRIVER" in
1629
 
    # nVidia laptop chipsets should use 16bpp per default, or face horrific
1630
 
    # colour banding issues, per Olivier Grawert and Trent Lloyd.
1631
 
    nv)
1632
 
      if [ -n "$LAPTOP" ]; then
1633
 
        DEFAULT_DEPTH=16
1634
 
      else
1635
 
        DEFAULT_DEPTH=24
1636
 
      fi
1637
 
      ;;
1638
 
    *)
1639
 
      DEFAULT_DEPTH=24
1640
 
      ;;
1641
 
  esac
1642
 
 
1643
 
  if [ -n "$DISPLAY_DEPTH" ]; then
1644
 
    DEFAULT_DEPTH="$DISPLAY_DEPTH"
1645
 
  fi
1646
 
 
1647
 
  db_fget xserver-xorg/config/display/default_depth seen
1648
 
  if [ "$RET" = "false" ]; then
1649
 
    db_set xserver-xorg/config/display/default_depth $DEFAULT_DEPTH
1650
 
  fi
1651
 
 
1652
 
  db_input low xserver-xorg/config/display/default_depth || true
1653
 
  db_go
1654
 
}
1655
 
 
1656
1070
# register this package as a (potential) handler of the X server symlink and
1657
1071
# X.Org X server configuration file
1658
1072
for ROSTER in "$SERVER_SYMLINK_ROSTER" "$XORGCONFIG_ROSTER"; do
1671
1085
  ln -s "$THIS_SERVER" "$SERVER_SYMLINK"
1672
1086
fi
1673
1087
 
 
1088
if [ -n "$UPGRADE" ] && dpkg --compare-versions "$2" le "1:7.3+5"; then
 
1089
        # Clean up our old crap
 
1090
        rm -f "$SERVER_SYMLINK_CHECKSUM" "$SERVER_SYMLINK_ROSTER"
 
1091
        for QUESTION in "shared/default-x-server" \
 
1092
                        "xserver-xorg/autodetect_mouse" \
 
1093
                        "xserver-xorg/autodetect_monitor" \
 
1094
                        "xserver-xorg/config/monitor/selection-method" \
 
1095
                        "xserver-xorg/config/monitor/screen-size" \
 
1096
                        "xserver-xorg/config/monitor/mode-list" \
 
1097
                        "xserver-xorg/config/monitor/default-identifier" \
 
1098
                        "xserver-xorg/config/monitor/horiz-sync" \
 
1099
                        "xserver-xorg/config/monitor/vert-refresh" \
 
1100
                        "xserver-xorg/config/monitor/range_input_error" \
 
1101
                        "xserver-xorg/config/display/modes" \
 
1102
                        "xserver-xorg/config/device/video_ram" \
 
1103
                        "xserver-xorg/config/display/default_depth" \
 
1104
                        "xserver-xorg/config/inputdevice/mouse/port" \
 
1105
                        "xserver-xorg/config/inputdevice/mouse/protocol" \
 
1106
                        "xserver-xorg/config/modules" \
 
1107
                        "xserver-xorg/config/monitor/default-identifier" \
 
1108
                        "xserver-xorg/config/monitor/identifier" \
 
1109
                        "xserver-xorg/config/write_files_section"; do
 
1110
          db_unregister "$QUESTION" || true
 
1111
        done
 
1112
fi
 
1113
 
 
1114
# no debconf interaction should be done after this point
 
1115
# (the dexconf call below invokes db_stop)
 
1116
 
1674
1117
# Don't touch the config on upgrades except to deal with known issues with old
1675
1118
# configs.
1676
1119
if [ -z "$UPGRADE" ] || dpkg --compare-versions "$2" le "1:7.0.14"; then
1682
1125
    # they match or user deleted the file or they're running dpkg-reconfigure; 
1683
1126
    # prepare a new version
1684
1127
    NEW_XORGCONFIG="$XORGCONFIG.dpkg-new"
1685
 
    if [ -n "$XRESPROBE_DEBUG" ]; then
1686
 
      set -x
1687
 
    fi
1688
 
    xresprobeint
1689
 
    if [ -n "$XRESPROBE_DEBUG" ]; then
1690
 
      set +x
1691
 
    fi
1692
1128
    if [ -n "$RECONFIGURE" ] && [ -e "$XORGCONFIG" ]; then
1693
1129
      BACKUP_XORGCONFIG="$XORGCONFIG.$(date '+%Y%m%d%H%M%S')"
1694
1130
      if [ -e "$BACKUP_XORGCONFIG" ]; then
1755
1191
  debug_echo "not updating $XORGCONFIG; we're upgrading"
1756
1192
fi
1757
1193
 
1758
 
if [ -n "$UPGRADE" ] && dpkg --compare-versions "$2" le "1:7.3+5"; then
1759
 
        # Clean up our old crap
1760
 
        rm -f "$SERVER_SYMLINK_CHECKSUM" "$SERVER_SYMLINK_ROSTER"
1761
 
        for QUESTION in "shared/default-x-server" "xserver-xorg/autodetect_mouse" \
1762
 
                        "xserver-xorg/config/device/video_ram" \
1763
 
                        "xserver-xorg/config/inputdevice/mouse/port" \
1764
 
                        "xserver-xorg/config/inputdevice/mouse/protocol" \
1765
 
                        "xserver-xorg/config/modules" \
1766
 
                        "xserver-xorg/config/monitor/default-identifier" \
1767
 
                        "xserver-xorg/config/monitor/identifier" \
1768
 
                        "xserver-xorg/config/write_files_section"; do
1769
 
          db_unregister "$QUESTION" || true
1770
 
        done
1771
 
fi
1772
 
 
1773
1194
exit 0
1774
1195
 
1775
1196
# vim:set ai et sts=2 sw=2 tw=0: