home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / dexconf < prev    next >
Encoding:
Text File  |  2007-04-02  |  15.0 KB  |  570 lines

  1. #!/bin/sh
  2.  
  3. # dexconf: Debian X server configuration file writer
  4. #
  5. # This tool is a backend which uses debconf database values.  It writes an
  6. # XFree86 X server configuration file based on the information in the database.
  7. #
  8. # Author: Branden Robinson
  9.  
  10. # Copyright 2000--2004 Progeny Linux Systems, Inc.
  11. #
  12. # This is free software; you may redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as
  14. # published by the Free Software Foundation; either version 2,
  15. # or (at your option) any later version.
  16. #
  17. # This is distributed in the hope that it will be useful, but
  18. # WITHOUT ANY WARRANTY; without even the implied warranty of
  19. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. # GNU General Public License for more details.
  21. #
  22. # You should have received a copy of the GNU General Public License with
  23. # the Debian operating system, in /usr/share/common-licenses/GPL;  if
  24. # not, write to the Free Software Foundation, Inc., 59 Temple Place,
  25. # Suite 330, Boston, MA 02111-1307 USA
  26.  
  27. set -e
  28.  
  29. # source debconf library
  30. . /usr/share/debconf/confmodule
  31.  
  32. # display a usage message
  33. usage () {
  34.   cat <<EOF
  35. Usage: $PROGNAME [OPTION ...]
  36.   write an Xorg X server configuration file based on debconf database values
  37. Options:
  38.   -h, --help                                 display this usage message and exit
  39.   -o FILE, --output=FILE                        write configuration file to FILE
  40. This help message is intended only as a quick reference.  For a description of
  41. the usage of $PROGNAME, see the $PROGNAME(1) manual page.
  42. EOF
  43. }
  44.  
  45. # the error-out function
  46. bomb () {
  47.   echo "$PROGNAME: error: $*" | fold -s -w "${COLUMNS:-80}" >&2
  48.   exit 1
  49. }
  50.  
  51. # wrapper around db_get to ensure that the info we try to retrieve exists; it
  52. # is (almost) always a fatal error for the values to be null
  53. fetch () {
  54.   db_get "$1" || true
  55.   if [ -z "$RET" ]; then
  56.     ERRMSG="cannot generate configuration file; $1 not set.  Aborting."
  57.     ERRMSG="$ERRMSG  Reconfigure the X server with \"dpkg-reconfigure"
  58.     if [ -n "$XSERVERPKG" ]; then
  59.       ERRMSG="$ERRMSG $XSERVERPKG"
  60.     fi
  61.     ERRMSG="$ERRMSG\" to correct this problem."
  62.     bomb "$ERRMSG"
  63.   fi
  64. }
  65.  
  66. # convert a debconf comma-delimited list to a shell whitespace-delimited list
  67. list_convert () {
  68.   echo $(IFS=", "; set -- $RET; while [ $# -gt 0 ]; do echo \"$1\"; shift; done)
  69. }
  70.  
  71. PROGNAME=${0##*/}
  72. SHOWHELP=
  73. EARLYEXIT=
  74.  
  75. GETOPT_OUTPUT=$(getopt --options ho: \
  76.                        --longoptions help,output: \
  77.                        -n "$PROGNAME" -- "$@")
  78.  
  79. if [ $? -ne 0 ]; then
  80.     bomb "error while getting options; use \"$PROGNAME --help\" for help"
  81. fi
  82.  
  83. eval set -- "$GETOPT_OUTPUT"
  84.  
  85. while :; do
  86.     case "$1" in
  87.         -f|--format)
  88.           bomb "This option, and XFree86 3.x output, are no longer supported."
  89.           ;;
  90.         -h|--help) SHOWHELP=yes EARLYEXIT=yes ;;
  91.         -o|--output) XF86CONFIG="$2"; shift ;;
  92.         --) shift; break ;;
  93.         *)
  94.           bomb "unrecognized option \"$1\"; use \"$PROGNAME --help\" for help"
  95.           ;;
  96.     esac
  97.     shift
  98. done
  99.  
  100. if [ -n "$SHOWHELP" ]; then
  101.     usage
  102. fi
  103.  
  104. if [ -n "$EARLYEXIT" ]; then
  105.     exit 0
  106. fi
  107.  
  108.  
  109. if which laptop-detect >/dev/null 2>&1; then
  110.   if laptop-detect > /dev/null ; then
  111.     LAPTOP=true
  112.   fi
  113. fi
  114.  
  115. DEXCONFTMPDIR=
  116.  
  117. trap 'if [ -e "$DEXCONFTMPDIR/backup" ] && [ -n "$XF86CONFIG" ]; then \
  118.         cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG"; \
  119.       fi; \
  120.       exec 4<&-; \
  121.       rm -rf "$DEXCONFTMPDIR"; \
  122.       bomb "received signal; aborting"' HUP INT QUIT TERM
  123.  
  124. # Ensure we know how to write a configuation file for the X server in use.
  125. fetch shared/default-x-server
  126. XSERVERPKG="$RET"
  127. case "$XSERVERPKG" in
  128.   xserver-xorg|xserver-xorg-dbg|xserver-xorg-core)
  129.     : ${XF86CONFIG:=/etc/X11/xorg.conf}
  130.     REALCONFIG="/etc/X11/xorg.conf"
  131.     SERVER="xorg"
  132.     ;;
  133.   *)
  134.     bomb "this program does not know how to configure the \"$XSERVERPKG\" X" \
  135.       "server"
  136. esac
  137.  
  138. # Set up a temporary directory for the files we'll be writing.
  139. TDIR_PARENT="${TMPDIR:-/tmp}"
  140. TDIR="${TMPDIR:-/tmp}/dexconf-tmp-$$"
  141.  
  142. if [ ! -d "$TDIR_PARENT" ]; then
  143.   bomb "cannot create temporary work directory; \"$TDIR_PARENT\" does not" \
  144.     "exist or is not a directory"
  145. fi
  146.  
  147. if [ ! -w "$TDIR_PARENT" ]; then
  148.   bomb "cannot create temporary work directory in \"$TDIR_PARENT\"; directory" \
  149.     "not writable"
  150. fi
  151.  
  152. rm -rf "$TDIR"
  153.  
  154. if mkdir -m 0700 "$TDIR"; then
  155.   DEXCONFTMPDIR="$TDIR"
  156. else
  157.   bomb "creation of temporary work directory \"$TDIR\" failed"
  158. fi
  159.  
  160. # xorg.conf sections:
  161. #   Files          File pathnames
  162. #   ServerFlags    Server flags                      NOT USED BY DEXCONF
  163. #   Module         Dynamic module loading
  164. #   InputDevice    Input device description
  165. #   Device         Graphics device description
  166. #   VideoAdaptor   Xv video adaptor description      NOT USED BY DEXCONF
  167. #   Monitor        Monitor description
  168. #   Modes          Video modes descriptions          NOT USED BY DEXCONF
  169. #   Screen         Screen configuration
  170. #   ServerLayout   Overall layout
  171. #   DRI            DRI-specific configuration
  172. #   Vendor         Vendor-specific configuration     NOT USED BY DEXCONF
  173.  
  174. ### HEADER
  175.  
  176. # Because debconf hijacks standard output and its confmodule uses file
  177. # descriptor 3 for its own purposes, we will write our output to file descriptor
  178. # 4 instead of standard output.
  179.  
  180. exec 4>"$DEXCONFTMPDIR/Header"
  181. cat >&4 <<SECTION
  182. # $REALCONFIG ($SERVER X Window System server configuration file)
  183. #
  184. # This file was generated by dexconf, the Debian X Configuration tool, using
  185. # values from the debconf database.
  186. #
  187. # Edit this file with caution, and see the xorg.conf(5) manual page.
  188. # (Type "man xorg.conf" at the shell prompt.)
  189. #
  190. # This file is automatically updated on $XSERVERPKG package upgrades *only*
  191. # if it has not been modified since the last upgrade of the $XSERVERPKG
  192. # package.
  193. #
  194. # If you have edited this file but would like it to be automatically updated
  195. # again, run the following command:
  196. #   sudo dpkg-reconfigure -phigh $XSERVERPKG
  197. SECTION
  198.  
  199. ### FILES
  200.  
  201. fetch xserver-$SERVER/config/write_files_section
  202. if [ "$RET" = "true" ]; then
  203.   FONTSERVER=""
  204.   if db_get shared/fontpath/fontserver; then
  205.     if [ -n "$RET" ] ; then
  206.       FONTSERVER="$RET"
  207.     fi
  208.   fi
  209.   exec 4>"$DEXCONFTMPDIR/Files"
  210.   cat >&4 <<SECTION
  211. Section "Files"
  212. SECTION
  213.   if [ -n "$FONTSERVER" ] ; then
  214.       cat >&4 <<SECTION
  215.     FontPath    "$FONTSERVER"
  216. SECTION
  217.   fi
  218.   cat >&4 <<SECTION
  219.     FontPath    "/usr/share/fonts/X11/misc"
  220.     FontPath    "/usr/share/fonts/X11/cyrillic"
  221.     FontPath    "/usr/share/fonts/X11/100dpi/:unscaled"
  222.     FontPath    "/usr/share/fonts/X11/75dpi/:unscaled"
  223.     FontPath    "/usr/share/fonts/X11/Type1"
  224.     FontPath    "/usr/share/fonts/X11/100dpi"
  225.     FontPath    "/usr/share/fonts/X11/75dpi"
  226.     # path to defoma fonts
  227.     FontPath    "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
  228. EndSection
  229. SECTION
  230. fi
  231.  
  232. ### MODULE
  233.  
  234. # The module list is permitted to be null.
  235. db_get xserver-$SERVER/config/modules || true
  236. if [ -n "$RET" ]; then
  237.   MODULES=$(list_convert "$RET")
  238.   exec 4>"$DEXCONFTMPDIR/Module"
  239.   printf "Section \"Module\"\n" >&4
  240.   for MODULE in $MODULES; do
  241.     printf "\tLoad\t$MODULE\n" >&4
  242.   done
  243.   printf "EndSection\n" >&4
  244. fi
  245.  
  246. ### KEYBOARD / INPUTDEVICE
  247.  
  248. fetch xserver-$SERVER/config/inputdevice/keyboard/rules
  249. XKB_RULES="$RET"
  250. fetch xserver-$SERVER/config/inputdevice/keyboard/model
  251. XKB_MODEL="$RET"
  252. fetch xserver-$SERVER/config/inputdevice/keyboard/layout
  253. XKB_LAYOUT="$RET"
  254. # XkbVariant and XkbOptions are permitted to be null.
  255. db_get xserver-$SERVER/config/inputdevice/keyboard/variant
  256. XKB_VARIANT="$RET"
  257. db_get xserver-$SERVER/config/inputdevice/keyboard/options
  258. XKB_OPTIONS="$RET"
  259.  
  260. exec 4>"$DEXCONFTMPDIR/InputDeviceKeyboard"
  261. cat >&4 <<SECTION
  262. Section "InputDevice"
  263.     Identifier    "Generic Keyboard"
  264.     Driver        "kbd"
  265.     Option        "CoreKeyboard"
  266.     Option        "XkbRules"    "$XKB_RULES"
  267.     Option        "XkbModel"    "$XKB_MODEL"
  268.     Option        "XkbLayout"    "$XKB_LAYOUT"
  269. SECTION
  270. if [ -n "$XKB_VARIANT" ]; then
  271.   printf "\tOption\t\t\"XkbVariant\"\t\"$XKB_VARIANT\"\n" >&4
  272. fi
  273. if [ -n "$XKB_OPTIONS" ]; then
  274.   printf "\tOption\t\t\"XkbOptions\"\t\"$XKB_OPTIONS\"\n" >&4
  275. fi
  276. printf "EndSection\n" >&4
  277.  
  278. ### MOUSE / INPUTDEVICE
  279.  
  280. DO_EMULATE3BUTTONS=
  281.  
  282. fetch xserver-$SERVER/config/inputdevice/mouse/port
  283. MOUSE_PORT="$RET"
  284. fetch xserver-$SERVER/config/inputdevice/mouse/protocol
  285. MOUSE_PROTOCOL="$RET"
  286. fetch xserver-$SERVER/config/inputdevice/mouse/emulate3buttons
  287. if [ "$RET" = "true" ]; then
  288.   DO_EMULATE3BUTTONS=true
  289. fi
  290.  
  291. exec 4>"$DEXCONFTMPDIR/InputDeviceMouse"
  292. cat >&4 <<SECTION
  293. Section "InputDevice"
  294.     Identifier    "Configured Mouse"
  295.     Driver        "mouse"
  296.     Option        "CorePointer"
  297.     Option        "Device"        "$MOUSE_PORT"
  298.     Option        "Protocol"        "$MOUSE_PROTOCOL"
  299.     Option        "ZAxisMapping"        "4 5"
  300. SECTION
  301. if [ -n "$DO_EMULATE3BUTTONS" ]; then
  302.   printf "\tOption\t\t\"Emulate3Buttons\"\t\"true\"\n" >&4
  303. fi
  304. printf "EndSection\n" >&4
  305.  
  306. if [ -n "$LAPTOP" ]; then
  307.   cat >&4 <<SECTION
  308.  
  309. Section "InputDevice"
  310.     Identifier    "Synaptics Touchpad"
  311.     Driver        "synaptics"
  312.     Option        "SendCoreEvents"    "true"
  313.     Option        "Device"        "/dev/psaux"
  314.     Option        "Protocol"        "auto-dev"
  315.     Option        "HorizScrollDelta"    "0"
  316. EndSection
  317. SECTION
  318. fi
  319.  
  320. cat >&4 <<SECTION
  321.  
  322. Section "InputDevice"
  323.     Driver        "wacom"
  324.     Identifier    "stylus"
  325.     Option        "Device"    "/dev/input/wacom"
  326.     Option        "Type"        "stylus"
  327.     Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
  328. EndSection
  329.  
  330. Section "InputDevice"
  331.     Driver        "wacom"
  332.     Identifier    "eraser"
  333.     Option        "Device"    "/dev/input/wacom"
  334.     Option        "Type"        "eraser"
  335.     Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
  336. EndSection
  337.  
  338. Section "InputDevice"
  339.     Driver        "wacom"
  340.     Identifier    "cursor"
  341.     Option        "Device"    "/dev/input/wacom"
  342.     Option        "Type"        "cursor"
  343.     Option        "ForceDevice"    "ISDV4"        # Tablet PC ONLY
  344. EndSection
  345. SECTION
  346.  
  347. ### DEVICE
  348.  
  349. fetch xserver-$SERVER/config/device/identifier
  350. DEVICE_IDENTIFIER="$RET"
  351. fetch xserver-$SERVER/config/device/driver
  352. DEVICE_DRIVER="$RET"
  353. # BusID, VideoRam, and UseFBDev are permitted to be null.
  354. db_get xserver-$SERVER/config/device/bus_id
  355. DEVICE_BUSID="$RET"
  356. db_get xserver-$SERVER/config/device/video_ram
  357. DEVICE_VIDEO_RAM="$RET"
  358. db_get xserver-$SERVER/config/device/use_fbdev
  359. DEVICE_USE_FBDEV="$RET"
  360. db_capb backup escape
  361. db_get xserver-$SERVER/config/device/extra_options
  362. DEVICE_EXTRA_OPTIONS="$RET"
  363. db_capb backup
  364. fetch xserver-$SERVER/config/monitor/identifier
  365. MONITOR_IDENTIFIER="$RET"
  366. exec 4>"$DEXCONFTMPDIR/Device"
  367. cat >&4 <<SECTION
  368. Section "Device"
  369.     Identifier    "$DEVICE_IDENTIFIER"
  370.     Driver        "$DEVICE_DRIVER"
  371. SECTION
  372. PS3_FB=$(grep PS3 /proc/fb 2>/dev/null || true)
  373. if [ -n "$PS3_FB" ]; then
  374.   printf "\tOption\t\t\"ShadowFB\"\t\t\"false\"\n" >&4
  375. fi
  376. if [ -n "$DEVICE_BUSID" ]; then
  377.   printf "\tBusID\t\t\"$DEVICE_BUSID\"\n" >&4
  378. fi
  379. if [ -n "$DEVICE_VIDEO_RAM" ]; then
  380.    printf "\tVideoRam\t$DEVICE_VIDEO_RAM\n" >&4
  381. fi
  382. if [ "$DEVICE_USE_FBDEV" = "true" ]; then
  383.   printf "\tOption\t\t\"UseFBDev\"\t\t\"$DEVICE_USE_FBDEV\"\n" >&4
  384. fi
  385. if [ "$DEVICE_DRIVER" = "i810" ] && \
  386.   [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82852/855GM Integrated Graphics Device" ] && \
  387.     [ "$MONITOR_IDENTIFIER" = "3M Touchscreen" ]; then
  388.       printf "\tOption\t\t\"DisplayInfo\"\t\t\"False\"\n" >&4
  389. fi
  390. if [ "$DEVICE_DRIVER" = "mga" ]; then
  391.   printf "\tOption\t\t\"OldDmaInit\"\t\t\"True\"\n" >&4
  392. fi
  393. printf "$DEVICE_EXTRA_OPTIONS" | perl -nae 'print "\tOption\t\t\"$F[0]\"\t\t\"@F[1..$#F]\"\n"' >&4
  394. printf "EndSection\n" >&4
  395.  
  396. ### EXTENSIONS ###
  397.  
  398. # fglrx driver does not support composite, and enabling it by default (as done
  399. # in xserver-xorg) breaks DRI.
  400. if [ "$DEVICE_DRIVER" = "fglrx" ]; then
  401.   cat >&4 <<SECTION
  402.  
  403. Section "Extensions"
  404.     Option        "Composite"    "0"
  405. EndSection
  406. SECTION
  407. fi
  408.  
  409. ### Elographic touch screen. It's both screen and input..
  410.  
  411. ELOTOUCH=no
  412. if [ "$DEVICE_DRIVER" = "i810" ] && \
  413.    [ "$DEVICE_IDENTIFIER" = "Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device" ] && \
  414.    [ "$MONITOR_IDENTIFIER" = "Elographic Screen" ]; then
  415. ELOTOUCH=yes
  416. exec 4>>"$DEXCONFTMPDIR/InputDeviceMouse"
  417. cat >&4 <<SECTION
  418.  
  419. Section "InputDevice"
  420.     Identifier "Elographic TouchScreen"
  421.     Driver        "elographics" 
  422.     Option        "Device"    "/dev/ttyS6"
  423.     Option        "AlwaysCore"
  424.     Option        "CorePointer"
  425.     Option        "screenno"    "0"
  426.     Option        "MinX"        "0"
  427.     Option        "MaxX"        "3950"
  428.     Option        "MinY"        "0"
  429.     Option        "MaxY"        "3950"
  430.     Option        "UntouchDelay"    "3"
  431.     Option        "ReportDelay"    "1"
  432. EndSection
  433. SECTION
  434. fi
  435.  
  436. ### MONITOR
  437.  
  438. fetch xserver-$SERVER/config/monitor/identifier
  439. MONITOR_IDENTIFIER="$RET"
  440. fetch xserver-$SERVER/config/monitor/horiz-sync
  441. MONITOR_HORIZ_SYNC="$RET"
  442. fetch xserver-$SERVER/config/monitor/vert-refresh
  443. MONITOR_VERT_REFRESH="$RET"
  444. db_get xserver-$SERVER/config/monitor/use_sync_ranges
  445. MONITOR_SYNC_RANGES="$RET"
  446.  
  447. exec 4>"$DEXCONFTMPDIR/Monitor"
  448. cat >&4 <<SECTION
  449. Section "Monitor"
  450.     Identifier    "$MONITOR_IDENTIFIER"
  451.     Option        "DPMS"
  452. SECTION
  453.  
  454. if [ "$MONITOR_SYNC_RANGES" = "true" ]; then
  455. cat >&4 <<SECTION
  456.     HorizSync    $MONITOR_HORIZ_SYNC
  457.     VertRefresh    $MONITOR_VERT_REFRESH
  458. SECTION
  459. fi
  460.  
  461. printf "EndSection\n" >&4
  462.  
  463. ### SCREEN
  464.  
  465. fetch xserver-$SERVER/config/display/default_depth
  466. DISPLAY_DEFAULT_DEPTH="$RET"
  467. fetch xserver-$SERVER/config/display/modes
  468. DISPLAY_MODES="$(list_convert $RET)"
  469.  
  470. exec 4>"$DEXCONFTMPDIR/Screen"
  471. cat >&4 <<SECTION
  472. Section "Screen"
  473.     Identifier    "Default Screen"
  474.     Device        "$DEVICE_IDENTIFIER"
  475.     Monitor        "$MONITOR_IDENTIFIER"
  476.     DefaultDepth    $DISPLAY_DEFAULT_DEPTH
  477. SECTION
  478. if [ -n "$PS3_FB" ]; then
  479.   printf "\tDefaultFbBpp 32\n" >&4
  480. fi
  481. for DEPTH in 1 4 8 15 16 24; do
  482.   printf "\tSubSection \"Display\"\n" >&4
  483.   printf "\t\tDepth\t\t$DEPTH\n" >&4
  484.   if [ -n "$DISPLAY_MODES" ]; then
  485.     printf "\t\tModes\t\t$DISPLAY_MODES\n" >&4
  486.   fi
  487.   printf "\tEndSubSection\n" >&4
  488. done
  489. printf "EndSection\n" >&4
  490.  
  491. ### SERVERLAYOUT
  492.  
  493. exec 4>"$DEXCONFTMPDIR/ServerLayout"
  494. cat >&4 <<SECTION
  495. Section "ServerLayout"
  496.     Identifier    "Default Layout"
  497.     Screen        "Default Screen"
  498.     InputDevice    "Generic Keyboard"
  499.     InputDevice    "Configured Mouse"
  500.     InputDevice     "stylus"    "SendCoreEvents"
  501.     InputDevice     "cursor"    "SendCoreEvents"
  502.     InputDevice     "eraser"    "SendCoreEvents"
  503. SECTION
  504. if [ -n "$LAPTOP" ]; then
  505.   printf "\tInputDevice\t\"Synaptics Touchpad\"\n" >&4
  506. fi
  507. if [ "$ELOTOUCH" = "yes" ]; then
  508.   printf "\tInputDevice\t\"Elographic TouchScreen\"\n" >&4
  509. fi
  510. printf "EndSection\n" >&4
  511.  
  512. ### DRI
  513. exec 4>"$DEXCONFTMPDIR/DRI"
  514. cat >&4 <<SECTION
  515. Section "DRI"
  516.     Mode    0666
  517. EndSection
  518. SECTION
  519.  
  520. # Close file descriptor 4 before we delete temporary files
  521. exec 4<&-
  522.  
  523. # Tell debconf to stop listening to us.
  524. db_stop
  525.  
  526. # Write the configuration file.  Put a blank line before every section we write
  527. # except the first.
  528.  
  529. OUTFILE="$DEXCONFTMPDIR/dexconf-out"
  530. umask 022
  531. : >"$OUTFILE"
  532.  
  533. SPACER=
  534. for SECTION in Header Files Module InputDeviceKeyboard InputDeviceMouse \
  535.                Device Monitor Screen ServerLayout DRI; do
  536.   if [ -e "$DEXCONFTMPDIR/$SECTION" ]; then
  537.     eval $SPACER
  538.     cat "$DEXCONFTMPDIR/$SECTION" >>"$OUTFILE"
  539.     SPACER='echo "" >>"$OUTFILE"'
  540.   fi
  541. done
  542.  
  543. # Ensure we can write to our destination if it already exits.
  544. if [ -e "$XF86CONFIG" ]; then
  545.   if [ ! -w "$XF86CONFIG" ]; then
  546.     bomb "unable to write to \"$XF86CONFIG\""
  547.   fi
  548. fi
  549.  
  550. BACKUP=
  551. # Create a backup of the existing configuration file if it already exists.
  552. if [ -e "$XF86CONFIG" ]; then
  553.   cat "$XF86CONFIG" >"$DEXCONFTMPDIR/backup"
  554.   BACKUP=true
  555. fi
  556.  
  557. # Move the new file into place.
  558. if ! cat "$OUTFILE" >"$XF86CONFIG"; then
  559.   # Failed; try to restore the backup.
  560.   if [ -n "$BACKUP" ]; then
  561.     cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG"
  562.   fi
  563. fi
  564.  
  565. rm -rf "$DEXCONFTMPDIR"
  566.  
  567. exit 0
  568.  
  569. # vim:set ai et sts=2 sw=2 tw=80:
  570.