~ubuntu-branches/ubuntu/lucid/landscape-client/lucid-updates

« back to all changes in this revision

Viewing changes to debian/landscape-client.config

  • Committer: Package Import Robot
  • Author(s): Andreas Hasenack
  • Date: 2012-04-10 14:28:48 UTC
  • mfrom: (1.1.27)
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: package-import@ubuntu.com-20120410142848-7xsy4g2xii7y7ntc
ImportĀ upstreamĀ versionĀ 12.04.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
PACKAGE=landscape-client
 
4
 
 
5
CONFIGFILE=/etc/landscape/client.conf
 
6
set -e
 
7
. /usr/share/debconf/confmodule
 
8
 
 
9
var_in_file() {
 
10
    var="$1"
 
11
    file="$2"
 
12
    line=$(grep "^$var\s*=\s*" "$file" 2>/dev/null || true)
 
13
    echo "$line"
 
14
}
 
15
 
 
16
get_var_from_file() {
 
17
    var="$1"
 
18
    file="$2"
 
19
    val=$(grep "^$var\s*=\s*" "$file" 2>/dev/null | tail -n1 | sed "s/^.*=\s*//")
 
20
    echo "$val"
 
21
}
 
22
 
 
23
update_var() {
 
24
    var="$1"
 
25
    file="$2"
 
26
    line=$(var_in_file $var $file)
 
27
    if [ -n "$line" ]; then
 
28
        val=$(get_var_from_file $var $file)
 
29
        # Store value from config file in debconf.
 
30
        db_set $PACKAGE/$var $val
 
31
    fi
 
32
}
 
33
 
 
34
# Load config file, if it exists.
 
35
if [ -e $CONFIGFILE ]; then
 
36
    # Config file is "ini" type, not shell, so we cannot source it
 
37
    # If a setting is defined in the config file, update it in debconf
 
38
    # db.
 
39
    update_var "computer_title" "$CONFIGFILE"
 
40
    update_var "account_name" "$CONFIGFILE"
 
41
    update_var "registration_password" "$CONFIGFILE"
 
42
    update_var "url" "$CONFIGFILE"
 
43
    update_var "exchange_interval" "$CONFIGFILE"
 
44
    update_var "urgent_exchange_interval" "$CONFIGFILE"
 
45
    update_var "ping_url" "$CONFIGFILE"
 
46
    update_var "ping_interval" "$CONFIGFILE"
 
47
    update_var "http_proxy" "$CONFIGFILE"
 
48
    update_var "https_proxy" "$CONFIGFILE"
 
49
    update_var "tags" "$CONFIGFILE"
 
50
fi
 
51
 
 
52
# Ask questions.
 
53
# Do debconf configuration
 
54
db_get $PACKAGE/register_system
 
55
if [ "$RET" = true ]; then
 
56
    priority=high
 
57
else
 
58
    priority=medium
 
59
fi
 
60
db_input "$priority" $PACKAGE/computer_title || true
 
61
db_input "$priority" $PACKAGE/account_name || true
 
62
db_input "$priority" $PACKAGE/registration_password || true
 
63
 
 
64
db_go || true