/**
 * File:	modules/PackageAI.ycp
 * Package:	yast2
 * Summary:	Packages manipulation (autoinstallation)
 * Authors:	Martin Vidner <mvidner@suse.cz>
 *		Michal Svec <msvec@suse.cz>
 *
 * $Id: PackageAI.ycp 19253 2004-09-12 05:06:21Z nashif $
 */

{

module "PackageAI";
textdomain "base";

global list<string> toinstall = [];
global list<string> toremove = [];

boolean last_op_canceled = false;

include "packages/common.ycp";

/* default value of settings modified */
global boolean modified = false;

/**
 * Function sets internal variable, which indicates, that any
 * settings were modified, to "true"
 */
global define void SetModified () {
    modified = true;
}

/**
 * Functions which returns if the settings were modified
 * @return boolean  settings were modified
 */
global define boolean GetModified () {
    return modified;
}

global boolean DoInstall(list<string> packages) {
    toinstall = (list<string>) union(toinstall, packages);
    toremove = filter(string p, toremove, {
	return !contains(packages, p);
    });
    modified = true;
    return true;
}

global boolean DoRemove(list<string> packages) {
    toremove = (list<string>) union(toremove, packages);
    toinstall = filter(string p, toinstall, {
	return !contains(packages, p);
    });
    modified = true;
    return true;
}

global boolean DoInstallAndRemove(list<string> toinst, list<string> torem) {
    DoInstall(toinst);
    DoRemove(torem);
    modified = true;
    return true;
}

global boolean Available(string package) {
    return true;
}

global boolean Installed(string package) {
    return contains(toinstall, package);
}

global boolean InstallKernel (list<string> kernel_modules) {
    // TODO: for 9.2, we always install all packages, but
    // we could only install those really needed (#44394)

    // the kernel packages are handled by autoyast on its own
    return true;
}

/* EOF */
}
