Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Add PNIN as a system manifest parameter. #485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bootstrapvz/base/manifest-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ properties:
type: string
pattern: ^\S+$
locale: {type: string}
pnin: {type: boolean}
release: {type: string}
timezone: {type: string}
required:
Expand Down
4 changes: 2 additions & 2 deletions bootstrapvz/common/assets/extlinux/extlinux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ timeout 50
label l0
menu label Debian GNU/Linux, kernel {kernel_version}
linux {boot_prefix}/vmlinuz-{kernel_version}
append initrd={boot_prefix}/initrd.img-{kernel_version} root=UUID={root_uuid} ro quiet console=ttyS0
append initrd={boot_prefix}/initrd.img-{kernel_version} root=UUID={root_uuid} ro quiet console=ttyS0 {disable_pnin}

label l0r
menu label Debian GNU/Linux, kernel {kernel_version} (recovery mode)
linux {boot_prefix}/vmlinuz-{kernel_version}
append initrd={boot_prefix}/initrd.img-{kernel_version} root=UUID={root_uuid} ro console=ttyS0 single
append initrd={boot_prefix}/initrd.img-{kernel_version} root=UUID={root_uuid} ro console=ttyS0 single {disable_pnin}
text help
This option boots the system into recovery mode (single-user)
endtext
3 changes: 2 additions & 1 deletion bootstrapvz/common/task_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def get_bootloader_group(manifest):
from bootstrapvz.common.releases import jessie
from bootstrapvz.common.releases import stretch
group = []
pnin = manifest.system.get('pnin', None)
if manifest.system['bootloader'] == 'grub':
group.extend([grub.AddGrubPackage,
grub.InitGrubConfig,
Expand All @@ -173,7 +174,7 @@ def get_bootloader_group(manifest):
group.append(grub.InstallGrub_1_99)
else:
group.append(grub.InstallGrub_2)
if manifest.release >= stretch:
if pnin is False or (pnin is None and manifest.release >= stretch):
group.append(grub.DisablePNIN)
if manifest.system['bootloader'] == 'extlinux':
group.append(extlinux.AddExtlinuxPackage)
Expand Down
7 changes: 7 additions & 0 deletions bootstrapvz/common/tasks/extlinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from . import filesystem
from . import kernel
from bootstrapvz.base.fs import partitionmaps
from ..releases import stretch
import os


Expand Down Expand Up @@ -75,6 +76,12 @@ def run(cls, info):
else:
config_vars['boot_prefix'] = '/boot'

pnin = info.manifest.system.get('pnin', None)
if pnin is False or (pnin is None and info.manifest.release >= stretch):
config_vars['disable_pnin'] = 'net.ifnames=0 biosdevname=0'
else:
config_vars['disable_pnin'] = ''

extlinux_config = extlinux_config_tpl.format(**config_vars)

with open(os.path.join(extlinux_path, 'extlinux.conf'), 'w') as extlinux_conf_handle:
Expand Down
5 changes: 5 additions & 0 deletions manifests/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ system and does not fit under any other section.
- ``locale``: The default locale of the system.
Valid values: Any locale mentioned in ``/etc/locale.gen``
``required``
- ``pnin``: Enable Persistent Network Interface Naming in the bootloader.
Only supported with the ``grub`` and ``extlinux`` bootloaders.
Valid values: ``true``, ``false``
Default: ``false``
``optional``
- ``release``: Defines which debian release should be bootstrapped.
Valid values: ``wheezy``, ``jessie``, ``stretch``, ``sid``,
``oldstable``, ``stable``, ``testing``, ``unstable``
Expand Down