Пример #1
0
def install_bootloader(boot_loader, fw_type):
    if fw_type == 'efi':
        install_path = libcalamares.globalstorage.value("rootMountPoint")
        uuid = get_uuid()
        distribution = get_bootloader_entry_name()
        file_name_sanitizer = str.maketrans(" /", "_-")
        conf_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s.conf" % distribution.translate(file_name_sanitizer))
        fallback_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s-fallback.conf" % distribution.translate(file_name_sanitizer))
        loader_path = os.path.join(
            install_path, "boot", "loader", "loader.conf")
        partitions = libcalamares.globalstorage.value("partitions")
        for partition in partitions:
            if partition["mountPoint"] == "/boot":
                print(partition["device"])
                boot_device = partition["device"]
                boot_p = boot_device[-1:]
                device = boot_device[:-1]
                print(device)
        subprocess.call(["sgdisk", "--typecode=%s:EF00" % boot_p, "%s" % device])
        subprocess.call(
            ["gummiboot", "--path=%s/boot" % install_path, "install"])
        create_conf(uuid, conf_path)
        create_fallback(uuid, fallback_path)
        create_loader(loader_path)
    else:
        install_path = boot_loader["installPath"]
        check_chroot_call(
            [libcalamares.job.configuration["grubInstall"], install_path])
        check_chroot_call([libcalamares.job.configuration[
                          "grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
Пример #2
0
def install_bootloader(boot_loader, fw_type):
    if fw_type == 'efi':
        install_path = libcalamares.globalstorage.value("rootMountPoint")
        uuid = get_uuid()
        distribution = libcalamares.job.configuration["distribution"]
        conf_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s.conf" % distribution)
        fallback_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s-fallback.conf" % distribution)
        loader_path = os.path.join(
            install_path, "boot", "loader", "loader.conf")
        partitions = libcalamares.globalstorage.value("partitions")
        for partition in partitions:
            if partition["mountPoint"] == "/boot":
                print(partition["device"])
                boot_device = partition["device"]
                boot_p = boot_device[-1:]
                device = boot_device[:-1]
                print(device)
        subprocess.call(["sgdisk", "--typecode=%s:EF00" % boot_p, "%s" % device])
        subprocess.call(
            ["bootctl", "--path=%s/boot" % install_path, "install"])
        create_conf(uuid, conf_path)
        create_fallback(uuid, fallback_path)
        create_loader(loader_path)
    else:
        install_path = boot_loader["installPath"]
        check_chroot_call(["grub-install", install_path])
        check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
Пример #3
0
def run():
    """ Starts procedure and passes 'fw_type' to other routine.

    :return:
    """
    if libcalamares.globalstorage.value("bootLoader") is None:
        return None
    check_chroot_call(["os-prober"])
    fw_type = libcalamares.globalstorage.value("firmwareType")
    prepare_bootloader(fw_type)

    check_chroot_call(["/etc/apricity-assets/postinstall.sh"])

    return None
Пример #4
0
def run():
    """ Generate machine-id using dbus and systemd.

    :return:
    """
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
    enable_systemd = libcalamares.job.configuration["systemd"]
    enable_dbus = libcalamares.job.configuration["dbus"]
    enable_symlink = libcalamares.job.configuration["symlink"]
    target_systemd_machineid_file = "{}/etc/machine-id".format(
        root_mount_point)

    if enable_systemd:
        if os.path.exists(target_systemd_machineid_file):
            os.remove(target_systemd_machineid_file)

        check_chroot_call("systemd-machine-id-setup")

    if enable_dbus:
        target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(
            root_mount_point)

        if os.path.exists(target_dbus_machineid_file):
            os.remove(target_dbus_machineid_file)

        if enable_symlink and os.path.exists(target_systemd_machineid_file):
            check_chroot_call(
                ["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"])
        else:
            check_chroot_call(["dbus-uuidgen", "--ensure"])

    return None
Пример #5
0
def install_grub(boot_loader, fw_type):
    if fw_type == 'efi':
        efi_directory = "/boot/efi"
        if "efiBootloaderId" in libcalamares.job.configuration:
            efi_bootloader_id = libcalamares.job.configuration[
                "efiBootloaderId"]
        else:
            branding = libcalamares.globalstorage.value("branding")
            distribution = branding["bootloaderEntryName"]
            file_name_sanitizer = str.maketrans(" /", "_-")
            efi_bootloader_id = distribution.translate(file_name_sanitizer)
        check_chroot_call([
            libcalamares.job.configuration["grubInstall"],
            "--target=x86_64-efi",
            "--efi-directory={!s}".format(efi_directory),
            "--bootloader-id={!s}".format(efi_bootloader_id)
        ])
        # Workaround for some UEFI firmwares
        chroot_call(["mkdir", "-p", "{!s}/EFI/boot".format(efi_directory)])
        chroot_call([
            "cp", "{!s}/EFI/{!s}/grubx64.efi".format(efi_directory,
                                                     efi_bootloader_id),
            "{!s}/EFI/boot/bootx64.efi".format(efi_directory)
        ])
    else:
        install_path = boot_loader["installPath"]
        check_chroot_call([
            libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
            install_path
        ])

    check_chroot_call([
        libcalamares.job.configuration["grubMkconfig"], "-o",
        libcalamares.job.configuration["grubCfg"]
    ])
Пример #6
0
def run():
    """ Generate machine-id using dbus and systemd.

    :return:
    """
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
    enable_systemd = libcalamares.job.configuration["systemd"]
    enable_dbus = libcalamares.job.configuration["dbus"]
    enable_symlink = libcalamares.job.configuration["symlink"]
    target_systemd_machineid_file = "{}/etc/machine-id".format(root_mount_point)

    if enable_systemd:
        if os.path.exists(target_systemd_machineid_file):
            os.remove(target_systemd_machineid_file)

        check_chroot_call("systemd-machine-id-setup")

    if enable_dbus:
        target_dbus_machineid_file = "{}/var/lib/dbus/machine-id".format(root_mount_point)

        if os.path.exists(target_dbus_machineid_file):
            os.remove(target_dbus_machineid_file)

        if enable_symlink and os.path.exists(target_systemd_machineid_file):
            check_chroot_call(["ln", "-s", "/etc/machine-id", "/var/lib/dbus/machine-id"])
        else:
            check_chroot_call(["dbus-uuidgen", "--ensure"])

    return None
Пример #7
0
def run():
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
    boot_loader = libcalamares.globalstorage.value("bootLoader")
    install_path = boot_loader["installPath"]
    partitions = libcalamares.globalstorage.value("partitions")

    boot_partition = find_boot_partition(partitions)

    mbr_bak = os.path.join(CONF_DIR, "mbr.bak")
    mbr_bin = "/usr/share/syslinux/mbr.bin"

    check_chroot_call(["/sbin/extlinux", "-i", CONF_DIR])
    check_chroot_call(["/bin/dd", "if=" + install_path, "of=" + mbr_bak, "count=1", "bs=512"])
    check_chroot_call(["/bin/dd", "if=" + mbr_bin, "of=" + install_path])
    check_chroot_call(["sfdisk", "--activate=" + boot_partition, install_path])
    return None
Пример #8
0
def install_bootloader(boot_loader, fw_type):
    if fw_type == 'efi':
        install_path = libcalamares.globalstorage.value("rootMountPoint")
        uuid = get_uuid()
        distribution = libcalamares.job.configuration["distribution"]
        conf_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s.conf" % distribution)
        fallback_path = os.path.join(
            install_path, "boot", "loader", "entries", "%s-fallback.conf" % distribution)
        loader_path = os.path.join(
            install_path, "boot", "loader", "loader.conf")
        partitions = libcalamares.globalstorage.value("partitions")
        for partition in partitions:
            if partition["mountPoint"] == "/boot":
                print(partition["device"])
                boot_device = partition["device"]
                boot_p = boot_device[-1:]
                device = boot_device[:-1]

                if not boot_p or not device:
                    return ("EFI directory /boot not found!",
                            "Boot partition: \"{!s}\"",
                            "Boot device: \"{!s}\"".format(boot_p, device))
                else:
                    print("EFI directory: /boot")
                    print("Boot partition: \"{!s}\"".format(boot_p))
                    print("Boot device: \"{!s}\"".format(device))
        subprocess.call(["sgdisk", "--typecode=%s:EF00" % boot_p, "%s" % device])
        subprocess.call(
            ["bootctl", "--path=%s/boot" % install_path, "install"])
        create_conf(uuid, conf_path)
        create_fallback(uuid, fallback_path)
        create_loader(loader_path)
    else:
        install_path = boot_loader["installPath"]
        check_chroot_call(["grub-install", install_path])
        check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
Пример #9
0
def install_grub(boot_loader, fw_type):
    if fw_type == 'efi':
        efi_directory = "/boot/efi"
        if "efiBootloaderId" in libcalamares.job.configuration:
            efi_bootloader_id = libcalamares.job.configuration["efiBootloaderId"]
        else:
            branding = libcalamares.globalstorage.value("branding")
            distribution = branding["bootloaderEntryName"]
            file_name_sanitizer = str.maketrans(" /", "_-")
            efi_bootloader_id = distribution.translate(file_name_sanitizer)
        check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi", "--efi-directory={!s}".format(efi_directory), "--bootloader-id={!s}".format(efi_bootloader_id)])
    else:
        install_path = boot_loader["installPath"]
        check_chroot_call([libcalamares.job.configuration["grubInstall"], "--target=i386-pc", install_path])

    check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o", libcalamares.job.configuration["grubCfg"]])
Пример #10
0
def cleanup():
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")

    # Remove pacman init service
    if(os.path.exists("%s/etc/systemd/system/etc-pacman.d-gnupg.mount" % root_mount_point)):
        chroot_call(['rm', '-f', '/etc/systemd/system/etc-pacman.d-gnupg.mount'])
    if(os.path.exists("%s/etc/systemd/system/pacman-init.service" % root_mount_point)):
        chroot_call(['rm', '-f', '/etc/systemd/system/pacman-init.service'])

    # Init pacman keyring
    check_chroot_call(['rm', '-rf', '/etc/pacman.d/gnupg'])
    check_chroot_call(['pacman-key', '--init'])
    check_chroot_call(['pacman-key', '--populate', 'archlinux'])
    chroot_call(['pacman-key', '--refresh-keys'])

    
    # Modify lightdm config

    chroot_call(['rm', '-f', '/etc/lightdm/lightdm.conf'])
    chroot_call(['mv', '-f', '/etc/lightdm/lightdm.conf.new', '/etc/lightdm/lightdm.conf'])
Пример #11
0
 def install(self, pkgs):
     if self.backend == "packagekit":
         for pkg in pkgs:
             check_chroot_call(["pkcon", "-py", "install", pkg])
     elif self.backend == "zypp":
         check_chroot_call([
             "zypper", "--non-interactive", "--quiet-install", "install",
             "--auto-agree-with-licenses", "install"
         ] + pkgs)
     elif self.backend == "yum":
         check_chroot_call(["yum", "install", "-y"] + pkgs)
     elif self.backend == "dnf":
         check_chroot_call(["dnf", "install", "-y"] + pkgs)
     elif self.backend == "urpmi":
         check_chroot_call(["urpmi"] + pkgs)
     elif self.backend == "apt":
         check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
     elif self.backend == "pacman":
         check_chroot_call(["pacman", "-Sy"] + pkgs)
Пример #12
0
 def remove(self, pkgs):
     if self.backend == "packagekit":
         for pkg in pkgs:
             check_chroot_call(["pkcon", "-py", "remove", pkg])
     elif self.backend == "zypp":
         check_chroot_call(["zypper", "--non-interactive", "remove"] + pkgs)
     elif self.backend == "yum":
         check_chroot_call(["yum", "-y", "remove"] + pkgs)
     elif self.backend == "dnf":
         check_chroot_call(["dnf", "-y", "remove"] + pkgs)
     elif self.backend == "urpmi":
         check_chroot_call(["urpme"] + pkgs)
     elif self.backend == "apt":
         check_chroot_call(["apt-get", "--purge", "-q", "-y", "remove"] +
                           pkgs)
     elif self.backend == "pacman":
         check_chroot_call(["pacman", "-R"] + pkgs)
Пример #13
0
def run_dracut():
    check_chroot_call(['dracut', '-f'])
Пример #14
0
def run_mkinitcpio():
    """ Runs mkinitcpio with given kernel profile """
    kernel = libcalamares.job.configuration['kernel']
    check_chroot_call(['mkinitcpio', '-p', kernel])
Пример #15
0
 def remove(self, pkgs):
     if self.backend == "packagekit":
         for pkg in pkgs:
             check_chroot_call(["pkcon", "-py", "remove", pkg])
     elif self.backend == "zypp":
         check_chroot_call(["zypper", "--non-interactive", "remove"] + pkgs)
     elif self.backend == "yum":
         check_chroot_call(["yum", "-y", "remove"] + pkgs)
     elif self.backend == "dnf":
         check_chroot_call(["dnf", "-y", "remove"] + pkgs)
     elif self.backend == "urpmi":
         check_chroot_call(["urpme"] + pkgs)
     elif self.backend == "apt":
         check_chroot_call(["apt-get", "--purge", "-q", "-y", "remove"] + pkgs)
     elif self.backend == "pacman":
         check_chroot_call(["pacman", "-R"] + pkgs)
Пример #16
0
def postinstall():
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")

    check_chroot_call(["userdel", "-r", "live"])
Пример #17
0
def install_grub(efi_directory, fw_type):
    """ Installs grub as bootloader, either in pc or efi mode.

    :param efi_directory:
    :param fw_type:
    """
    if fw_type == "efi":
        print("Bootloader: grub (efi)")
        efi_directory_firmware = efi_directory + "/EFI"
        check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])

        if "efiBootloaderId" in libcalamares.job.configuration:
            efi_bootloader_id = libcalamares.job.configuration[
                "efiBootloaderId"]
        else:
            branding = libcalamares.globalstorage.value("branding")
            distribution = branding["bootloaderEntryName"]
            file_name_sanitizer = str.maketrans(" /", "_-")
            efi_bootloader_id = distribution.translate(file_name_sanitizer)
        check_chroot_call([
            libcalamares.job.configuration["grubInstall"],
            "--target=x86_64-efi",
            "--efi-directory={!s}".format(efi_directory),
            "--bootloader-id={!s}".format(efi_bootloader_id), "--force"
        ])
        # Workaround for some UEFI firmwares
        check_chroot_call(
            ["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
        check_chroot_call([
            "cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,
                                                 efi_bootloader_id),
            "{!s}/boot/bootx64.efi".format(efi_directory_firmware)
        ])
    else:
        print("Bootloader: grub (bios)")
        boot_loader = libcalamares.globalstorage.value("bootLoader")
        check_chroot_call([
            libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
            "--recheck", "--force", boot_loader["installPath"]
        ])

    check_chroot_call([
        libcalamares.job.configuration["grubMkconfig"], "-o",
        libcalamares.job.configuration["grubCfg"]
    ])
Пример #18
0
    check_chroot_call(['rm', '-rf', '/etc/pacman.d/gnupg'])
    check_chroot_call(['pacman-key', '--init'])
    check_chroot_call(['pacman-key', '--populate', 'archlinux'])
    chroot_call(['pacman-key', '--refresh-keys'])

    
    # Modify lightdm config

    chroot_call(['rm', '-f', '/etc/lightdm/lightdm.conf'])
    chroot_call(['mv', '-f', '/etc/lightdm/lightdm.conf.new', '/etc/lightdm/lightdm.conf'])
#Fix Live
chroot_call(['rm', '-f', '/etc/sudoers'])
chroot_call(['mv', '-f', '/etc/sudoers.new', '/etc/sudoers'])
chroot_call(['rm', '-f', '/etc/sudoers.d/g_wheel'])
chroot_call(['rm', '-f', '/etc/xdg/autostart/calamares.desktop'])
check_chroot_call(['sed', '-i', '"s/antergos/alphaos/"', '/etc/lightdm/lightdm-webkit2-greeter.conf'])
#Fix Sudo
chroot_call(['chmod', '700', '/root'])
chroot_call(['chown', 'root:root', '/etc/sudoers '])
chroot_call(['chmod', '440', '/etc/sudoers'])
chroot_call(['chown', '-R', 'root:root', '/etc/sudoers.d'])
chroot_call(['chmod', '755', 'root:root', '/etc/sudoers.d'])
chroot_call(['chmod', '440', '/etc/sudoers.d/*'])
# Remove calamares
check_chroot_call(['pacman', '-R', '--noconfirm', 'calamares'])
chroot_call(['chmod', '755', 'root:root', '/etc/sudoers.d'])
#Remove Live User
check_chroot_call(['userdel', 'alpha'])

def run():
    cleanup()
Пример #19
0
def write_conf(partitions, root_mount_point, install_path):
    plymouth_bin = os.path.join(root_mount_point, "usr/bin/plymouth")
    use_splash = ""
    swap_uuid = ""
    root_device = ""

    if os.path.exists(plymouth_bin):
        use_splash = "splash"

    for partition in partitions:
        if partition["mountPoint"] == "/":
            root_device = partition["device"]
        if partition["fs"] == "linuxswap":
            swap_uuid = partition["uuid"]

    kernel_cmdline = "root=%s ro " % root_device
    if swap_uuid != "":
        kernel_cmdline += "resume=UUID=%s quiet %s" % (swap_uuid, use_splash)
    else:
        kernel_cmdline += "quiet %s" % use_splash

    cfg_distributor = libcalamares.job.configuration["distributor"]
    cfg_prompt = libcalamares.job.configuration["prompt"]
    cfg_timeout = libcalamares.job.configuration["timeout"]
    cfg_menu = libcalamares.job.configuration["menu"]
    cfg_background = libcalamares.job.configuration["background"]

    conf_dir = root_mount_point + CONF_DIR
    if not os.path.exists(conf_dir):
        os.makedirs(conf_dir)

    conf_file = conf_dir + "/extlinux.conf"
    f = open(conf_file, "w")
    f.write("# extlinux.conf - Generated by Calamares\n\n")
    f.write("prompt %d\n" % cfg_prompt)
    f.write("timeout %d\n" % cfg_timeout)
    if cfg_menu:
        f.write("default %s\n\n" % cfg_menu)
    f.write("menu autoboot Starting...\n")
    f.write("menu hidden\n")
    if cfg_background:
        check_chroot_call(["cp", cfg_background, os.path.join(CONF_DIR, os.path.basename(cfg_background))])
        f.write("menu background %s\n" % os.path.basename(cfg_background))
    f.write("menu title Welcome to %s!\n\n" % cfg_distributor)

    kernels = retrieve_kernels(root_mount_point)
    i = 0
    for kernel in kernels:
        print("Create entry %d for kernel %s" % (i, kernel["version"]))

        f.write("label linux%d\n" % i)
        f.write("\tmenu label %s (%s)\n" % (cfg_distributor, kernel["version"]))
        f.write("\tkernel %s\n" % kernel["filename"])
        if kernel["initramfs"]:
            f.write("\tappend initrd=%s %s\n" % (kernel["initramfs"], kernel_cmdline))
        else:
            f.write("\tappend %s\n" % kernel_cmdline)
        f.write("\tmenu default\n\n")

        kernel_filename = root_mount_point + CONF_DIR + "/" + kernel["filename"]
        if os.path.exists(kernel_filename) or os.path.lexists(kernel_filename):
            os.remove(kernel_filename)
        os.symlink("../%s" % kernel["filename"], kernel_filename)
        if kernel["initramfs"]:
            initramfs_filename = root_mount_point + CONF_DIR + "/" + kernel["initramfs"]
            if os.path.exists(initramfs_filename) or os.path.lexists(initramfs_filename):
                os.remove(initramfs_filename)
            os.symlink("../%s" % kernel["initramfs"], initramfs_filename)

        i += 1

    f.close()    
Пример #20
0
def install_grub(efi_directory, fw_type):
    """ Installs grub as bootloader, either in pc or efi mode.

    :param efi_directory:
    :param fw_type:
    """
    if fw_type == "efi":
        print("Bootloader: grub (efi)")
        efi_directory_firmware = efi_directory + "/EFI"
        check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])
        if "efiBootloaderId" in libcalamares.job.configuration:
            efi_bootloader_id = libcalamares.job.configuration["efiBootloaderId"]
        else:
            branding = libcalamares.globalstorage.value("branding")
            distribution = branding["bootloaderEntryName"]
            file_name_sanitizer = str.maketrans(" /", "_-")
            efi_bootloader_id = distribution.translate(file_name_sanitizer)
        check_chroot_call(
            [libcalamares.job.configuration["grubInstall"], "--target=x86_64-efi",
             "--efi-directory={!s}".format(efi_directory),
             "--bootloader-id={!s}".format(efi_bootloader_id),
             "--force"])
        # Workaround for some UEFI firmwares
        check_chroot_call(["mkdir", "-p", "{!s}/boot".format(efi_directory_firmware)])
        check_chroot_call(["cp", "{!s}/{!s}/grubx64.efi".format(efi_directory_firmware,
                                                                efi_bootloader_id),
                           "{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
    else:
        print("Bootloader: grub (bios)")
        boot_loader = libcalamares.globalstorage.value("bootLoader")
        check_chroot_call(
            [libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
             "--recheck", "--force", boot_loader["installPath"]])

    check_chroot_call([libcalamares.job.configuration["grubMkconfig"], "-o",
                       libcalamares.job.configuration["grubCfg"]])
Пример #21
0
    def remove(self, pkgs):
        """ Removes packages.

        :param pkgs:
        """
        if self.backend == "packagekit":
            for pkg in pkgs:
                check_chroot_call(["pkcon", "-py", "remove", pkg])
        elif self.backend == "zypp":
            check_chroot_call(["zypper", "--non-interactive", "remove"] + pkgs)
        elif self.backend == "yum":
            check_chroot_call(["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
        elif self.backend == "dnf":
            # ignore the error code for now because dnf thinks removing a nonexistent package is an error
            chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
        elif self.backend == "urpmi":
            check_chroot_call(["urpme", "--auto"] + pkgs)
        elif self.backend == "apt":
            check_chroot_call(["apt-get", "--purge", "-q", "-y", "remove"] + pkgs)
            check_chroot_call(["apt-get", "--purge", "-q", "-y", "autoremove"])
        elif self.backend == "pacman":
            check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
Пример #22
0
    def install(self, pkgs, from_local=False):
        """ Installs packages.

        :param pkgs:
        """
        if self.backend == "packagekit":
            for pkg in pkgs:
                check_chroot_call(["pkcon", "-py", "install", pkg])
        elif self.backend == "zypp":
            check_chroot_call(
                ["zypper", "--non-interactive", "--quiet-install", "install",
                 "--auto-agree-with-licenses", "install"] + pkgs)
        elif self.backend == "yum":
            check_chroot_call(["yum", "install", "-y"] + pkgs)
        elif self.backend == "dnf":
            check_chroot_call(["dnf", "install", "-y"] + pkgs)
        elif self.backend == "urpmi":
            check_chroot_call(
                ["urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
                 "--fastunsafe", "--ignoresize", "--nolock", "--auto"] + pkgs)
        elif self.backend == "apt":
            check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
        elif self.backend == "pacman":
            pacman_flags = "-U" if from_local else "-Sy"
            check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs)
Пример #23
0
def cleanup():
    root_mount_point = libcalamares.globalstorage.value("rootMountPoint")

    # Remove livemedia configuration
    check_chroot_call(['pacman', '-R', '--noconfirm', 'lucidsystems-livemedia'])

    if(os.path.exists("%s/etc/skel/Desktop/LucidSystems-Installer.desktop" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/etc/skel/Desktop/LucidSystems-Installer.desktop'])
    if(os.path.exists("%s/usr/share/applications/lucidsystems-installer-launcher.desktop" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/usr/share/applications/lucidsystems-installer-launcher.desktop'])
    if(os.path.exists("%s/etc/skel/.config/autostart/lucidsystems-greeter.desktop" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/etc/skel/.config/autostart/lucidsystems-greeter.desktop'])

    # Remove liveuser service
    if(os.path.exists("%s/etc/systemd/system/prepare_livesystem.service" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/etc/systemd/system/prepare_livesystem.service'])
    if(os.path.exists("%s/etc/systemd/system/multi-user.target.wants/prepare_livesystem.service" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/etc/systemd/system/multi-user.target.wants/prepare_livesystem.service'])
    if(os.path.exists("%s/usr/bin/prepare_livesystem" % root_mount_point)):
        check_chroot_call(['rm', '-f', '/usr/bin/prepare_livesystem'])

    # Remove calamares
    check_chroot_call(['pacman', '-R', '--noconfirm', 'calamares', 'calamares-lucidsystems'])
Пример #24
0
def install_grub(boot_loader):
    install_path = boot_loader["installPath"]
    check_chroot_call(["grub-install", install_path])
    check_chroot_call(["grub-mkconfig", "-o", "/boot/grub/grub.cfg"])
Пример #25
0
 def install(self, pkgs):
     if self.backend == "packagekit":
         for pkg in pkgs:
             check_chroot_call(["pkcon", "-py", "install", pkg])
     elif self.backend == "zypp":
         check_chroot_call([
             "zypper", "--non-interactive", "--quiet-install", "install",
             "--auto-agree-with-licenses", "install"
         ] + pkgs)
     elif self.backend == "yum":
         check_chroot_call(["yum", "install", "-y"] + pkgs)
     elif self.backend == "dnf":
         check_chroot_call(["dnf", "install", "-y"] + pkgs)
     elif self.backend == "urpmi":
         check_chroot_call([
             "urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
             "--fastunsafe", "--ignoresize", "--nolock", "--auto"
         ] + pkgs)
     elif self.backend == "apt":
         check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
     elif self.backend == "pacman":
         check_chroot_call(["pacman", "-Sy", "--noconfirm"] + pkgs)
Пример #26
0
def run_mkinitcpio():
    """ Runs mkinitcpio with given kernel profile """
    kernel = libcalamares.job.configuration["kernel"]
    check_chroot_call(["mkinitcpio", "-p", kernel])
Пример #27
0
def run_mkinitcpio():
    kernel = libcalamares.job.configuration['kernel']
    check_chroot_call(['mkinitcpio', '-p', kernel])
Пример #28
0
    def install(self, pkgs, from_local=False):
        """ Installs packages.

        :param pkgs:
        :param from_local:
        """
        if self.backend == "packagekit":
            for pkg in pkgs:
                check_chroot_call(["pkcon", "-py", "install", pkg])
        elif self.backend == "zypp":
            check_chroot_call([
                "zypper", "--non-interactive", "--quiet-install", "install",
                "--auto-agree-with-licenses", "install"
            ] + pkgs)
        elif self.backend == "yum":
            check_chroot_call(["yum", "install", "-y"] + pkgs)
        elif self.backend == "dnf":
            check_chroot_call(["dnf", "install", "-y"] + pkgs)
        elif self.backend == "urpmi":
            check_chroot_call([
                "urpmi", "--download-all", "--no-suggests", "--no-verify-rpm",
                "--fastunsafe", "--ignoresize", "--nolock", "--auto"
            ] + pkgs)
        elif self.backend == "apt":
            check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
        elif self.backend == "pacman":
            if from_local:
                pacman_flags = "-U"
            else:
                pacman_flags = "-Sy"

            check_chroot_call(["pacman", pacman_flags, "--noconfirm"] + pkgs)
        elif self.backend == "portage":
            check_chroot_call(["emerge", "-v"] + pkgs)
        elif self.backend == "entropy":
            check_chroot_call(["equo", "i"] + pkgs)
Пример #29
0
 def install(self, pkgs):
     if self.backend == "packagekit":
         for pkg in pkgs:
             check_chroot_call(["pkcon", "-py", "install", pkg])
     elif self.backend == "zypp":
         check_chroot_call(["zypper", "--non-interactive", "--quiet-install", "install", "--auto-agree-with-licenses", "install"] + pkgs)
     elif self.backend == "yum":
         check_chroot_call(["yum", "install", "-y"] + pkgs)
     elif self.backend == "dnf":
         check_chroot_call(["dnf", "install", "-y"] + pkgs)
     elif self.backend == "urpmi":
         check_chroot_call(["urpmi"] + pkgs)
     elif self.backend == "apt":
         check_chroot_call(["apt-get", "-q", "-y", "install"] + pkgs)
     elif self.backend == "pacman":
         check_chroot_call(["pacman", "-Sy"] + pkgs)
Пример #30
0
    def remove(self, pkgs):
        """ Removes packages.

        :param pkgs:
        """
        if self.backend == "packagekit":
            for pkg in pkgs:
                check_chroot_call(["pkcon", "-py", "remove", pkg])
        elif self.backend == "zypp":
            check_chroot_call(["zypper", "--non-interactive", "remove"] + pkgs)
        elif self.backend == "yum":
            check_chroot_call(
                ["yum", "--disablerepo=*", "-C", "-y", "remove"] + pkgs)
        elif self.backend == "dnf":
            # ignore the error code for now because dnf thinks removing a nonexistent package is an error
            chroot_call(["dnf", "--disablerepo=*", "-C", "-y", "remove"] +
                        pkgs)
        elif self.backend == "urpmi":
            check_chroot_call(["urpme", "--auto"] + pkgs)
        elif self.backend == "apt":
            check_chroot_call(["apt-get", "--purge", "-q", "-y", "remove"] +
                              pkgs)
            check_chroot_call(["apt-get", "--purge", "-q", "-y", "autoremove"])
        elif self.backend == "pacman":
            check_chroot_call(["pacman", "-Rs", "--noconfirm"] + pkgs)
        elif self.backend == "portage":
            check_chroot_call(["emerge", "-C"] + pkgs)
        elif self.backend == "entropy":
            check_chroot_call(["equo", "rm"] + pkgs)
Пример #31
0
def run_mkinitcpio():
    kernel = libcalamares.job.configuration['kernel']
    check_chroot_call(['mkinitcpio', '-p', kernel])