2013-07-10 10:49:45 +02:00
|
|
|
from base import Task
|
|
|
|
from common import phases
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigureGrub(Task):
|
|
|
|
description = 'Configuring grub'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
|
|
|
def run(self, info):
|
2013-08-11 23:03:44 +02:00
|
|
|
import os.path
|
|
|
|
device_map_path = os.path.join(info.root, 'boot/grub/device.map')
|
|
|
|
with open(device_map_path, 'w') as device_map:
|
|
|
|
device_map.write(('(hd0) {dev_path}\n'
|
|
|
|
'(hd0,1) {root_path}'
|
|
|
|
.format(dev_path=info.bootstrap_device['path'],
|
|
|
|
root_path=info.bootstrap_device['partitions']['root_path'])))
|
|
|
|
|
2013-08-10 16:18:48 +02:00
|
|
|
from common.tools import log_check_call
|
2013-07-30 11:21:09 +02:00
|
|
|
log_check_call(['/usr/sbin/chroot', info.root, 'update-initramfs', '-u'])
|
2013-08-01 11:19:20 +02:00
|
|
|
|
2013-08-11 23:03:44 +02:00
|
|
|
log_check_call(['/usr/sbin/chroot', info.root,
|
|
|
|
'/usr/sbin/grub-mkconfig', '-o', '/boot/grub/grub.cfg'])
|
|
|
|
|
|
|
|
log_check_call(['/usr/sbin/chroot', info.root,
|
|
|
|
'/usr/sbin/grub-install', info.bootstrap_device['path']])
|