File: config

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 (36 lines) | stat: -rw-r--r-- 998 bytes parent folder | download
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
#!/bin/sh -e

. /usr/share/debconf/confmodule

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
  val=`perl -ne "$getkey" $key /etc/exult.cfg`
  [ "$val" ] && db_set exult/$game $val

  while true; do
    set +e
    db_input high exult/$game
    [ $? -eq 30 ] && break	# question was 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			# '; 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