home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- set -e
-
- defaultpaper () {
- # This is always in millimeters. If no locale is specified or
- # available, it will default to a4.
- w=$(locale width 2>/dev/null) || return 0
- h=$(locale height 2>/dev/null) || return 0
-
- # Try to find a matching paper size. The data must be embedded here
- # (done automatically by debian/rules) because the rest of the package
- # may not have been unpacked at this stage.
- LC_ALL=C awk 'NF == 5 && int($2 + 0.5) == '"$w"' && int($4 + 0.5) == '"$h"' {
- print $1;
- exit;
- }' <<__END_PAPERSPECS__
- __BEGIN_PAPERSPECS__
- a4 210 mm 297 mm
- letter 215.9 mm 279.4 mm
- note 215.9 mm 279.4 mm
- legal 215.9 mm 355.6 mm
- executive 184.15 mm 266.7 mm
- halfletter 139.7 mm 215.9 mm
- halfexecutive 133.35 mm 184.15 mm
- 11x17 279.4 mm 431.8 mm
- statement 139.7 mm 215.9 mm
- folio 215.9 mm 330.2 mm
- quarto 215.194 mm 275.167 mm
- 10x14 254 mm 355.6 mm
- ledger 431.8 mm 279.4 mm
- tabloid 279.4 mm 431.8 mm
- a0 841 mm 1189 mm
- a1 594 mm 841 mm
- a2 420 mm 594 mm
- a3 297 mm 420 mm
- a5 148 mm 210 mm
- a6 105 mm 148 mm
- a7 74 mm 105 mm
- a8 52 mm 74 mm
- a9 37 mm 52 mm
- a10 26 mm 37 mm
- b0 1000 mm 1414 mm
- b1 707 mm 1000 mm
- b2 500 mm 707 mm
- b3 353 mm 500 mm
- b4 250 mm 353 mm
- b5 176 mm 250 mm
- b6 125 mm 176 mm
- b7 88 mm 125 mm
- b8 62 mm 88 mm
- b9 44 mm 62 mm
- b10 31 mm 44 mm
- c2 458 mm 648 mm
- c3 324 mm 458 mm
- c4 229 mm 354 mm
- c5 162 mm 229 mm
- c6 114 mm 162 mm
- c7 81 mm 114 mm
- c8 57 mm 81 mm
- DL 110.067 mm 220.133 mm
- Comm10 104.775 mm 241.3 mm
- Monarch 98.425 mm 190.5 mm
- archE 914.4 mm 1219.2 mm
- archD 609.6 mm 914.4 mm
- archC 457.2 mm 609.6 mm
- archB 304.8 mm 457.2 mm
- archA 228.6 mm 304.8 mm
- flsa 215.9 mm 330.2 mm
- flse 215.9 mm 330.2 mm
- csheet 431.8 mm 558.8 mm
- dsheet 558.8 mm 863.6 mm
- esheet 863.6 mm 1117.6 mm
- __END_PAPERSPECS__
- }
-
- . /usr/share/debconf/confmodule
-
- if [ -f /etc/papersize ]; then
- # Configuration file always takes priority. Ignore comments.
- paper=`awk '$1 ~ /^[^#]/ { print $1 }' /etc/papersize`
- elif db_get libpaper/defaultpaper && [ -n "$RET" ]; then
- # The answer is already in the database; don't touch it.
- paper=
- else
- paper=`defaultpaper`
- fi
- if [ -n "$paper" ]; then
- db_set libpaper/defaultpaper "$paper"
- fi
-
- db_input medium libpaper/defaultpaper || true
- db_go || true
-