File: config

package info (click to toggle)
phalanx 21-12
  • links: PTS
  • area: main
  • in suites: potato
  • size: 808 kB
  • ctags: 524
  • sloc: ansic: 6,749; sh: 81; makefile: 64
file content (49 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download | duplicates (7)
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
#!/bin/bash -e

. /usr/share/debconf/confmodule

LEARNFILE=/var/games/phalanx.learn
OLDLEARNFILE=/var/lib/games/phalanx.learn

db_reset phalanx/learning_file_size

if [ -e $LEARNFILE ] || [ -e $OLDLEARNFILE ]; then
  if [ "$1" = reconfigure ]; then
    db_input medium phalanx/learning_file_erase || true
    db_go
    db_get phalanx/learning_file_erase
    if [ "$RET" != true ]; then
      exit 0
    fi
  else				# configure
    db_set phalanx/learning_file_erase false
    exit 0
  fi
else				# no learn file exists
  db_set phalanx/learning_file_erase true
fi

if [ "$1" = reconfigure ]; then
  ANSWERED=''
  while [ -z "$ANSWERED" ]; do
    db_input low phalanx/learning_file_size || true
    db_go
    db_get phalanx/learning_file_size  
    if [ -n "$RET" ]; then
      ITEMS="$RET"
      OLDTEST=""
      TEST="$RET"
      while [ "$TEST" != "$OLDTEST" ]; do
	OLDTEST="$TEST"
	TEST=${TEST##[0-9]}
      done
      if [ -z "$TEST" ]; then
	if [ ${#ITEMS} -gt 6 ] || [ "$ITEMS" -lt 1 ]; then
	  true #echo "Please use number in the range 1-999999."
	else
	  ANSWERED=yes
	fi
      fi
    fi
  done
fi