1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import shutil
20 import os
21 import VMBuilder.disk as disk
22 from VMBuilder.util import run_cmd
23 from VMBuilder.plugins.ubuntu.dapper import Dapper
24
26 valid_flavours = { 'i386' : ['386', '686', '686-smp', 'generic', 'k7', 'k7-smp', 'server', 'server-bigiron'],
27 'amd64' : ['amd64-generic', 'amd64-k8', 'amd64-k8-smp', 'amd64-server', 'amd64-xeon', 'server']}
28 default_flavour = { 'i386' : 'server', 'amd64' : 'server' }
29 disk_prefix = 'sd'
30
32 bootdev = disk.bootpart(disks)
33 run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid,
34 '%s/boot/grub/menu.lst' % self.context.chroot_dir)
35 run_cmd('sed', '-ie', 's/^# groot.*/# groot %s/g' % bootdev.get_grub_id(),
36 '%s/boot/grub/menu.lst' % self.context.chroot_dir)
37 run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' %
38 self.context.chroot_dir)
39
41 retval = '''# /etc/fstab: static file system information.
42 #
43 # <file system> <mount point> <type> <options> <dump> <pass>
44 proc /proc proc defaults 0 0
45 '''
46 parts = disk.get_ordered_partitions(self.context.disks)
47 for part in parts:
48 retval += "UUID=%-40s %15s %7s %15s %d %d\n" % (part.fs.uuid, part.fs.mntpnt, part.fs.fstab_fstype(), part.fs.fstab_options(), 0, 0)
49 return retval
50
52 if os.path.exists('/etc/default/locale'):
53 self.copy_to_target('/etc/default/locale', '/etc/default/locale')
54 csdir = '%s/etc/console-setup' % self.destdir
55 have_cs = os.path.isdir(csdir)
56 if have_cs:
57 shutil.rmtree(csdir)
58 self.copy_to_target('/etc/console-setup', '/etc/console-setup')
59 self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup')
60 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata')
61 self.run_in_target('locale-gen', 'en_US')
62 if self.context.lang:
63 self.run_in_target('locale-gen', self.context.lang)
64 self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.context.lang })
65 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales')
66 if have_cs:
67 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'console-setup')
68
70 timezone = self.context.get_setting('timezone')
71 if timezone:
72 self.install_from_template('/etc/timezone', 'timezone', { 'timezone' : timezone })
73 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata')
74
80
82 super(Edgy, self).unprevent_daemons_starting()
83 initctl = '%s/sbin/initctl' % (self.context.chroot_dir,)
84 os.rename('%s.REAL' % (initctl,), initctl)
85