File: config

package info (click to toggle)
mopd 1%3A2.5.3-21
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 780 kB
  • sloc: ansic: 4,871; makefile: 176; sh: 163
file content (52 lines) | stat: -rw-r--r-- 1,262 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
#!/bin/sh -e
CONF_FILE="/etc/mopd.conf"

priority="medium"
INTERFACES=""

. /usr/share/debconf/confmodule

if [ -e "$CONF_FILE" ]; then
# if configuration already exists, use it
	. $CONF_FILE || true
	if [ "$INTERFACE" ]; then
		db_set mopd/interface $INTERFACE
	else
	# config file exists but doesn't tell us anything
		priority="critical"
        fi
else
# otherwise if there is only one, we can set default to that
	if [ "sed -e '1,2d' -e '/lo:/d' /proc/net/dev | grep -c ." = "1" ] ; then
	# only one interface, they probably want to use it
		INTERFACE=`sed -e "1,2d" -e "/lo:/d" -e "s/:.*//" /proc/net/dev`
		db_set mopd/interface $INTERFACE
	else
	# no interface already chosen, and there is more than one interface
		priority="critical"
	fi
fi


INTERFACES=`sed -e "1,2d" -e "/lo:/d" -e "s/:.*/ , /" /proc/net/dev | tr -d "\n" | sed -e "s/,[[:space:]]*$//"`

if [ -n "$INTERFACES" ] ; then
	db_subst mopd/interface choices ", $INTERFACES"
else
	db_subst mopd/interface choices ""

fi

db_subst mopd/interface default all

db_input $priority mopd/interface || true
db_go || true

db_get mopd/interface

if [ $RET = "other" ] ; then
	db_input $priority mopd/other_interface || true
	db_go || true
	db_get mopd/other_interface
	db_set mopd/interface $RET
fi