~smoser/curtin/trunk.bzr-dead

« back to all changes in this revision

Viewing changes to examples/finalize.windows

  • Committer: Scott Moser
  • Date: 2017-12-20 17:33:03 UTC
  • Revision ID: smoser@ubuntu.com-20171220173303-29gha5qb8wpqrd40
README: Mention move of revision control to git.

curtin development has moved its revision control to git.
It is available at
  https://code.launchpad.net/curtin

Clone with
  git clone https://git.launchpad.net/curtin
or
  git clone git+ssh://git.launchpad.net/curtin

For more information see
  http://curtin.readthedocs.io/en/latest/topics/development.html

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
 
3
 
import os
4
 
import sys
5
 
import tempfile
6
 
 
7
 
from curtin.log import LOG
8
 
from curtin import util
9
 
 
10
 
 
11
 
def curthooks():
12
 
    state = util.load_command_environment()
13
 
    target = state['target']
14
 
 
15
 
    if target is None:
16
 
        sys.stderr.write("Unable to find target.  "
17
 
                         "Use --target or set TARGET_MOUNT_POINT\n")
18
 
        sys.exit(2)
19
 
 
20
 
    cfg = config.load_command_config({}, state)
21
 
 
22
 
    cloudbase_init = cfg.get('cloudbase_init', None)
23
 
    if not cloudbase_init:
24
 
        return False
25
 
 
26
 
    cloudbase_init_cfg = os.path.join(
27
 
        target,
28
 
        "Program Files (x86)",
29
 
        "Cloudbase Solutions",
30
 
        "Cloudbase-Init",
31
 
        "conf",
32
 
        "cloudbase-init.conf")
33
 
    cloudbase_init_unattended_cfg = os.path.join(
34
 
        target,
35
 
        "Program Files (x86)",
36
 
        "Cloudbase Solutions",
37
 
        "Cloudbase-Init",
38
 
        "conf",
39
 
        "cloudbase-init-unattend.conf")
40
 
 
41
 
    if os.path.isfile(cloudbase_init_cfg) is False:
42
 
        sys.stderr.write("Unable to find cloudbase-init.cfg.\n")
43
 
        sys.exit(2)
44
 
 
45
 
    fp = open(cloudbase_init_cfg, 'a')
46
 
    fp_u = open(cloudbase_init_unattended_cfg, 'a')
47
 
    for i in cloudbase_init['config'].splitlines():
48
 
        fp.write("%s\r\n" % i)
49
 
        fp_u.write("%s\r\n" % i)
50
 
    fp.close()
51
 
    fp_u.close()
52
 
 
53
 
 
54
 
curthooks()