File: config

package info (click to toggle)
exult 1.12.0-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 43,608 kB
  • sloc: cpp: 169,917; xml: 7,400; yacc: 2,850; makefile: 2,419; java: 1,901; ansic: 1,654; lex: 673; sh: 539; objc: 416
file content (43 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (9)
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
#!/bin/sh

set -e

. /usr/share/debconf/confmodule

config=/etc/exult.cfg

getkey='BEGIN { $k = shift } if (m|</(.*?)>|) { $p =~ s|/$1$|| or die "line $.: </$1> unexpected\n"; next } m|<(.*?)>| and $p .= "/$1", next; $p eq $k && s/^\s*// && s/\s*$/\n/ and print;'

for game in blackgate serpent; do
	case $game in
		blackgate) key=/config/disk/game/blackgate/path;;
		serpent)   key=/config/disk/game/serpentisle/path;;
	esac

	if [ -e $config ]; then
		val=`perl -ne "$getkey" $key /etc/exult.cfg`
		[ "$val" ] && db_set exult/$game $val
	fi

	while true; do
		set +e
		db_input high exult/$game
		[ $? -eq 30 ] && break # question skipped, don't validate answer
		set -e
		db_go

		db_get exult/$game
		[ -z "$RET" ] && break
		if [ -d "$RET" ]; then
			if ls "$RET" | grep -qi '^static$'; then
				break
			else
				db_fset exult/no_static seen false
				db_input high exult/no_static || true
			fi
		else
			db_fset exult/not_a_dir seen false
			db_input high exult/not_a_dir || true
		fi
	done
done