1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/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 -v w="$w" -v h="$h" 'NF == 3 && int($2*72/2.54 + 0.5) == w && int($3*72/2.54 + 0.5) == h {
print $1;
exit}
NF == 4 && $2 == w && $3 == h {
print $1;
exit
}' <<__END_PAPERSPECS__
__BEGIN_PAPERSPECS__
__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
|