/
interchange.config
executable file
·111 lines (94 loc) · 2.41 KB
/
interchange.config
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
100
101
102
103
104
105
106
107
108
109
110
111
#! /bin/sh -e
# Source debconf library
. /usr/share/debconf/confmodule
if [ -e /etc/interchange/init.cfg ]; then
# Read current state from configuration file
. /etc/interchange/init.cfg || true
if [ "$MODE" = "--unix" ]; then
db_set interchange/mode "unix mode"
elif [ "$MODE" = "--inetmode" ]; then
db_set interchange/mode "internet mode"
else
db_set interchange/mode "both"
fi
db_set interchange/group $GROUP
db_set interchange/user $USER
fi
# Which mode we should use ?
db_input medium interchange/mode || true
db_go
# Remember old interchange user/group configuration
db_get interchange/user || true
OLDUSER=$RET
db_set interchange/olduser $OLDUSER
# Which user should be choosed for the interchange server ?
HAVEUSER=0
while [ $HAVEUSER -eq 0 ]; do
db_input medium interchange/user || true
db_go
db_get interchange/user
USER=$RET
if [ -z "$USER" ]; then
USER=interchange
fi
if [ "$USER" = root ]; then
db_input medium interchange/usernoroot || true
db_go
elif grep -q ^$USER: /etc/passwd; then
HAVEUSER=1
else
db_subst interchange/createuser USER $USER
db_input medium interchange/createuser || true
db_go
db_get interchange/createuser || true
CREATEUSER=$RET
if [ "$CREATEUSER" = true ]; then
HAVEUSER=1
fi
fi
if [ $HAVEUSER -eq 0 ]; then
db_fset interchange/user isdefault true
db_reset interchange/user
db_fset interchange/createuser isdefault true
db_reset interchange/createuser
fi
done
# Which group should be choosed for the interchange server ?
HAVEGROUP=0
while [ $HAVEGROUP -eq 0 ]; do
db_input medium interchange/group || true
db_go
db_get interchange/group
GROUP=$RET
if [ -z "$GROUP" ]; then
GROUP=interchange
fi
if [ "$GROUP" = root ]; then
db_input medium interchange/groupnoroot || true
db_go
elif grep -q ^$GROUP: /etc/group; then
HAVEGROUP=1
else
db_subst interchange/creategroup GROUP $GROUP
db_input medium interchange/creategroup || true
db_go
db_get interchange/creategroup || true
CREATEGROUP=$RET
if [ "$CREATEGROUP" = true ]; then
HAVEGROUP=1
fi
fi
if [ $HAVEGROUP -eq 0 ]; then
# no appropriate group, reset and try again
db_fset interchange/group isdefault true
db_reset interchange/group
db_fset interchange/creategroup isdefault true
db_reset interchange/creategroup
fi
done
# Settings
db_input low interchange/debug || true
db_go
# Catalog configuration
db_input medium interchange/docroot || true
db_go