File: wvdial.postinst

package info (click to toggle)
wvdial 1.61-5
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 600 kB
  • sloc: cpp: 3,169; sh: 180; makefile: 158
file content (78 lines) | stat: -rwxr-xr-x 2,015 bytes parent folder | download | duplicates (6)
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
#!/bin/sh

set -e

if [ "$1" = "configure" ]; then

    set +e

    # Source Debconf module
    . /usr/share/debconf/confmodule

    # Update the /etc/wvdial.conf file
    db_get wvdial/wvdialconf
    if [ "$RET" = "true" ]; then
	db_get wvdial/phone
	phone="$RET"
	db_get wvdial/login
	login="$RET"
	db_get wvdial/passphrase
	password="$RET"
	db_reset wvdial/passphrase
	db_reset wvdial/passphrase2

	if [ ! -e '/etc/wvdial.conf' ]; then
	    # Create /etc/wvdial.conf
	    umask 077
	    cat >/etc/wvdial.conf <<-EOF
		[Dialer Defaults]
		Phone = $phone
		Username = $login
		Password = $password
		New PPPD = yes
		EOF
	    chown root:dialout /etc/wvdial.conf
	    chmod 0640 /etc/wvdial.conf
	elif type uni >/dev/null 2>/dev/null; then
	    export UNICONF='ini:/etc/wvdial.conf'
	    if [ -n "$phone" ]; then
		uni set '/Dialer Defaults/Phone' "$phone"
		uni del '/Dialer Defaults/; Phone'
	    fi
	    if [ -n "$login" ]; then
		uni set '/Dialer Defaults/Username' "$login"
		uni del '/Dialer Defaults/; Username'
	    fi
	    if [ -n "$password" ]; then
		uni set '/Dialer Defaults/Password' "$password"
		uni del '/Dialer Defaults/; Password'
	    fi
	fi
 
	if grep -qi ^modem /etc/wvdial.conf 2>/dev/null; then
	    echo
	    echo "/etc/wvdial.conf already exists -- not probing your modem."
	    echo "  (Run wvdialconf manually if you want to re-detect your modem.)"
	    echo
	else
	    # Try to detect the modem
	    if wvdialconf /etc/wvdial.conf >/var/log/wvdialconf.log 2>&1; then
		if [ -e /etc/wvdial.conf ]; then
		    chown root:dialout /etc/wvdial.conf
		    chmod 0640 /etc/wvdial.conf
		fi
		echo
		echo "Success!  You can run \"wvdial\" to connect to the internet."
		echo "  (You can also change your configuration by editing /etc/wvdial.conf)"
		echo
	    else
		echo
		echo "Sorry.  You can retry the autodetection at any time by running \"wvdialconf\"."
		echo "   (Or you can create /etc/wvdial.conf yourself.)"
	    fi
	    chmod 0644 /var/log/wvdialconf.log
	fi
    fi
fi

#DEBHELPER#