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-2008 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 as published by 
 9  #    the Free Software Foundation, either version 3 of the License, or 
10  #    (at your option) any later version. 
11  # 
12  #    This program is distributed in the hope that it will be useful, 
13  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  #    GNU General Public License for more details. 
16  # 
17  #    You should have received a copy of the GNU General Public License 
18  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
19  # 
20  import logging 
21  import suite 
22  import shutil 
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 self.copy_to_target('/etc/default/locale', '/etc/default/locale') 52 shutil.rmtree('%s/etc/console-setup' % self.destdir) 53 self.copy_to_target('/etc/console-setup', '/etc/console-setup') 54 self.copy_to_target('/etc/default/console-setup', '/etc/default/console-setup') 55 self.copy_to_target('/etc/timezone', '/etc/timezone') 56 self.run_in_target('dpkg-reconfigure', '-pcritical', 'tzdata') 57 self.run_in_target('locale-gen', 'en_US') 58 if self.vm.lang: 59 self.run_in_target('locale-gen', self.vm.lang) 60 self.install_from_template('/etc/default/locale', 'locale', { 'lang' : self.vm.lang }) 61 self.run_in_target('dpkg-reconfigure', '-pcritical', 'locales') 62 self.run_in_target('dpkg-reconfigure', '-pcritical', 'console-setup')
63