/usr/lib/python3/dist-packages/provisioningserver/boot/install_grub.py is in python3-maas-provisioningserver 2.0.0~beta3+bzr4941-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # Copyright 2014-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Install a GRUB2 pre-boot loader config for TFTP download."""
__all__ = [
"add_arguments",
"run",
]
import os.path
from provisioningserver.boot.install_bootloader import make_destination
from provisioningserver.config import ClusterConfiguration
from provisioningserver.utils.fs import write_text_file
CONFIG_FILE = """
# MAAS GRUB2 pre-loader configuration file
# Load based on MAC address first.
configfile (pxe)/grub/grub.cfg-${net_default_mac}
# Failed to load based on MAC address.
# Load amd64 by default, UEFI only supported by 64-bit
configfile (pxe)/grub/grub.cfg-default-amd64
"""
def add_arguments(parser):
pass
def run(args):
"""Install a GRUB2 pre-boot loader config into the TFTP
directory structure.
"""
with ClusterConfiguration.open() as config:
destination_path = make_destination(config.grub_root)
destination_file = os.path.join(destination_path, 'grub.cfg')
write_text_file(destination_file, CONFIG_FILE)
|