ACC SHELL

Path : /usr/share/YaST2/include/packager/
File Upload :
Current File : //usr/share/YaST2/include/packager/load_release_notes.ycp

/**
 * File:	installation/include/load_release_notes.ycp
 * Module:	Installation
 * Summary:	Load release notes from media
 * Authors:	Arvin Schnell <arvin@suse.de>
 *              Jiri Srain <jsrain@suse.cz>
 *
 * Load release notes from media
 *
 * $Id: release_notes_popup.ycp 34411 2006-11-15 13:45:11Z locilka $
 */

{
    textdomain "packager";

    import "Language";
    import "Report";
    import "Stage";

    /* release notes */
    string media_text = "";

// FIXME get rid of similar funciton in instlalation/clients/release_notes_popup.ycp

    /* function to load release notes */
    define boolean load_release_notes (integer source_id)
    {
	if (source_id == nil || source_id < 0) {
	    y2error ("Source_id: %1", source_id);
	    return false;
	}

        string path_to_relnotes = "/docu";

	string path_templ = path_to_relnotes + "/RELEASE-NOTES.%1.rtf";
	y2debug ("Path template: %1", path_templ);

	// try 'en_UK' for 'en_UK'
	string tmp = sformat (path_templ, Language::language);
	y2debug ("Trying to get %1", tmp);
	tmp = Pkg::SourceProvideDigestedFile (source_id, 1, tmp, true /* optional */);

	// try 'es' for 'es_ES'
	if (tmp == nil)
	{
	    tmp = sformat (path_templ, substring (Language::language, 0, 2));
	    y2debug ("Trying to get %1", tmp);
	    tmp = Pkg::SourceProvideDigestedFile (source_id, 1, tmp, true /* optional */);
	}

	// try 'en'
	if (tmp == nil)
	{
	    tmp = sformat (path_templ, "en");
	    y2debug ("Trying to get %1", tmp);
	    tmp = Pkg::SourceProvideDigestedFile (source_id, 1, tmp, true /* optional */);
	}

	// no other fallback
	if (tmp == nil)
	    return false;

	// read the release notes content
	media_text = (string)SCR::Read (.target.string, [tmp, ""]);
	if (media_text != "" && media_text != nil)
	    return true;

	return false;
    };

}


ACC SHELL 2018