ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/inst_custom_packages.ycp

/**
 * Module:	inst_custom_packages.ycp
 *
 * Authors:	Anas Nashif <nashif@suse.de>
 *
 * Purpose:	Client for 3rd prodcuts/addon products package installations
 *
 * $Id: inst_custom_packages.ycp 57028 2009-04-29 10:58:09Z lslezak $
 *
 */
{
    textdomain "packager";
    import "ProductFeatures";
    import "SourceManager";
    import "Directory";
    import "Popup";
    import "SlideShow";
    import "PackageSlideShow";
    import "Kernel";
    import "Installation";
    import "GetInstArgs";
    import "Mode";


    list<string> packages = (list<string>)ProductFeatures::GetFeature("software", "packages");

    boolean probeSource (string url)
    {
        symbol ret = SourceManager::createSource(url);
        if (ret != `ok )
        {
            y2error ("no repositories available on media");
            return false;
        } else {
            SourceManager::CommitSources();
            return true;
        }
    }
    if (!probeSource("dir://" + Directory::custom_workflow_dir))
    {
	// error popup
        Popup::Error(_("Could not read package information."));
        return `abort;
    }

    if (size(packages) > 0 )
    {
        y2milestone("installing packages: %1", packages );
        foreach(string pkg, packages, ``{
                if (!Pkg::PkgInstall(pkg) ) {
                    Pkg::DoProvide ([pkg]);
                }
                });
        boolean solve = Pkg::PkgSolve(false);
        if (!solve)
        {
            y2error("Error solving package dependencies");
        }
    }

    symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
    y2milestone ("inst_packages returns %1", result);
    if (result == `accept)
        result = `next;

    if (result == `next)				// packages selected ?
    {
        boolean anyToDelete = Pkg::PkgAnyToDelete();
        SlideShow::SetLanguage (UI::GetLanguage(true));
        PackageSlideShow::InitPkgData(false);
        SlideShow::OpenDialog();

        import "PackageInstallation";
        integer oldvmlinuzsize = (integer) SCR::Read(.target.size, "/boot/vmlinuz");
        list commit_result = PackageInstallation::CommitPackages (0, 0);				// Y: commit them !
        integer newvmlinuzsize = (integer) SCR::Read(.target.size, "/boot/vmlinuz");

        SlideShow::CloseDialog();

        if (Installation::destdir == "/"
                && ((commit_result[0]:0 > 0)
                    || anyToDelete))
        {
            // prepare "you must boot" popup in inst_suseconfig
            Kernel::SetInformAboutKernelChange (oldvmlinuzsize != newvmlinuzsize);

            result = (symbol) WFM::CallFunction ("inst_suseconfig", [GetInstArgs::Buttons(false, false)]);
        }
    }

    if (size(SourceManager::newSources)== 1)
    {
        Pkg::SourceChangeUrl( SourceManager::newSources[0]:-1 , "cd:///" );
    }

    return `next;

}

ACC SHELL 2018