File: postinst

package info (click to toggle)
exult 1.2-4
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 9,040 kB
  • ctags: 10,543
  • sloc: cpp: 99,373; sh: 8,333; ansic: 4,659; makefile: 988; yacc: 769; lex: 313; xml: 19
file content (81 lines) | stat: -rw-r--r-- 1,309 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

config=/etc/exult.cfg

setkeys='%d = ("/config/debian-warning" => 0);
%k = @ARGV;
while (<STDIN>) {
  if (m|</(.*?)>|) {
    $p =~ s|/$1$|| or die "line $.: </$1> unexpected\n";
    print if $skip < 2;
    $skip = 0;
    next
  }
  next if $skip;
  if (m|(\s*)<(.*?)>|) {
    $i = $1;
    $p .= "/$2";
    exists $d{$p} and $skip = 2, next;
    print;
    exists $k{$p} and $skip = 1, print "$i$k{$p}\n";
    next;
  }
  print;
}'

case "$1" in
    configure)
	. /usr/share/debconf/confmodule
	db_get exult/blackgate
	blackgate="${RET:-.}"
	db_get exult/serpent
	serpent="${RET:-.}"
	if [ -e $config ]; then
	  perl -e "$setkeys" \
	   /config/disk/game/blackgate/path $blackgate \
	   /config/disk/game/serpentisle/path $serpent \
	   <$config >$config.dpkg-new
	  mv $config.dpkg-new $config
	else
	  cat <<EOF >$config
<config>
 <disk>
  <game>
   <blackgate>
    <title>
    blackgate
    </title>
    <path>
    $blackgate
    </path>
   </blackgate>
   <serpentisle>
    <title>
    serpentisle
    </title>
    <path>
    $serpent
    </path>
   </serpentisle>
  </game>
 </disk>
</config>
EOF
    fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)

    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0