From 45920fab877e9d78643ac7422b436b9856e29563 Mon Sep 17 00:00:00 2001 From: tpw56j Date: Sun, 29 Aug 2021 22:12:55 +0300 Subject: [PATCH] fix/windows --- cobbler/modules/managers/import_signatures.py | 125 ++++++++++++--- cobbler/modules/sync_post_wingen.py | 8 +- cobbler/utils.py | 10 +- config/cobbler/distro_signatures.json | 149 +++++++++++++++++- docs/user-guide/wingen.rst | 124 ++++++--------- 5 files changed, 302 insertions(+), 114 deletions(-) diff --git a/cobbler/modules/managers/import_signatures.py b/cobbler/modules/managers/import_signatures.py index 8d93137618..1e98929aa4 100644 --- a/cobbler/modules/managers/import_signatures.py +++ b/cobbler/modules/managers/import_signatures.py @@ -31,6 +31,13 @@ import magic +HAS_HIVEX = True +try: + import hivex + from hivex.hive_types import REG_SZ +except Exception: + HAS_HIVEX = False + from cobbler.items import profile, distro from cobbler.cexceptions import CX from cobbler import enums, utils @@ -120,13 +127,20 @@ def get_file_lines(self, filename: str): return f.readlines() except: pass + if ftype.mime_type == "application/x-ms-wim": + cmd = "/usr/bin/wiminfo" + if os.path.exists(cmd): + cmd = "%s %s" % (cmd, filename) + return utils.subprocess_get(cmd).splitlines() + + self.logger.info("no %s found, please install wimlib-utils", cmd) elif ftype.mime_type == "text/plain": with open(filename, 'r') as f: return f.readlines() else: - self.logger.info("Could not detect the filetype and read the content of file \"%s\". Returning nothing." % + self.logger.info('Could not detect the filetype and read the content of file "%s". Returning nothing.', filename) - return [] + return [] def run(self, path: str, name: str, network_root=None, autoinstall_file=None, arch: Optional[str] = None, breed=None, os_version=None): @@ -183,6 +197,70 @@ def run(self, path: str, name: str, network_root=None, autoinstall_file=None, ar distros_added = [] import_walker(self.path, self.distro_adder, distros_added) + if len(distros_added) == 0: + if self.breed == "windows": + cmd_path = "/usr/bin/wimexport" + bootwim_path = os.path.join(self.path, "sources", "boot.wim") + dest_path = os.path.join(self.path, "boot") + if os.path.exists(cmd_path) and os.path.exists(bootwim_path): + winpe_path = os.path.join(dest_path, "winpe.wim") + if not os.path.exists(dest_path): + utils.mkdir(dest_path) + rc = utils.subprocess_call([cmd_path, bootwim_path, "1", + winpe_path, "--boot"], shell=False) + if rc == 0: + cmd = ["/usr/bin/wimdir %s 1 | /usr/bin/grep -i '^/Windows/Boot/PXE$'" % winpe_path] + pxe_path = utils.subprocess_get(cmd, shell=True)[0:-1] + cmd = ["/usr/bin/wimdir %s 1 | /usr/bin/grep -i '^/Windows/System32/config/SOFTWARE$'" + % winpe_path] + config_path = utils.subprocess_get(cmd, shell=True)[0:-1] + cmd_path = "/usr/bin/wimextract" + rc = utils.subprocess_call([cmd_path, bootwim_path, "1", + "%s/pxeboot.n12" % pxe_path, + "%s/bootmgr.exe" % pxe_path, + config_path, + "--dest-dir=%s" % dest_path, + "--no-acls", "--no-attributes"], shell=False) + if rc == 0: + if HAS_HIVEX: + software = os.path.join(dest_path, os.path.basename(config_path)) + h = hivex.Hivex(software, write=True) + root = h.root() + node = h.node_get_child(root, "Microsoft") + node = h.node_get_child(node, "Windows NT") + node = h.node_get_child(node, "CurrentVersion") + h.node_set_value(node, {"key": "SystemRoot", "t": REG_SZ, + "value": "x:\\Windows\0".encode(encoding="utf-16le")}) + node = h.node_get_child(node, "WinPE") + + # remove the key InstRoot from the registry + values = h.node_values(node) + new_values = [] + + for value in values: + keyname = h.value_key(value) + + if keyname == "InstRoot": + continue + + val = h.node_get_value(node, keyname) + valtype = h.value_type(val)[0] + value2 = h.value_value(val)[1] + valobject = {"key": keyname, "t": int(valtype), "value": value2} + new_values.append(valobject) + + h.node_set_values(node, new_values) + h.commit(software) + + cmd_path = "/usr/bin/wimupdate" + rc = utils.subprocess_call([cmd_path, winpe_path, "--command=add %s %s" + % (software, config_path)], shell=False) + os.remove(software) + else: + self.logger.info("python3-hivex not found. If you need Automatic Windows " + "Installation support, please install.") + import_walker(self.path, self.distro_adder, distros_added) + if len(distros_added) == 0: self.logger.warning("No distros imported, bailing out") return @@ -213,27 +291,24 @@ def scan_signatures(self): for (root, subdir, fnames) in os.walk(self.path): for fname in fnames + subdir: if f_re.match(fname): - # if the version file regex exists, we use it - # to scan the contents of the target version file - # to ensure it's the right version + # if the version file regex exists, we use it to scan the contents of the target + # version file to ensure it's the right version if sigdata["breeds"][breed][version]["version_file_regex"]: vf_re = re.compile(sigdata["breeds"][breed][version]["version_file_regex"]) vf_lines = self.get_file_lines(os.path.join(root, fname)) for line in vf_lines: if vf_re.match(line): - break - else: - continue - self.logger.debug( - "Found a matching signature: breed=%s, version=%s" % (breed, version)) - if not self.breed: - self.breed = breed - if not self.os_version: - self.os_version = version - if not self.autoinstall_file: - self.autoinstall_file = sigdata["breeds"][breed][version]["default_autoinstall"] - self.pkgdir = pkgdir - return sigdata["breeds"][breed][version] + self.logger.debug("Found a matching signature: breed=%s, version=%s", + breed, version) + if not self.breed: + self.breed = breed + if not self.os_version: + self.os_version = version + if not self.autoinstall_file: + self.autoinstall_file = sigdata["breeds"][breed][version]["default_autoinstall"] + self.pkgdir = pkgdir + return sigdata["breeds"][breed][version] + break return None # required function for import modules @@ -370,8 +445,6 @@ def add_entry(self, dirname: str, kernel, initrd): new_distro.kernel_options = self.signature.get("kernel_options", "") new_distro.kernel_options_post = self.signature.get("kernel_options_post", "") new_distro.template_files = self.signature.get("template_files", "") - supported_distro_boot_loaders = utils.get_supported_distro_boot_loaders(new_distro, self.api) - new_distro.boot_loaders = supported_distro_boot_loaders[0] boot_files: Dict[str, str] = {} for boot_file in self.signature["boot_files"]: @@ -408,6 +481,18 @@ def add_entry(self, dirname: str, kernel, initrd): else: new_profile.virt_type = enums.VirtType.KVM + if self.breed == "windows": + dest_path = os.path.join(self.path, "boot") + bootmgr_path = os.path.join(dest_path, "bootmgr.exe") + bcd_path = os.path.join(dest_path, "bcd") + winpe_path = os.path.join(dest_path, "winpe.wim") + if os.path.exists(bootmgr_path) and os.path.exists(bcd_path) and os.path.exists(winpe_path): + new_profile.autoinstall_meta = {"kernel": os.path.basename(kernel), + "bootmgr": "bootmgr.exe", + "bcd": "bcd", + "winpe": "winpe.wim", + "answerfile": "autounattended.xml"} + self.profiles.add(new_profile, save=True) return distros_added diff --git a/cobbler/modules/sync_post_wingen.py b/cobbler/modules/sync_post_wingen.py index e780c3d9e9..7f1eb479c9 100644 --- a/cobbler/modules/sync_post_wingen.py +++ b/cobbler/modules/sync_post_wingen.py @@ -169,7 +169,7 @@ def gen_win_files(distro, meta): if is_wimboot: distro_path = os.path.join(settings.webdir, "distro_mirror", distro.name) - kernel_path = os.path.join(distro_path, "Boot") + kernel_path = os.path.join(distro_path, "boot") if "kernel" in meta and "wimboot" not in distro.kernel: tgen.copy_single_distro_file(os.path.join(settings.tftpboot_location, kernel_name), distro_dir, False) @@ -301,7 +301,7 @@ def gen_win_files(distro, meta): wim_pl_name = os.path.join(kernel_path, "winpe.wim") cmd = ["/usr/bin/cp", "--reflink=auto", wim_pl_name, ps_file_name] - utils.subprocess_call(logger, cmd, shell=False) + utils.subprocess_call(cmd, shell=False) tgen.copy_single_distro_file(ps_file_name, web_dir, True) if os.path.exists(wimupdate): @@ -309,7 +309,9 @@ def gen_win_files(distro, meta): pi_file = tempfile.NamedTemporaryFile() pi_file.write(bytes(data, 'utf-8')) pi_file.flush() - cmd = [wimupdate, ps_file_name, "--command=add " + pi_file.name + " /Windows/System32/startnet.cmd"] + cmd = ["/usr/bin/wimdir %s 1 | /usr/bin/grep -i '^/Windows/System32/startnet.cmd$'" % ps_file_name] + startnet_path = utils.subprocess_get(cmd, shell=True)[0:-1] + cmd = [wimupdate, ps_file_name, "--command=add %s %s" % (pi_file.name, startnet_path)] utils.subprocess_call(cmd, shell=False) pi_file.close() diff --git a/cobbler/utils.py b/cobbler/utils.py index 0bc75bae30..cd6c830513 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -67,8 +67,8 @@ MODULE_CACHE = {} SIGNATURE_CACHE = {} -_re_kernel = re.compile(r'(vmlinu[xz]|(kernel|linux(\.img)?))') -_re_initrd = re.compile(r'(initrd(.*)\.img|ramdisk\.image\.gz)') +_re_kernel = re.compile(r'(vmlinu[xz]|(kernel|linux(\.img)?)|pxeboot\.n12|wimboot)') +_re_initrd = re.compile(r'(initrd(.*)\.img|ramdisk\.image\.gz|boot\.sdi)') class DHCP(enum.Enum): @@ -1580,11 +1580,11 @@ def get_supported_distro_boot_loaders(distro, api_handle=None): """ try: # Try to read from the signature - return api_handle.get_signatures()["breeds"][distro.breed][distro.os_version]["boot_loaders"][distro.arch] + return api_handle.get_signatures()["breeds"][distro.breed][distro.os_version]["boot_loaders"][distro.arch.value] except: try: # Try to read directly from the cache - return SIGNATURE_CACHE["breeds"][distro.breed][distro.os_version]["boot_loaders"][distro.arch] + return SIGNATURE_CACHE["breeds"][distro.breed][distro.os_version]["boot_loaders"][distro.arch.value] except: try: # Else use some well-known defaults @@ -1594,7 +1594,7 @@ def get_supported_distro_boot_loaders(distro, api_handle=None): "ppc64el": ["grub", "pxe"], "aarch64": ["grub"], "i386": ["grub", "pxe", "ipxe"], - "x86_64": ["grub", "pxe", "ipxe"]}[distro.arch] + "x86_64": ["grub", "pxe", "ipxe"]}[distro.arch.value] except: # Else return the globally known list return get_supported_system_boot_loaders() diff --git a/config/cobbler/distro_signatures.json b/config/cobbler/distro_signatures.json index 5972ff59fd..2fa25e0de6 100644 --- a/config/cobbler/distro_signatures.json +++ b/config/cobbler/distro_signatures.json @@ -2880,48 +2880,183 @@ }, "windows": { "2003": { + "signatures": [ + "amd64", + "i386", + "autorun.inf" + ], + "version_file": "relnotes\\.htm", + "version_file_regex": "^.*Microsoft Windows Server 2003.*$", + "kernel_arch": "(amd64|i386)", + "kernel_arch_regex": null, "supported_arches":["i386","x86_64"], "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", "boot_files": [ "i386/*.*", "amd64/*.*" ] }, "2008": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows Server 2008.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["i386","x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "2012": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows Server 2012.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "2016": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows Server 2016.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "2019": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows Server 2019.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "XP": { + "signatures": [ + "amd64", + "i386", + "autorun.inf" + ], + "version_file": "readme\\.htm", + "version_file_regex": "^Version of Microsoft Windows XP.*$", + "kernel_arch": "(amd64|i386)", + "kernel_arch_regex": null, "supported_arches":["i386","x86_64"], "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", "boot_files": [ "i386/*.*", "amd64/*.*" ] }, "7": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows 7.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["i386","x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "8": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows 8.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["i386","x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] }, "10": { + "signatures": [ + "sources", + "autorun.inf" + ], + "version_file": "install\\.wim", + "version_file_regex": "^Name:.*Windows 10.*$", + "kernel_arch": "install\\.wim", + "kernel_arch_regex": "^Architecture:.*(x86|x86_64)$", "supported_arches":["i386","x86_64"], - "boot_loaders":{"x86_64":["pxe","ipxe"]} + "boot_loaders":{"x86_64":["pxe","ipxe"]}, + "supported_repo_breeds": [], + "kernel_file": "pxeboot\\.n12", + "initrd_file": "boot\\.sdi", + "default_autoinstall": "win.ks", + "kernel_options": "", + "kernel_options_post": "", + "boot_files": [] } }, "powerkvm": { diff --git a/docs/user-guide/wingen.rst b/docs/user-guide/wingen.rst index bdb5d0ba14..a865903033 100644 --- a/docs/user-guide/wingen.rst +++ b/docs/user-guide/wingen.rst @@ -73,18 +73,18 @@ The ``sync_post_wingen`` trigger uses the following set of metadata: - bcd - This key is used to pass the value of the ``BCD` file name in case of using Micrisoft ADK/WAIK. Any ``BCD`` file from the Windows distribution can be used as a source for this file. The trigger copies it, then removes all boot information from the copy and adds new data from the ``initrd`` value of the distro and the value passed through the ``winpe`` metadata key. + This key is used to pass the value of the ``BCD`` file name in case of using Micrisoft ADK/WAIK. Any ``BCD`` file from the Windows distribution can be used as a source for this file. The trigger copies it, then removes all boot information from the copy and adds new data from the ``initrd`` value of the distro and the value passed through the ``winpe`` metadata key. - winpe - This metadata key allows you to specify the name of the WinPE image. The image is copied by the cp utility trigger with the ``--reflink=auto` option, which allows to reduce copying time and the size of the disk space on CoW file systems. + This metadata key allows you to specify the name of the WinPE image. The image is copied by the cp utility trigger with the ``--reflink=auto`` option, which allows to reduce copying time and the size of the disk space on CoW file systems. In the copy of the file, the tribger changes the ``/Windows/System32/startnet.cmd`` script to the script generated from the ``startnet.template`` template. - answerfile - This is the name of the answer file for the Windows installation. This file is generated from the answerfile.template template and is used in: - - startnet.cmd to start WinPE installation - - the file name is written to the binary file setupldr.exe for RIS + This is the name of the answer file for the Windows installation. This file is generated from the ``answerfile.template`` template and is used in: + - ``startnet.cmd`` to start WinPE installation + - the file name is written to the binary file ``setupldr.exe`` for RIS - post_install_script @@ -102,61 +102,28 @@ Preparing for an unattended network installation of Windows =========================================================== - ``dnf install python3-pefile python3-hivex wimlib-utils`` -- enable Windows support in settings /etc/cobbler/settings.d/windows.settings: +- enable Windows support in settings ``/etc/cobbler/settings.d/windows.settings``: .. code:: windows_enabled: true -- copy the Windows distributions to ``/var/www/cobbler/distro_mirror``: +- import the Windows distributions to ``/var/www/cobbler/distro_mirror``: .. code:: - dr-xr-xr-x. 1 root root 200 Mar 23 2017 Win10_EN-x64 - dr-xr-xr-x. 1 root root 238 Aug 7 2015 Win2012-Server_EN-x64 - dr-xr-xr-x. 1 root root 220 May 17 2019 Win2016-Server_EN-x64 - drwxr-xr-x. 1 root root 236 Dec 3 22:42 Win2019-Server_EN-x64 - dr-xr-xr-x. 1 root root 788 Aug 8 2015 Win2k3-Server_EN-x64 - dr-xr-xr-x. 1 root root 196 Sep 24 2017 Win2k8-Server_EN-x64 - dr-xr-xr-x. 1 root root 132 Aug 8 2015 Win7_EN-x64 - dr-xr-xr-x. 1 root root 238 Aug 7 2015 Win8_EN-x64 - dr-xr-xr-x. 1 root root 456 Aug 8 2015 WinXp_EN-i386 + cobbler import --name=Win10_EN-x64 --path=/mnt -Copy the following files to the distributions directories (for Windows 7 and newer): - -PXE + Legacy BIOS Boot - - Boot/pxeboot.n12 - - Boot/bootmgr.exe - - Boot/bcd - - Boot/boot.sdi - -iPXE + UEFI/BIOS Boot - - /var/lib/tftpboot/wimboot from https://ipxe.org/wimboot - - Boot/bootmgr.exe - - Boot/bcd - - Boot/boot.sdi - -Example: - -.. code:: - - cd /var/www/cobbler/distro_mirror/Win10_EN-x64 - mkdir -p Boot - wimextract sources/boot.wim 1 /windows/Boot/PXE/{pxeboot.n12,bootmgr.exe} \ - /windows/Boot/DVD/EFI/{BCD,boot.sdi} \ - --dest-dir=Boot - mv Boot/BCD Boot/bcd - -- To get winpe.win you need: +This command will determine the version and architecture of the Windows distribution, will extract the necessary boot files from the distribution and create a distro and profile named ``Win10_EN-x64``. +- For customization winpe.win you need - ADK for Windows 10 / 8.1 .. code:: Start -> Apps -> Windows Kits -> Deployment and Imaging Tools Environment - or - +or - WAIK for Windows 7 .. code:: @@ -167,11 +134,10 @@ Example: copype.cmd c:\winpe - After executing the command, the WinPE image will be located in ``.\winpe.wim`` for WAIK and in ``media\sources\boot.wim`` for ADK - +After executing the command, the WinPE image will be located in ``.\winpe.wim`` for WAIK and in ``media\sources\boot.wim`` for ADK. You can use either it or replace it with the one that has been obtained as a result of the import of the Windows distribution. - If necessary, add drivers to the image - Example: +Example: .. code-block:: shell @@ -180,7 +146,7 @@ Example: dism /image:mount /add-driver /driver:D:\viostor\w10\amd64 dism /unmount-wim /mountdir:mount /commit -- Copy the resulting WiNPE image from Windows to the ``Boot`` directory of the distro +- Copy the resulting WiNPE image from Windows to the ``boot`` directory of the distro - Share ```/var/www/cobbler/distro_mirror``` via Samba: .. code-block:: shell @@ -195,7 +161,7 @@ Example: printable = no -- You can use ``tftpd.rules`` to indicate the actual locations of the bootmgr.exe and BCD files generated by the trigger. +- You can use ``tftpd.rules`` to indicate the actual locations of the ``bootmgr.exe`` and ``BCD`` files generated by the trigger. .. code-block:: shell @@ -209,7 +175,7 @@ Replace the line in the ``/etc/systemd/system/tftp.service`` to: ExecStart=/usr/sbin/in.tftpd -m /etc/tftpd.rules -s /var/lib/tftpboot -Create a file /etc/tftpd.rules: +Create a file ``/etc/tftpd.rules``: .. code-block:: shell @@ -263,13 +229,13 @@ Final steps systemctl restart smb systemctl restart nmb -- add distros for PXE boot: +- add additional distros for PXE boot: .. code-block:: shell cobbler distro add --name=Win10_EN-x64 \ - --kernel=/var/www/cobbler/distro_mirror/Win10_EN-x64/Boot/pxeboot.n12 \ - --initrd=/var/www/cobbler/distro_mirror/Win10_EN-x64/Boot/boot.sdi \ + --kernel=/var/www/cobbler/distro_mirror/Win10_EN-x64/boot/pxeboot.n12 \ + --initrd=/var/www/cobbler/distro_mirror/Win10_EN-x64/boot/boot.sdi \ --arch=x86_64 --breed=windows --os-version=10 or for iPXE: @@ -278,13 +244,13 @@ or for iPXE: cobbler distro add --name=Win10_EN-x64 \ --kernel=/var/lib/tftpboot/wimboot \ - --initrd=/var/www/cobbler/distro_mirror/Win10_EN-x64/Boot/boot.sdi \ + --initrd=/var/www/cobbler/distro_mirror/Win10_EN-x64/boot/boot.sdi \ --remote-boot-kernel=http://@@http_server@@/cobbler/images/@@distro_name@@/wimboot \ --remote-boot-initrd=http://@@http_server@@/cobbler/images/@@distro_name@@/boot.sdi \ --arch=x86_64 --breed=windows --os-version=10 \ --boot-loaders=ipxe -- and profiles for PXE boot: +- and additional profiles for PXE boot: .. code-block:: shell @@ -365,15 +331,15 @@ The boot menu will look like this: Legacy Windows XP and Windows 2003 Server ========================================= -- WinPE 3.0 and winboot can be used to install legacy versions of Windows. ``startnet.template`` contains the code for starting such an installation via winnt32.exe. +- WinPE 3.0 and winboot can be used to install legacy versions of Windows. ``startnet.template`` contains the code for starting such an installation via ``winnt32.exe``. - - copy ``bootmgr.exe``, ``bcd``, ``boot.sdi`` from Windows 7 and winpe.wim from WAIK to the ``/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot`` + - copy ``bootmgr.exe``, ``bcd``, ``boot.sdi`` from Windows 7 and ``winpe.wim`` from WAIK to the ``/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot`` .. code-block:: shell cobbler distro add --name=WinXp_EN-i386 \ --kernel=/var/lib/tftpboot/wimboot \ - --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot/boot.sdi \ + --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot/boot.sdi \ --remote-boot-kernel=http://@@http_server@@/cobbler/images/@@distro_name@@/wimboot \ --remote-boot-initrd=http://@@http_server@@/cobbler/images/@@distro_name@@/boot.sdi \ --arch=i386 --breed=windows --os-version=XP \ @@ -381,7 +347,7 @@ Legacy Windows XP and Windows 2003 Server cobbler distro add --name=Win2k3-Server_EN-x64 \ --kernel=/var/lib/tftpboot/wimboot \ - --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/boot.sdi \ + --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/boot.sdi \ --remote-boot-kernel=http://@@http_server@@/cobbler/images/@@distro_name@@/wimboot \ --remote-boot-initrd=http://@@http_server@@/cobbler/images/@@distro_name@@/boot.sdi \ --arch=x86_64 --breed=windows --os-version=2003 \ @@ -393,21 +359,21 @@ Legacy Windows XP and Windows 2003 Server cobbler profile add --name=Win2k3-Server_EN-x64 --distro=Win2k3-Server_EN-x64 --autoinstall=win.ks \ --autoinstall-meta='bootmgr=boot3ea.exe bcd=3Ea winpe=winpe.wim answerfile=wi2k3.sif post_install_script=post_install.cmd' -- WinPE 3.0 without winboot also can be used to install legacy versions of Windows. +- WinPE 3.0 without ``winboot`` also can be used to install legacy versions of Windows. - - copy ``pxeboot.n12``, ``bootmgr.exe``, ``bcd``, ``boot.sdi`` from Windows 7 and winpe.wim from WAIK to the ``/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot`` + - copy ``pxeboot.n12``, ``bootmgr.exe``, ``bcd``, ``boot.sdi`` from Windows 7 and ``winpe.wim`` from WAIK to the ``/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot`` .. code-block:: shell cobbler distro add --name=WinXp_EN-i386 \ - --kernel=/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot/pxeboot.n12 \ - --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot/boot.sdi \ + --kernel=/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot/pxeboot.n12 \ + --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot/boot.sdi \ --arch=i386 --breed=windows --os-version=XP \ --autoinstall-meta='clean_disk' cobbler distro add --name=Win2k3-Server_EN-x64 \ - --kernel=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/pxeboot.n12 \ - --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/boot.sdi \ + --kernel=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/pxeboot.n12 \ + --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/boot.sdi \ --arch=x86_64 --breed=windows --os-version=2003 \ --autoinstall-meta='clean_disk' @@ -451,7 +417,7 @@ To support 64 bit distributions: systemctl daemon-reload mkdir -p /var/lib/tftpboot/winos/inf64 -copy the Windows network drivers to ``/var/lib/tftpboot/winos/inf[64]`` and start ris-linuxd[64]: +copy the Windows network drivers to ``/var/lib/tftpboot/winos/inf[64]`` and start ``ris-linuxd[64]``: .. code-block:: shell @@ -465,40 +431,40 @@ Preparing boot files for RIS and legacy Windows XP and Windows 2003 Server dnf install cabextract cd /var/www/cobbler/distro_mirror/ - mkdir Boot + mkdir boot cp i386/ntdetect.com /var/lib/tftpboot - cabextract -dBoot i386/setupldr.ex_ + cabextract -dboot i386/setupldr.ex_ -If you need to install Windows 2003 Server in addition to Windows XP, then to avoid a conflict, you can rename the ntdetect.com file: +If you need to install Windows 2003 Server in addition to Windows XP, then to avoid a conflict, you can rename the ``ntdetect.com`` file: .. code-block:: shell mv /var/lib/tftpboot/ntdetect.com /var/lib/tftpboot/ntdetect.wxp - sed -i -e 's/ntdetect\.com/ntdetect\.wxp/g' Boot/setupldr.exe + sed -i -e 's/ntdetect\.com/ntdetect\.wxp/g' boot/setupldr.exe cp /var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/i386/ntdetect.com /var/lib/tftpboot/ntdetect.2k3 - sed -i -e 's/ntdetect\.com/ntdetect\.2k3/g' /var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/setupldr.exe - sed -bi "s/\x0F\xAB\x00\x00/\x0F\xAC\x00\x00/" /var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/setupldr.exe + sed -i -e 's/ntdetect\.com/ntdetect\.2k3/g' /var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/setupldr.exe + sed -bi "s/\x0F\xAB\x00\x00/\x0F\xAC\x00\x00/" /var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/setupldr.exe .. code-block:: shell - cabextract -dBoot i386/startrom.n1_ - mv Boot/startrom.n12 Boot/pxeboot.n12 - touch Boot/boot.sdi + cabextract -dboot i386/startrom.n1_ + mv Boot/startrom.n12 boot/pxeboot.n12 + touch boot/boot.sdi Copy the required drivers to the ``i386`` .. code-block:: shell cobbler distro add --name=WinXp_EN-i386 \ - --kernel=/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot/pxeboot.n12 \ - --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/Boot/boot.sdi \ + --kernel=/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot/pxeboot.n12 \ + --initrd=/var/www/cobbler/distro_mirror/WinXp_EN-i386/boot/boot.sdi \ --boot-files='@@local_img_path@@/i386/=@@web_img_path@@/i386/*.*' \ --arch=i386 --breed=windows –os-version=XP cobbler distro add --name=Win2k3-Server_EN-x64 \ - --kernel=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/pxeboot.n12 \ - --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/Boot/boot.sdi \ + --kernel=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/pxeboot.n12 \ + --initrd=/var/www/cobbler/distro_mirror/Win2k3-Server_EN-x64/boot/boot.sdi \ --boot-files='@@local_img_path@@/i386/=@@web_img_path@@/[ia][3m][8d]6*/*.*' \ --arch=x86_64 --breed=windows --os-version=2003