oem: Ensure we auto-install to the right device

merge-requests/1/head
Matthias Klumpp 8 years ago
parent f59f3b8fe4
commit 929fd4909a

@ -26,7 +26,7 @@ d-i pkgsel/install-language-support boolean false
d-i pkgsel/update-policy select none
d-i partman/default_filesystem string ext4
d-i partman-auto/disk string /dev/sda
d-i partman-auto/disk string %TARGET_DISK%
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
@ -77,7 +77,7 @@ d-i hw-detect/load_firmware boolean false
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i grub-installer/choose_bootdev string /dev/sda
d-i grub-installer/choose_bootdev string %TARGET_DISK%
d-i finish-install/reboot_in_progress note
#grub-pc ucf/changeprompt string install the package maintainer's version

@ -113,6 +113,22 @@ class LibremDiskDevice(object):
self.wipe_dev(self.path)
def configure_di_preseed(template_fname, dest_fname, target_disk):
"""
Replace variables in a debian-installer preseed file and safe the result
under a new name.
"""
contents = None
with open(template_fname, 'r') as f:
contents = f.read()
contents = contents.replace('%TARGET_DISK%', target_disk)
with open(dest_fname, 'w') as f:
f.write(contents)
def pureos_oem_setup():
OEM_DATA_PATH = '/var/lib/pureos-oem/'
logger = getLogger(__name__)
@ -157,7 +173,11 @@ def pureos_oem_setup():
shutil.copy(os.path.join(OEM_DATA_PATH, 'pureos.iso'), target)
shutil.copy(os.path.join(OEM_DATA_PATH, 'initrd.gz'), target)
shutil.copy(os.path.join(OEM_DATA_PATH, 'vmlinuz'), target)
shutil.copy(os.path.join(OEM_DATA_PATH, 'di-preseed.cfg'), target)
# configure & install preseed
configure_di_preseed(os.path.join(OEM_DATA_PATH, 'di-preseed.cfg.in'),
os.path.join(target, 'di-preseed.cfg'),
target_disk=disk_path)
# set up GRUB
logger.info('Creating GRUB configuration...')

Loading…
Cancel
Save