Skip to content

Commit

Permalink
Add PNIN as a system manifest parameter.
Browse files Browse the repository at this point in the history
Fixes: andsens#349

Adds a new boolean parameter indicating weather to use PNIN or not to
the system section of the manifest.

The default, False enables tasks for extlinux and grub to pass
net.ifnames=0 biosdevnames=0 parameters to the kernel.

Previously for grub PNIN was disabled for stretch and later. This
remains the default but setting system.pnin True will allow the behavior
to be overridden. The additional parameters have no effect on earlier
releases are passed regardless. Extlinux had no prior special behavior,
it now mirrors grub.
  • Loading branch information
john-pierce committed Jul 15, 2018
1 parent a4f2e1c commit 5f1fdfe
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
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

0 comments on commit 5f1fdfe

Please sign in to comment.