~ubuntu-branches/ubuntu/wily/console-setup/wily

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
set -e

tmp=`tempfile`

mini=''
file=''
udeb=''

while [ "$1" ]; do
    case "$1" in
	--udeb)
            mini=1
            udeb=1
	    ;;
	--mini)
            mini=1
	    ;;
	-*)
	    echo Unknown parameter: "$1" 1>&2
	    exit 1
	    ;;
	*)
	    if [ -f "$1" ]; then
		file="$1"
	    else
		echo Unknown parameter: "$1" 1>&2
		exit 1
	    fi
	    ;;
    esac
    shift
done

templatesfile=`dirname $0`/keyboard-configuration.templates
seentemplates=$(
    grep '^Template: keyboard-configuration' <"$templatesfile" | \
	grep -v unsupported | \
	grep -v ctrl_alt_bksp | \
	sed -e 's/Template: */printf "/' -e 's/$/ ";\n/')

awk '
/## *KEYBOARD_PRESENT *##/ {
    system("cat debian/keyboard_present.sh");
    next;
}
/## *FONTSETS *##/ {
    printf "fontsets='\''";
    system("cd Fonts && ls *.psf | sed '\''s/.psf$//'\''");
    printf "'\''";
    next;
}
/## *CHARMAPS *##/ {
    printf "charmaps='\''";
    system("ls acm/*.acm |sed -e '\''s/^acm.//'\'' -e '\''s/.acm$//'\''");
    printf "UTF-8'\''\n";
    next;
}
/## *SEEN TEMPLATES *##/ {
    '"$seentemplates"'
    printf "\n";
}
{
   print;
}' "$file" >$tmp && cat $tmp >"$file"

if [ "$mini" ]; then
    awk '
/## *KBDNAMES *##/ {
    printf "all_kbdnames () {\n cat <<'\''EOF'\'' \n";
    system("cd Keyboard && ./kbdnames-maker KeyboardNames.pl | grep '\''^C[*]'\'' | grep -v '\''[*]model[*]'\'"$rmkbdnames"'");
    printf "EOF\n [ ! -f /usr/share/console-setup/kbdnames.gz ] || zcat /usr/share/console-setup/kbdnames.gz \n}\n";
    next;
}
{
   print;
}' "$file" >$tmp && cat $tmp >"$file"
else
    awk '
/## *KBDNAMES *##/ {
    printf "all_kbdnames () {\n cat <<'\''EOF'\''\n";
    system("cd Keyboard && ./kbdnames-maker KeyboardNames.pl");
    printf "EOF\n}\n";
    next;
}
{
   print;
}' "$file" >$tmp && cat $tmp >"$file"
fi

if [ "$mini" ]; then
    sed -e 's/^[ \t]*//' -e 's/^#[^!].*//' -e 's/^#$//' <"$file" >$tmp \
	&& grep . $tmp >"$file"
fi

rm $tmp

exit 0