Package VMBuilder :: Package plugins :: Package ubuntu :: Module edgy
[frames] | no frames]

Source Code for Module VMBuilder.plugins.ubuntu.edgy

 1  # 
 2  #    Uncomplicated VM Builder 
 3  #    Copyright (C) 2007-2009 Canonical Ltd. 
 4  #     
 5  #    See AUTHORS for list of contributors 
 6  # 
 7  #    This program is free software: you can redistribute it and/or modify 
 8  #    it under the terms of the GNU General Public License version 3, as 
 9  #    published by the Free Software Foundation. 
10  # 
11  #    This program is distributed in the hope that it will be useful, 
12  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  #    GNU General Public License for more details. 
15  # 
16  #    You should have received a copy of the GNU General Public License 
17  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
18  # 
19  import logging 
20  import suite 
21  import shutil 
22  import os 
23  import VMBuilder.disk as disk 
24  from   VMBuilder.util import run_cmd 
25  from   VMBuilder.plugins.ubuntu.dapper import Dapper 
26   
27 -class Edgy(Dapper):
28 valid_flavours = { 'i386' : ['386', '686', '686-smp', 'generic', 'k7', 'k7-smp', 'server', 'server-bigiron'], 29 'amd64' : ['amd64-generic', 'amd64-k8', 'amd64-k8-smp', 'amd64-server', 'amd64-xeon', 'server']} 30 default_flavour = { 'i386' : 'server', 'amd64' : 'server' } 31 disk_prefix = 'sd' 32
33 - def mangle_grub_menu_lst(self):
34 bootdev = disk.bootpart(self.vm.disks) 35 run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir) 36 run_cmd('sed', '-ie', 's/^# groot.*/# groot %s/g' % bootdev.get_grub_id(), '%s/boot/grub/menu.lst' % self.destdir) 37 run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
38
39 - def fstab(self):
40 retval = '''# /etc/fstab: static file system information. 41 # 42 # <file system> <mount point> <type> <options> <dump> <pass> 43 proc /proc proc defaults 0 0 44 ''' 45 parts = disk.get_ordered_partitions(self.vm.disks) 46 for part in parts: 47 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) 48 return retval
49
50 - def copy_settings(self):
51 if os.path.exists('/etc/default/locale'): 52 self.copy_to_target('/etc/default/locale', '/etc/default/locale') 53 csdir = '%s/etc/console-setup' % self.destdir 54 have_cs = os.path.isdir(csdir) 55 if have_cs: 56 shutil.rmtree(csdir) 57 self.copy_to_target('/etc/console-setup', '/etc/console-setup') 58 self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup') 59 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'tzdata') 60 self.run_in_target('locale-gen', 'en_US') 61 if self.vm.lang: 62 self.run_in_target('locale-gen', self.vm.lang) 63 self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) 64 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'locales') 65 if have_cs: 66 self.run_in_target('dpkg-reconfigure', '-fnoninteractive', '-pcritical', 'console-setup')
67