Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
def run():
    """ Generate an initramfs image.

    :return:
    """
    return_code = chroot_call(["update-initramfs", "-k", "all", "-u"])

    if return_code != 0:
        return "Failed to run update-initramfs on the target", "The exit code was {}".format(return_code)
Beispiel #4
0
def run():
    """ Generate an initramfs image.

    :return:
    """
    return_code = chroot_call(["update-initramfs", "-k", "all", "-u"])

    if return_code != 0:
        return "Failed to run update-initramfs on the target", "The exit code was {}".format(
            return_code)
Beispiel #5
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'])
Beispiel #6
0
def run_dracut():
    return chroot_call(['dracut', '-f'])
Beispiel #7
0
def run():
    returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
    if returnCode != 0:
        return ("Failed to run update-initramfs on the target",
                "The exit code was {}".format(returnCode))
Beispiel #8
0
    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'])
#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
Beispiel #9
0
def run_dracut():
    """ Creates initramfs, even when initramfs already exists.

    :return:
    """
    return chroot_call(['dracut', '-f'])
Beispiel #10
0
def run_dracut():
    """ Creates initramfs, even when initramfs already exists.

    :return:
    """
    return chroot_call(['dracut', '-f'])
Beispiel #11
0
def run():
    returnCode = chroot_call(["update-initramfs", "-k", "all", "-u"])
    if returnCode != 0:
        return ("Failed to run update-initramfs on the target", "The exit code was {}".format(returnCode))