~kobe24-lixiang/ubiquity-ubuntukylin/trunk

« back to all changes in this revision

Viewing changes to autopilot/ubiquity_autopilot_tests/configs/english_label_conf.py

  • Committer: kobe
  • Date: 2014-08-22 06:37:21 UTC
  • Revision ID: xiangli@ubuntukylin.com-20140822063721-p145o500i2y7o48h
first version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Config file for english label values
 
2
# Author: Dan Chapman <daniel@chapman-mail.com>
 
3
# Copyright (C) 2013
 
4
#
 
5
# This program is free software: you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License version 3 as
 
7
# published by the Free Software Foundation.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
import configparser
 
17
 
 
18
 
 
19
def get_distribution():
 
20
    """Returns the name of the running distribution."""
 
21
    with open('/cdrom/.disk/info') as f:
 
22
        for line in f:
 
23
            distro = line[:max(line.find(' '), 0) or None]
 
24
            if distro:
 
25
                if distro == 'Ubuntu-GNOME':
 
26
                    return str(distro.replace('-', ' '))
 
27
                else:
 
28
                    return str(distro)
 
29
            raise SystemError("Could not get distro name")
 
30
 
 
31
 
 
32
def generate_config():
 
33
    distro_flavor = get_distribution()
 
34
    config = configparser.ConfigParser()
 
35
 
 
36
    #CREATE STEP LANGUAGE CONFIG
 
37
    config['stepLanguage'] = {}
 
38
    stepLanguage = config['stepLanguage']
 
39
    stepLanguage['release_notes_label'] = \
 
40
        'You may wish to read the <a href="release-notes">release notes</a>.'
 
41
    stepLanguage["page_title"] = \
 
42
        '<span size="xx-large">Welcome</span>'
 
43
 
 
44
    # CREATE STEP PREPARE CONFIG
 
45
    config['stepPrepare'] = {}
 
46
    stepPrepare = config['stepPrepare']
 
47
    stepPrepare['page_title'] = \
 
48
        '<span size="xx-large">Preparing to install {0}</span>'\
 
49
        .format(distro_flavor)
 
50
    stepPrepare['prepare_best_results'] = \
 
51
        'For best results, please ensure that this computer:'
 
52
    stepPrepare['prepare_foss_disclaimer'] = \
 
53
        '{0} uses third-party software to play ' \
 
54
        'Flash, MP3 and other media, and to work with some graphics ' \
 
55
        'and wi-fi hardware. Some of this software is proprietary. ' \
 
56
        'The software is subject to license terms included with its ' \
 
57
        'documentation.'.format(distro_flavor)
 
58
    stepPrepare['prepare_download_updates'] = \
 
59
        'Download updates while installing'
 
60
    stepPrepare['prepare_nonfree_software'] = \
 
61
        'Install this third-party software'
 
62
    stepPrepare['prepare_network_connection'] = \
 
63
        'is connected to the Internet'
 
64
    stepPrepare['prepare_sufficient_space'] = \
 
65
        'has at least 6.0 GB available drive space'
 
66
 
 
67
    #CREATE STEP PART ASK CONFIG
 
68
    config['stepPartAsk'] = {}
 
69
    stepPartAsk = config['stepPartAsk']
 
70
    stepPartAsk['page_title'] = \
 
71
        '<span size="xx-large">Installation type</span>'
 
72
    stepPartAsk['use_device'] = \
 
73
        'Erase disk and install {0}'.format(distro_flavor)
 
74
    stepPartAsk['use_device_desc'] = \
 
75
        '<span size="small"><span foreground="darkred">Warning:</span> ' \
 
76
        'This will delete any files on the disk.</span>'
 
77
    stepPartAsk['use_crypto'] = \
 
78
        'Encrypt the new {0} installation for security'.format(distro_flavor)
 
79
    stepPartAsk['use_crypto_desc'] = \
 
80
        '<span size="small">You will choose a security key in the ' \
 
81
        'next step.</span>'
 
82
    stepPartAsk['use_lvm'] = 'Use LVM with the new {0} installation'.format(
 
83
        distro_flavor
 
84
    )
 
85
    stepPartAsk['use_lvm_desc'] = \
 
86
        '<span size="small">This will set up Logical Volume ' \
 
87
        'Management. It allows taking snapshots and easier partition ' \
 
88
        'resizing.</span>'
 
89
    stepPartAsk['custom_partitioning'] = 'Something else'
 
90
    stepPartAsk['custom_partitioning_desc'] = \
 
91
        '<span size="small">You can create or resize partitions yourself, ' \
 
92
        'or choose multiple partitions for {0}.</span>'.format(distro_flavor)
 
93
 
 
94
    #CREATE STEP PART CRYPTO CONFIG
 
95
    config['stepPartCrypto'] = {}
 
96
    stepPartCrypto = config['stepPartCrypto']
 
97
    stepPartCrypto["page_title"] = \
 
98
        '<span size="xx-large">Choose a security key:</span>'
 
99
    stepPartCrypto["verified_crypto_label"] = 'Confirm the security key:'
 
100
    stepPartCrypto["crypto_label"] = 'Choose a security key:'
 
101
    stepPartCrypto["crypto_description"] = \
 
102
        'Disk encryption protects your files in case you lose your computer.' \
 
103
        ' It requires you to enter a security key each time the computer ' \
 
104
        'starts up.'
 
105
    stepPartCrypto["crypto_warning"] = \
 
106
        '<span foreground="darkred">Warning:</span> If you lose ' \
 
107
        'this security key, all data will be lost. If you need to, ' \
 
108
        'write down your key and keep it in a safe place elsewhere.'
 
109
    stepPartCrypto["crypto_extra_label"] = 'For more security:'
 
110
    stepPartCrypto["crypto_extra_time"] = \
 
111
        'The installation may take much longer.'
 
112
    stepPartCrypto["crypto_description_2"] = \
 
113
        'Any files outside of {0} will not be encrypted.'.format(distro_flavor)
 
114
    stepPartCrypto["crypto_overwrite_space"] = 'Overwrite empty disk space'
 
115
 
 
116
    #CREATE STEP LOCATION CONFIG
 
117
    config['stepLocation'] = {}
 
118
    stepLocation = config['stepLocation']
 
119
    stepLocation["page_title"] = '<span size="xx-large">Where are you?</span>'
 
120
 
 
121
    #CREATE STEP KEYBOARD CONFIG
 
122
    config['stepKeyboardConf'] = {}
 
123
    stepKeyboardConf = config['stepKeyboardConf']
 
124
    stepKeyboardConf["page_title"] = \
 
125
        '<span size="xx-large">Keyboard layout</span>'
 
126
 
 
127
    #CREATE STEP USER INFO CONFIG
 
128
    config['stepUserInfo'] = {}
 
129
    stepUserInfo = config['stepUserInfo']
 
130
    stepUserInfo["page_title"] = '<span size="xx-large">Who are you?</span>'
 
131
    stepUserInfo["hostname_label"] = "Your computer's name:"
 
132
    stepUserInfo["username_label"] = 'Pick a username:'
 
133
    stepUserInfo["password_label"] = 'Choose a password:'
 
134
    stepUserInfo["verified_password_label"] = 'Confirm your password:'
 
135
    stepUserInfo["hostname_extra_label"] = \
 
136
        'The name it uses when it talks to other computers.'
 
137
    stepUserInfo["login_encrypt"] = 'Require my password to log in'
 
138
 
 
139
    #write config to tmp file
 
140
    with open('/tmp/english_config.ini', 'w') as configfile:
 
141
        config.write(configfile)