"linux-hardened",
"linux-zen",
}
+
kernel_packages = official_kernel_packages.intersection(args.packages)
- packages |= kernel_packages
if len(kernel_packages) > 1:
warn('More than one kernel will be installed: {}', ' '.join(kernel_packages))
packages.add("device-mapper")
if not kernel_packages:
# No user-specified kernel
- packages.add("linux")
+ kernel_packages.add("linux")
+ if args.bios_partno:
+ packages.add("grub")
+
+ packages.add("mkinitcpio")
# Set up system with packages from the base group
run_pacstrap(packages)
- # Install the user-specified packages
+ # Patch mkinitcpio configuration so: 1) we remove autodetect and
+ # 2) we add the modules needed for encrypt.
+ patch_file(os.path.join(workspace, "root", "etc/mkinitcpio.conf"),
+ lambda line: "HOOKS=\"systemd modconf block sd-encrypt filesystems keyboard fsck\"\n" if line.startswith("HOOKS=") and args.encrypt == "all" else
+ "HOOKS=\"systemd modconf block filesystems fsck\"\n" if line.startswith("HOOKS=") else
+ line)
+
+ # Install the user-specified packages and kernel
packages = set(args.packages)
+ if args.bootable:
+ packages |= kernel_packages
+
if run_build_script:
packages.update(args.build_packages)
# Remove already installed packages
def install_boot_loader_fedora(args, workspace, loopdev):
install_grub(args, workspace, loopdev, "grub2")
-def install_boot_loader_arch(args, workspace):
- patch_file(os.path.join(workspace, "root", "etc/mkinitcpio.conf"),
- lambda line: "HOOKS=\"systemd modconf block sd-encrypt filesystems keyboard fsck\"\n" if line.startswith("HOOKS=") and args.encrypt == "all" else
- "HOOKS=\"systemd modconf block filesystems fsck\"\n" if line.startswith("HOOKS=") else
- line)
+def install_boot_loader_arch(args, workspace, loopdev):
+ if "uefi" in args.boot_protocols:
+ # add loader entries and copy kernel/initrd under that entry
+ workspace_root = os.path.join(workspace, "root")
+ kernel_version = next(filter(lambda x: x[0].isdigit(), os.listdir(os.path.join(workspace_root, "lib/modules"))))
+ run_workspace_command(args, workspace, "/usr/bin/kernel-install", "add", kernel_version, find_kernel_file(workspace_root, "/boot/vmlinuz-*"))
- workspace_root = os.path.join(workspace, "root")
- kernel_version = next(filter(lambda x: x[0].isdigit(), os.listdir(os.path.join(workspace_root, "lib/modules"))))
- run_workspace_command(args, workspace, "/usr/bin/kernel-install", "add", kernel_version, find_kernel_file(workspace_root, "/boot/vmlinuz-*"))
+ if "bios" in args.boot_protocols:
+ install_grub(args, workspace, loopdev, "grub")
def install_boot_loader_debian(args, workspace):
kernel_version = next(filter(lambda x: x[0].isdigit(), os.listdir(os.path.join(workspace, "root", "lib/modules"))))
install_boot_loader_fedora(args, workspace, loopdev)
if args.distribution == Distribution.arch:
- install_boot_loader_arch(args, workspace)
+ install_boot_loader_arch(args, workspace, loopdev)
if args.distribution == Distribution.debian:
install_boot_loader_debian(args, workspace)
args.boot_protocols = ["uefi"]
if not {"uefi", "bios"}.issuperset(args.boot_protocols):
die("Not a valid boot protocol")
- if "bios" in args.boot_protocols and args.distribution not in (Distribution.fedora,):
+ if "bios" in args.boot_protocols and args.distribution not in (Distribution.fedora,Distribution.arch):
die(f"bios boot not implemented yet for {args.distribution}")
if args.encrypt is not None: