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 VMBuilder.disk as disk 
23  from   VMBuilder.util import run_cmd 
24  from   VMBuilder.plugins.ubuntu.dapper import Dapper 
25   
26 -class Edgy(Dapper):
27 valid_flavours = { 'i386' : ['386', '686', '686-smp', 'generic', 'k7', 'k7-smp', 'server', 'server-bigiron'], 28 'amd64' : ['amd64-generic', 'amd64-k8', 'amd64-k8-smp', 'amd64-server', 'amd64-xeon', 'server']} 29 default_flavour = { 'i386' : 'server', 'amd64' : 'server' } 30 disk_prefix = 'sd' 31
32 - def mangle_grub_menu_lst(self):
33 bootdev = disk.bootpart(self.vm.disks) 34 run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir) 35 run_cmd('sed', '-ie', 's/^# groot.*/# groot %s/g' % bootdev.get_grub_id(), '%s/boot/grub/menu.lst' % self.destdir) 36 run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
37
38 - def fstab(self):
39 retval = '''# /etc/fstab: static file system information. 40 # 41 # <file system> <mount point> <type> <options> <dump> <pass> 42 proc /proc proc defaults 0 0 43 ''' 44 parts = disk.get_ordered_partitions(self.vm.disks) 45 for part in parts: 46 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) 47 return retval
48